From 83abba4e2560812464e63c8f5ad9e3d53bdb3406 Mon Sep 17 00:00:00 2001 From: WayneBennett666 Date: Tue, 2 Jun 2026 18:05:39 +1000 Subject: [PATCH] updated ipxe configuration --- docs/pxe-boot.md | 24 +++++++++++++++++++++++- hosts/pxe-boot/configuration.nix | 21 ++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/pxe-boot.md b/docs/pxe-boot.md index f5e709d..4ec2b8a 100644 --- a/docs/pxe-boot.md +++ b/docs/pxe-boot.md @@ -7,7 +7,9 @@ The `pxe-boot` host serves HTTP boot assets for iPXE clients. - Hostname: `pxe-boot` - Web service: nginx on TCP port 80 - PXE root: `/srv/pxe` -- Generated iPXE menu: `/srv/pxe/boot/menu.ipxe` +- iPXE entry script: `/srv/pxe/boot.ipxe` +- Generated iPXE menu: `/srv/pxe/menu.ipxe` +- TFTP fallback script: `/srv/pxe/boot/autoexec.ipxe` - Boot binaries copied from the Nix `ipxe` package: - `/srv/pxe/boot/ipxe.efi` - `/srv/pxe/boot/undionly.kpxe` @@ -24,6 +26,18 @@ The host creates these directories with systemd tmpfiles: /srv/pxe/rescue ``` +The HTTP iPXE chain is: + +```text +undionly.kpxe or ipxe.efi + -> autoexec.ipxe from the TFTP root, when iPXE requests it + -> http://192.168.2.247/boot.ipxe + -> http://192.168.2.247/menu.ipxe +``` + +The same scripts are also exposed under `/boot/` for compatibility with older +checks and any DHCP option that already points there. + The generated menu currently exposes entries for: - NixOS installer @@ -46,7 +60,15 @@ nix eval .#nixosConfigurations.pxe-boot.config.system.build.toplevel.drvPath --r After deployment by an operator, basic service checks are: ```bash +curl http://pxe-boot/boot.ipxe +curl http://pxe-boot/menu.ipxe curl http://pxe-boot/boot/menu.ipxe +curl http://pxe-boot/boot/autoexec.ipxe curl -I http://pxe-boot/boot/ipxe.efi curl -I http://pxe-boot/boot/undionly.kpxe ``` + +During a successful BIOS chainload, TFTP should deliver `undionly.kpxe` once, +then nginx should log requests for `/boot.ipxe` and `/menu.ipxe`. Repeated TFTP +downloads of `undionly.kpxe` indicate the iPXE stage is still not reaching the +HTTP chain. diff --git a/hosts/pxe-boot/configuration.nix b/hosts/pxe-boot/configuration.nix index f4927b9..46d9071 100644 --- a/hosts/pxe-boot/configuration.nix +++ b/hosts/pxe-boot/configuration.nix @@ -2,7 +2,22 @@ let pxeRoot = "/srv/pxe"; - pxeBaseUrl = "http://pxe-boot"; + pxeBaseUrl = "http://192.168.2.247"; + + bootIpxe = pkgs.writeText "boot.ipxe" '' + #!ipxe + + dhcp + echo Booting from PXE server... + chain ${pxeBaseUrl}/menu.ipxe + ''; + + autoexecIpxe = pkgs.writeText "autoexec.ipxe" '' + #!ipxe + + dhcp + chain ${pxeBaseUrl}/boot.ipxe + ''; menuIpxe = pkgs.writeText "menu.ipxe" '' #!ipxe @@ -78,6 +93,10 @@ in "d ${pxeRoot}/nixos 0755 root root -" "d ${pxeRoot}/ubuntu 0755 root root -" "d ${pxeRoot}/rescue 0755 root root -" + "C+ ${pxeRoot}/boot.ipxe 0644 root root - ${bootIpxe}" + "C+ ${pxeRoot}/menu.ipxe 0644 root root - ${menuIpxe}" + "C+ ${pxeRoot}/boot/autoexec.ipxe 0644 root root - ${autoexecIpxe}" + "C+ ${pxeRoot}/boot/boot.ipxe 0644 root root - ${bootIpxe}" "C+ ${pxeRoot}/boot/menu.ipxe 0644 root root - ${menuIpxe}" "C+ ${pxeRoot}/boot/ipxe.efi 0644 root root - ${pkgs.ipxe}/ipxe.efi" "C+ ${pxeRoot}/boot/undionly.kpxe 0644 root root - ${pkgs.ipxe}/undionly.kpxe"