DHCP server with a group of mac address

Simon Hobson dhcp1 at thehobsons.co.uk
Wed Sep 26 13:21:52 UTC 2012

Ahmad Faisal wrote:

>  >I use classes and a separate file with subclasses, one pr line. If 
>you only have the list, it can be >reformattedto the right format 
>easily with e.g. awk.
>>    |
>>    v
>  >subclass "xyz"  1:11:22:33:44:55:66;
>I don't really get what you mean, how do i include the text file 
>with all the mac address into the dhcpd.conf and declare on which 
>dhcpd syntax ? Do you have the sample of the dhcpd.conf ?

"man dhcpd.conf", see the section on classes, and then subclasses.

>class "some_class_name1" {
>   match  hardware;
>subclass "some_class_name1" 1:11:22:33:44:55:66;

Repeat the subclass statement for each MAC address.

For ease, assuming the list of MACs is held externally, you can use 
"include" to include a separate file in the config. So in dhcpd.conf 
you can add (for example) :

>class "some_class_name1" {
>   match  hardware;
>include "/etc/dhcp3/mac_list";

to add the list of subclass declarations into the config.

Then to actually use this, you need to add an "allow" statement to your pools :

>subnet ...
>   pool {
>     range ...
>     allow members of "some_class_name1" ;
>   }

There is another way of doing it. You can add a host statement for 
each MAC address (note, these should be in the global scope) :
>host "some_host" { hardware ethernet 11:22:33:44:55:66; }

And then use "allow known hosts" to permit only these devices to get 
an address. The classes/subclasses technique is more flexible if you 
need to do more than just "allow one set of clients" in the future. 
Also, "allow known clients" will also permit clients with a fixed 
address assignment in a host declaration - which would preclude you 
using fixed addresses.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the dhcp-users mailing list