[ipxe-devel] Telling iPXE to only take certain DHCP offers

Michael Brown mbrown at fensystems.co.uk
Thu May 5 15:50:38 UTC 2011


On Thursday 05 May 2011 16:42:10 Floris Bos wrote:
> Is there any way to tell iPXE to only accept DHCP offers that have the
>  "boot file name" set?
> 
> Concerns a scenario in which there are two DHCP servers active within the
>  same network.
> 
> 1) One that hands out IP-addresses to everyone for normal network use, and
> whose settings cannot be changed.
> 
> 2) One that is meant to perform network installations. It only hands out
>  offers (with the boot file name set) to the MAC-addresses of computers
>  that needs to be provisioned.
> 
> Want iPXE to ignore the offers from server 1.

Are you able to define the ipxe.priority option for server 2?  If it's dhcpd, 
then something like:

  option space ipxe;
  option ipxe-encap-opts code 175 = encapsulate ipxe;
  option ipxe.priority code 1 = signed integer 8;

  option ipxe.priority 1;

That should cause iPXE to prefer offers from server 2.

You may also want to apply an embedded script that retries DHCP until a 
filename is obtained, such as:

  #!ipxe
  :retry_dhcp
  dhcp && isset ${filename} || goto retry_dhcp
  ...

That should then catch the renegade cases in which server 2 happens not to 
respond to the offer (e.g. due to a dropped packet, server reboot, etc.)

Michael






More information about the ipxe-devel mailing list