mycroes

There's always time to play

Wednesday, January 12, 2011

DHCP for PXE booting only

At work we use a Novell Netware 5 server (don't worry, it will be replaced) for, amongst others, DHCP. Not much of an issue, but I wanted to netboot clients so I could do easy operating system installations. When I wanted to add the appropriate options to the DHCP server, I noticed it wasn't possible. Some searching on the internet revealed some hacks, but nothing you'd easily try on a server in use.

So then what? I noticed before when I was trying to boot PXE clients and they were attached to the main network (instead of my private network) that they wouldn't get (accept?) DHCP leases, so there was my solution: add a DHCP server that gives leases to PXE clients only.

Although this may sound hard, it's actually pretty easy. PXE clients send along a so-called vendor class identifier containing the string PXEClient. Using the ISC DHCP server we can easily check for this string, and then hand out a lease to those clients only. One last thing to keep in mind: don't hand out leases in the same range as the authorative DHCP server.

Finally, here's a sample config (/etc/dhcp3/dhcpd.conf):
ddns-update-style none;
option domain-name "mycroes.nl";
option domain-name-servers 192.168.5.1;

default-lease-time 600;
max-lease-time 7200;
log-facility local7;

class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
filename "pxelinux.0";
}

shared-network 5 {
subnet 192.168.5.0 netmask 255.255.255.0 {
}
pool {
allow members of "pxeclients";
range dynamic-bootp 192.168.5.201 192.168.5.240;
}
}