Selecting fixed or dynamic address based on vendor-class-identifier
Sten Carlsen
stenc at s-carlsen.dk
Mon Oct 21 15:24:20 UTC 2013
My take on this would be to test this:
class "pxeclient" {
match if substring (option vendor-class-identifier, 0, 9) =
"PXEClient";
}
host boottest {
hardware ethernet 02:13:10:07:11:58;
fixed-address 192.168.255.12;
}
shared-network all{
subnet 192.168.254.0 netmask 255.255.255.0 {
pool {
allow members of "pxeclient";
range 192.168.254.100 192.168.254.109;
}
}
subnet 192.168.255.0 netmask 255.255.255.0 {
deny members of "pxeclient"; }
}
The uncertain point here is that in a shared network there is really
nothing to tell which subnet the host belongs to, no DHCP-Relays etc.
This should work if a class has higher preference than a host statement.
I don't know the answer to that, I would have to test it.
On 21/10/13 17.06, Anders Blomdell wrote:
> 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
>
--
Best regards
Sten Carlsen
No improvements come from shouting:
"MALE BOVINE MANURE!!!"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20131021/165f7912/attachment.html>
More information about the dhcp-users
mailing list