Changing dhcp variables served to pxe booting clients

Richard Grant rfg3 at mcs.le.ac.uk
Tue Jul 14 14:12:34 UTC 2009


Hi,

I'm trying to do something which seems like it should be easy, but I cannot
figure out how to make it work...

The situation is that we have a bunch of PCs that dual boot. When they are
running normally they need to be given a certain set of dhcp 
information. When
they are PXE booting to reinstall linux, they need to be given a 
different set
of dhcp information (a different router, next-server, etc).

Previously, with a different version of DHCP, we could set up a macro which
contained the different sets of DHCP information. Then when we wanted to
reinstall a PC we just changed which macro it used.

It looks like we should be able to use if...else statements in DHCP to do
something similar. I tried:

subnet xxx.xxx.xxx.0 netmask 255.255.255.0 {
   if option user-class = "install" {
      <reinstalling dhcp parameters>
   } else {
      <normal dhcp parameters>
   }
}

with host entries outside the subnet of the form:

host pc1000 { hardware ethernet 00:11:22:33:44:55; fixed-address pc1000; 
option user-class install;}

However, this never returned true, and always just returned the 'else'
parameters, even though the user-class option which set to "install".

I have tried all sorts of other methods, but couldn't get anything to work.

Can anyone help me find a way to make the above system work? The object 
is to
have a script which changes the value of the user-class parameter to 
"install"
when we want to perform a reinstall, and to "noinstall" or something 
else when
we want the PC to boot as normal.

Alternately, is there a way to get it so that the dhcp server can 
automatically
tell if the PC is PXE booting, and hence serve it different parameters? 
I saw
an example that seemed to do this, but it didn't actually work. It was 
of the
form:

if substring(option vendor-class-identifier, 0, 9) = "PXEClient" {
      <reinstalling dhcp parameters>
} else {
      <normal dhcp parameters>
}

Any idea how this might be made to work? Does that 
vendor-class-identifier only
with certain hardware, something like that?

If there is any more information I need to give about my setup, then 
just let
me know. I'm pretty new to this sort of functionality in DHCP.

Thanks,

Richard Grant



More information about the dhcp-users mailing list