Dumb Tricks with gPXE
For my first bit of magic with gPXE I decided to replace the boot ISOs I have for folks that are unable to install machines via PXE. With gPXE I don’t need my RHEL initrd and kernel image to boot strap myself into an install from a CD or USB stick. I’ve encoded the TFTP server and the file name to grab and execute into the gPXE image so as long as the machine can get any type of DHCP lease it will load up my PXELINUX environment. This makes the boot CD images work identically to doing a real PXE boot…because you are.
Step 1: I grabbed the gPXE distribution and unpacked it. I patched its autoboot functionality as described here. This lets me DHCP automatically even if the first ethernet device is not the one connected to the network. For gPXE 1.0.1 you can use my patch instead.
Step 2: Make an embedded script file. This just supplies the
information to gPXE that a normal PXE boot would get from the
next-server
and filename
options in the DHCP response.
#!gpxe
autoboot
chain tftp://FQDN/pxelinux.0
Yup, we have DNS support so just add the FQDN of your TFTP server. In my
setup I have pxelinux.0
in the root of my TFTP server.
Step 3: Build gPXE with your embedded script.
make EMBEDDED_IMAGE=path/to/your/script
Step 4: Burn the resulting ISO onto a CD and PXE boot a PXE-less machine.