← Back to context

Comment by toast0

7 months ago

I'm sure there's howto's around, maybe this one from ipxe is a good place to start [1], but if you're running isc-dhcpd (which is discontinued, but still works, so....) you add something like this into your subnet config:

   next-server 192.0.2.11;

   if exists user-class and option user-class = "iPXE" {
      option ipxe.no-pxedhcp 1;
      filename "http://192.0.2.11/tftpboot/menu.ipxe";
   } else {
      if option client-arch = 00:06 {
         filename "ipxe.efi-i386";
      } else if option client-arch = 00:07 {
         filename "ipxe.efi-x86_64";
      } else {
         filename "undionly.kpxe";
      }
   }

(use your addresses instead of rfc 5737 addresses). Note that the client-arch for amd64/x86_64 matches what PXE clients actually use instead of what the rfc 4578 says (there's an errata, but rfc policy is not to incorporate corrections sigh ). If you've got other archs, you can probably figure it out.

You've got to run a tftp server on the next server address; and just FYI some PXE clients won't reach outside their subnet to get to the tftp server. Grab the ipxe binaries from wherever is convenient and they live in the root of the tftpserver.

You can follow the ipxe docs for what to put in your menu file. I've got a menu of weird things, which includes item --key n netboot netboot.xyz [n]

   :netboot
   chain --autofree http://boot.netboot.xyz/
   goto main_menu

You could probably just use the boot.netboot.xyz in your dhcpd config and then you don't have to write a menu at all.

Depending on your client machines, expect to have to fiddle around a bit. I've got some machines where PXE works, but the keyboard won't work in PXE, so that's not super useful. Others where PXE doesn't really work in UEFI mode, only in BIOS mode; there's probably some vice versa. Also, I've never figured out a good way to load ISOs in UEFI mode ... in BIOS mode you can use MEMDISK and if the OS supports it, it can find the disk image in memory and mount it when it boots. The netboot people do a good job of finding ways to make things work, but don't expect everything to work.

I originally started from some version of this document [2], but I've moved on since then. IMHO, netbooting is a nice way to run hobby OSes... no need to worry about a boot loader and all that, just build for multiboot and ipxe will work (and grub will work, too, if you ever do want to run off a disk)

It's possible to get Windows ISOs to boot with PXE, but it takes a lot more patience than I've got to make it work well ... if I use iscsi, the OS loads, but takes several minutes to get the disk image mounted after the installer starts; it would probably be faster to write the image to a usb disk and run from there. I was able to install to an iscsi drive, but then the same problem with mounting happened when I tried to boot from there, and then you just end up at a stop error screen because the OS really does want a mounted filesystem when it starts. (there's something about tweaking the driver setup, but that's too much work for me, I found a drive to run off of, and did what I needed to do)

[1] https://ipxe.org/howto/dhcpd

[2] https://wiki.debian.org/PXEBootInstall?action=show&redirect=...