Koozali.org: home of the SME Server

DHCP only for special macs

Offline uli334

  • ****
  • 128
  • +0/-0
DHCP only for special macs
« on: June 18, 2016, 01:44:32 PM »
Hello,

in my SME- Network I want to use dhcp only for some ip-telephones of a special producer. The devices of this producer have a typically mac- range.
Is ist possilble that the dhcp- server allocates ip- adresses only to the devices of this producer, based on the mac- range?

Greetings, Uli

Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: DHCP only for special macs
« Reply #1 on: June 18, 2016, 05:23:33 PM »
you might need a to do a template custom for this an easy way.

All I can think of is to attribute an IP for each known MAC addresses, but not for a range of  mac.

If you find a way to do it with any linux, we might help to adapt it for SME.

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: DHCP only for special macs
« Reply #2 on: June 18, 2016, 11:21:19 PM »
uli334

You can manually put entries in the hostname panel that will allocate a specific IP to a specific MAC address. Do this for each MAC addresses that those special devices use. Each device will always receive the same IP, as long as the MAC address does not change, which can happen if the hardware device is repaired or changed.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline uli334

  • ****
  • 128
  • +0/-0
Re: DHCP only for special macs
« Reply #3 on: June 19, 2016, 05:43:31 PM »
No, I dont want to rserve ip-adresses for devices, I want the dhcp-server to assign adresses only to devices of a special producer.
----------
Example with the dhcp-server "dnsmasq":

in "dnsmasq.conf" you see the row:

01 dhcp-range=192.168.1.1,192.168.1.100,12h
----------

The "12h" means the first 3 bytes of the mac and is assigned to a special producer, in my case:
- SnomTech SNOM Technology AG     00:04:13:xx:xx:xx

The effect I want to reach is, that only the devices of the producer Snom (IP-Telephones) can get an ip- adress from the dhcp- server, all other devices (i.e. a notebook from lenovo 00:12:FE:xx:xx:xx), get nothing from there!

But I only know, how this can be set in dnsmasq. What dhcp server is the SME using and ist it possible to set comparable options?

Greetings, Uli

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: DHCP only for special macs
« Reply #4 on: June 19, 2016, 06:36:57 PM »
uli334

Quote
No, I dont want to rserve ip-adresses for devices, I want the dhcp-server to assign adresses only to devices of a special producer.

It is probably the only "easy" way to achieve what you want, unless you are willing to work out how to create the necessary custom template (if it can at all be done).

Limit the DHCP range (in console) to 1 IP number & ensure you have at least 1 local device connected that requests a IP from the DHCP server.
That means there will be no more IP numbers to allocate to any other connected devices that are requesting an IP from the DHCP server.

Then say you have 10 IP phones, with 10 different mac addresses, then reserve those for the mac addresses of the 10 IP phones. As they are connected, then the reserved IP addresses will be used & no other devices can get those IP addresses.

I am not absolutely certain it will achieve the total outcome that you want, but it will be close, so give it a try at least.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline uli334

  • ****
  • 128
  • +0/-0
Re: DHCP only for special macs
« Reply #5 on: June 20, 2016, 05:56:18 AM »
Thanks for your suggestion, I'll give it a try. From SME8 I know, that IPs can be reserved as you describe but in the case that one of the devices with reserved IP gets offline, this IP is given to another device (one without reservation).
If the original devive then is online again may be there is no IP left and it stays offline...
Thats not ideal for phones...

Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: DHCP only for special macs
« Reply #6 on: June 20, 2016, 06:11:46 AM »
i n fact reserved IP SHOULD be outside of the DHCP pool of dynamically assigned IP.

To get the DHCP server to work you need at least 1 ip available in the DHCP pool.

What Janet was suggesting is to alocate this ip to a machine you know will always be online, to avoid the risk of having an undesirable laptop to connect and get this only  DHCP dynamically assigned IP.

All other IP are not in the pool of dynamically assigned IP so you have no risk of having them assigned to someone else, unless this person manually set this ip in his machine.

Now if you do not mind having machines that could have dhcp dynamically assigned IP forget about the one IP pool, and do this this way :

let's say you need 100 ip for your phones with fixed IP and 100 for dhcp computer:

- SME local IP 192.168.75.1
- pool for dhcp  : 192.168.75.102 to 192.168.75.201; netmask 255.255.255.0
- pool for phones with static IP, reserved by MAC : 192.168.75.2 - 192.168.75.101 (this is just to keep in your mind you do not have to fill this in the configuration)

- then either enter thru the manager each ip, or create a small script that could extract the list of phonename /IP / MAC from a txt or xls file to the right syntax to put in a template-custom :

Code: [Select]
host $PHONE_NAME_WITHOUT_SPACE {
    hardware ethernet $MAC;
    fixed-address $IP;
}


Offline janet

  • *****
  • 4,812
  • +0/-0
Re: DHCP only for special macs
« Reply #7 on: June 20, 2016, 07:00:22 PM »
uli334

 
Quote
..... I know, that IPs can be reserved as you describe but in the case that one of the devices with reserved IP gets offline, this IP is given to another device (one without reservation).
If the original device then is online again may be there is no IP left and it stays offline...
Thats not ideal for phones...

As JPP has also said, what you say is NOT correct as the reserved IPs should be  outside the DHCP range of IPs specified in the admin console "Configure this server" screens.
Only a device with the specified MAC address can be given the IP in question.
You have to manually enter the IP & corresponding MAC address in the Hostnames and addresses panel in server manager, which implies you have to firstly obtain the physical MAC address from each hardware device.
« Last Edit: June 20, 2016, 07:04:30 PM by janet »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline uli334

  • ****
  • 128
  • +0/-0
Re: DHCP only for special macs
« Reply #8 on: June 22, 2016, 03:17:41 AM »
Hello Janet, hello JPP

thanks for your comments. What I didn't know was, that when i set an ip for a device via "hostnames" out of the dhcp- range, it gets this ip from the dhcp-server.

I tried, as you said and now it is working exact as I intended. Thats the solution for my case!

Last problem I have now is the squid-auth in the contribs- section :-)

Best regards, Uli

Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: DHCP only for special macs
« Reply #9 on: June 22, 2016, 04:40:47 AM »
Hello Janet, hello JPP

thanks for your comments. What I didn't know was, that when i set an ip for a device via "hostnames" out of the dhcp- range, it gets this ip from the dhcp-server.

I tried, as you said and now it is working exact as I intended. Thats the solution for my case!

Last problem I have now is the squid-auth in the contribs- section :-)

Best regards, Uli

Good !
And to complete, the normal behaviour of the manager is to not let you to set an ip inside of the dynamically assigned pool of IP to avoid what you feared ! (however by adding the MAC/IP via a custom template you can override this and the Dhcp server will not complain, but the client might if as you mentioned someone else had this ip assigned).
Nothing is magical, be aware that you can still have somebody assigning himself a static IP on hist laptop that is one of the phones' , but this is less probable.

So let's switch on your other thread with squid auth.

can you please edit your first post to add [solved] to the title ?