Using gPXE to alter boot configuration with Server Side Scripting

Jurjen Bokma

April 2009

gPXE is a PXE boot loader that supports HTTP. This makes it possible for a client to be booted with what the server thinks is appropriate, based on whatever information we like to make it depend on. gPXE is actually meant to be put in a BOOT ROM, but a gPXE bootstrap can be chainloaded onto a standard NIC with onboard PXE support using a DHCP and a TFTP server. The basic setup also describes other DHCP servers, but the Linux case in short is:

  1. Roughly:

    apt-get -y install tftpd-hpa
    mkdir /var/lib/tftpboot/tftpboot
    scp ~/tmp/syslinux-3.75/gpxe/src/bin/undionly.kpxe !$

  2. group gpxe
      if substring (option vendor-class-identifier, 0, 9) = "PXEClient"
          allow booting;
          filename "undionly.kpxe"; # This file compiled from the newest PXELinux source
      if exists user-class and option user-class = "gPXE"
          filename "";
      host sandbox  { hardware ethernet 00:11:22:33:44:55 ; fixed-address ; }
      } # end group gpxe