How to configure dhcpd to send a preferred IP-address for a client-class ?

Martin Robrecht Martin.Robrecht at
Thu Mar 29 08:05:23 UTC 2007

How to configure dhcpd to send a preferred IP-address for a client-class ?

My company uses the second ethernet-adapter at our customers PC's to
control our devices in a subnet which has the same IP-configuration
at each customers site. There the DHCP-Server services different device-types
only on the specified second ethernet-adapter.
There are several thousand devices at all our
customers sites whose detailed MAC-Addresses are not known.
Therefore it is not possible for me to configure the dhcp-server
at our customer sites depending on MAC-Addresses.
But each device-type sends an specific DHCP client-hostname option
if it uses DHCP at all.

Our older hardware does not use DHCP and
our older software expects each device-type at a special IP-address.
To maintain backward compatibility the DHCP-server sends the same IP-address
the devices would use without DHCP :

dhcpd.conf looks like this :

class "DEVICE_type_1" { match if option host-name = "device_type_1" ; }
class "DEVICE_type_2" { match if ( substring ( option host-name, 0,4) = "device_type_2" ); }

subnet x.x.x.0 netmask
  pool { range x.x.x.1 ; allow members of "DEVICE_type_1"; }
  pool { range x.x.x.2 ; allow members of "DEVICE_type_2"; }
  pool { # general pool for devices which have no fixed addresses in the field
         range x.x.x.3 x.x.x.254;
         deny members of "DEVICE_type_1";
         deny members of "DEVICE_type_2";

Only one instance of DEVICE_type_x is at a customers site currently.

Problem of this configuration :

  1) If I want to add another device of DEVICE_type_1 , is there any possibility to say
     that the first DHCPREQUEST should get x.x.x.1 ( the preferred address )
     and the second DHCPREQUEST should get an arbitrary IP-address from an other pool ?

     I tested a pool declaration with a range of two IP-adresses and the
     combination of two pool declaration for the same class. The DHCP-server ( V3.0.1 )
     always sends the highest unused IP-address of all matching pools
     and as mentioned in other threads this algorithm may change.

  2) It may be necessary to replace an faulty device.
     The new device of the same class will not get an IP-Address
     because the pool is exhausted.

     Currently the DHCP-server must be stopped, the leases file must be edited,
     and then the DHCP-server must be restarted. This is error-prone.

     a) Can I use Omapi to delete the used lease object ?
        I tried it using omshell but this does not work.
        omshell man-page says "yes" but dhcpd man-page says "currently no" .

     b) Can I use Omapi to set the lease state to free ?

     c) Can I configure the DHCP-server to reuse the same IP-address
        ignoring the different MAC-addresses if the device belongs to the same class ?
        Of course my preferred solution !

Freundliche Gruesse / kind regards

        Martin Robrecht

More information about the dhcp-users mailing list