Assign fixed-address using dhcp-client-identifier

Simon Hobson dhcp1 at thehobsons.co.uk
Tue Mar 11 07:43:37 UTC 2008


Matthew wrote:
>Is there a method to intelligently assign a 'fixed-address' based on 
>a client's 'dhcp-client-identifier'?
<snip>
>But if I try similar assignment with fixed-address....
>
>      fixed-address = 10.100.20.(substring(option dhcp-client-identifier,2,1));
>
>...I get the following error....
>
>      /etc/dhcpd.conf line 260: = (61): expecting IP address or hostname
>          fixed-address =
>                        ^
>      Configuration file errors encountered -- exiting


So, you want the last byte of hte address to match the second byte of 
the client-id ?

At present there is NO easy way to do this. I can think of two 
methods that might fit the bill depending on what you are trying to 
achieve (depends on what the client-ids look like).


One that I think will work now would be reserved leases - IF you know 
in advance what the client-ids will be. You could knock up a quick 
script to generate skeleton leases to match clients to addresses and 
add the reserved option. Stop the server, add these leases to the 
leases file, start the server - then whenever one of these clients 
connects, the server will see that it already has a lease and will 
offer it. Because the leases are marked reserved, they will never be 
allocated to another client.

Another method would be to create a class & pool for every client - 
check back in the archives and you'll find examples of how to do 
this, look for option-82. With this method you could use anything as 
your 'key'.


One thing I'll mention though, have you considered the possibility of 
an ID clash ? Or is the second byte of the client-id guaranteed to be 
unique ?


More information about the dhcp-users mailing list