PXE booting multiple bootfiles

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

PXE booting multiple bootfiles

Rob Janssen-2

I am looking for some trick to select alternative bootfiles when booting with PXE.
Background: I have several network bootable images on the bootserver, like installation
of Linux or Windows, live booting of Clonezilla to make images of disks, etc.

In the old days this wasn't a problem.  I used a "PXE menu" and the DHCP server was
set up to serve that, and it would "chain" to the proper next bootable image depending
on the selection made in the menu.  At first I used "3Com Pre-OS" and later I moved
on to using PXELINUX with a menu.c32 module and its configuration.

However, this no longer works properly with new systems that use EFI booting.
It is still possible to make a PXELINUX menu for that, but one can no longer "chain"
to a completely different bootable image.  So with some care I can still boot some
different Linux images from that menu, but installing Windows from the menu is
no longer possible.

After a lot of searching I found that PXE network boot ROMs on the client should in fact
be able to provide a menu, using a tricky vendor-encapsulated-options setup.  I read
that "dnsmasq" apparently has a compiler for such options and it can be configured
with statements like this:

 pxe-service=x86PC, "Boot from local disk", 64
 pxe-service=x86PC, "PXE-Linux", "pxelinux"
 pxe-service=x86PC, "PXE-Linux on", "pxelinux",
 pxe-service=x86PC, "ACME Deployment server", "acme",

This somehow configures a vendor-encapsulated-options string, but I cannot find what
it exactly does.

For ISC DHCPD I found an option space declaration for some of the things to be put
in the encapsulated options, but whatever I try I cannot get the client to display a menu.
Maybe I am doing it wrong, maybe the client does not support it.
Anyone who has experience with setting this up with ISC DHCPD?
I only need the menu to provide a couple of selections each with a different bootfile, no
need for different boot servers as they are all on a single server.

Else, I am looking for some trick to be able to serve two different boot files to PXE booting
clients, e.g. alternately serving different boot files on subsequent requests.  I could then
boot those clients, and when I get the wrong bootfile I can just reboot it again and usually
get the correct one.  It would be fine when its toggling would be "global", i.e. not for
each individual client but for any client booting on that network.

Of course I know that I can do stuff like this:
if (some condition) {
    option bootfile-name "firstfile";
} else {
    option bootfile-name "secondfile";

and put that in a class for PXE booting matched by:
match if (substring(option vendor-class-identifier,0,9) = "PXEClient");

However, what I am looking for is some kind of trick to have that condition toggle between
invocations.  Is it possible to maintain some state between requests?

I have thought about using the lease-time and rely on the fact that with dhcp-cache-threshold
setting a second boot will get re-issued the same lease and thus has a shorter lease time
than the first one.  However, unfortunately the lowest setting of dhcp-cache-threshold is 1%
and it is not possible to get a reasonable lease time and still have an acceptable window for
the second boot to use this trick.
It would have worked when dhcp-cache-threshold could be specified in seconds rather than as
a percentage, as I could set it to something like 60 seconds.

ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
[hidden email]