Custom pxe boot loaders, how to?

Michael Torrie torriem at
Wed Oct 23 08:50:52 MDT 2013

On 10/23/2013 02:15 AM, Dan Egli wrote:
> Anyone know of a good page that details building the pxe boot file
> (pxelinux.0)? In one of my side projects I'm considering setting the boot
> server so that if boxes are connected to eth1 the "default" file they pull
> would be something like /tftpboot/primary/default, and if it's connected to
> eth2, it would be /tftpboot/secondary/default. The problem is I've only
> ever used the provided pxelinux.0 file, so I wouldn't know how to build a
> new one. If someone knows of a good web page that describes how to
> customize the pxelinux.0 file so that I could have like
> /tftpboot/pxelinux.primary and /tftpboot/pxelinux.secondary, I'd love to
> know of it. This is likely to be on Fedora if that makes any difference.
> Step by Step directions preferred. :)

You don't have to change pxelinux.0.  It's a binary boot loader.
There's really not a lot to change there.  You do, however, change the
config file that pxelinux loads, which in turn tells it what to load
kernel-wise and how to run it.

If you watch how the PXE linux loader works when a machine boots, first
it tries to load a config named for the MAC address.  If that fails, it
starts to try parts of the client IP address (in hex) starting with the
full address and working back to IP address parts.  If that fails, it
selects "default." -- you can see what I'm
talking about in the second section.

In this way you can provide default loader files for a single host based
on mac address, or a range of hosts, based on IP address or subnet.
Also you can do much of this in DCHP, by specifying dhcp options to the
client for pxelinux to use, on a per-host basis.  Definitely read up on
the link above.

More information about the PLUG mailing list