Selecting fixed or dynamic address based on vendor-class-identifier
Anders Blomdell
anders.blomdell at control.lth.se
Mon Oct 21 15:06:53 UTC 2013
I would like the ISC dhcpd server to hand out either a dynamic ip address or
a fixed address based on the vendor-class-identifier (I want a dynamic address
from one subnet during pxeboots and a [possibly] fixed address from another
subnet otherwise). I have been able to do it by running two instances of the
dhcp server on the interface, but not by using shared-network.
The working configuration consists of /tmp/254.conf:
class "pxeclient" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
}
subnet 192.168.254.0 netmask 255.255.255.0 {
pool {
allow members of "pxeclient";
range 192.168.254.100 192.168.254.109;
}
}
and /tmp/255.conf:
host boottest {
hardware ethernet 02:13:10:07:11:58;
fixed-address 192.168.255.12;
if substring(option vendor-class-identifier, 0, 9) = "PXEClient" {
ignore booting;
}
}
subnet 192.168.255.0 netmask 255.255.255.0 {
}
when running both of them with:
/usr/sbin/dhcpd -d -cf /tmp/254.conf -lf /tmp/254.lease --no-pid
/usr/sbin/dhcpd -d -cf /tmp/255.conf -lf /tmp/255.lease --no-pid
I get the following expected result:
# PXE-booting
DHCPDISCOVER from 02:13:10:07:11:58 via eth0
DHCPOFFER on 192.168.254.100 to 02:13:10:07:11:58 via eth0
# Ordinary boot
DHCPDISCOVER from 02:13:10:07:11:58 via eth0
DHCPOFFER on 192.168.255.12 to 02:13:10:07:11:58 via eth0
But I'm not able to achieve it with just one instance of dhcpd,
the reason seems to be that the 'ignore booting' will be active
for both subnets when the machine is PXE-booting and hence it will
not get an address from the pool.
Anybody that has a good idea on how to solve this?
Regards
Anders
--
Anders Blomdell Email: anders.blomdell at control.lth.se
Department of Automatic Control
Lund University Phone: +46 46 222 4625
P.O. Box 118 Fax: +46 46 138118
SE-221 00 Lund, Sweden
More information about the dhcp-users
mailing list