This commit is contained in:
+23
-1
@@ -7,7 +7,9 @@ The `pxe-boot` host serves HTTP boot assets for iPXE clients.
|
|||||||
- Hostname: `pxe-boot`
|
- Hostname: `pxe-boot`
|
||||||
- Web service: nginx on TCP port 80
|
- Web service: nginx on TCP port 80
|
||||||
- PXE root: `/srv/pxe`
|
- 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:
|
- Boot binaries copied from the Nix `ipxe` package:
|
||||||
- `/srv/pxe/boot/ipxe.efi`
|
- `/srv/pxe/boot/ipxe.efi`
|
||||||
- `/srv/pxe/boot/undionly.kpxe`
|
- `/srv/pxe/boot/undionly.kpxe`
|
||||||
@@ -24,6 +26,18 @@ The host creates these directories with systemd tmpfiles:
|
|||||||
/srv/pxe/rescue
|
/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:
|
The generated menu currently exposes entries for:
|
||||||
|
|
||||||
- NixOS installer
|
- 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:
|
After deployment by an operator, basic service checks are:
|
||||||
|
|
||||||
```bash
|
```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/menu.ipxe
|
||||||
|
curl http://pxe-boot/boot/autoexec.ipxe
|
||||||
curl -I http://pxe-boot/boot/ipxe.efi
|
curl -I http://pxe-boot/boot/ipxe.efi
|
||||||
curl -I http://pxe-boot/boot/undionly.kpxe
|
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.
|
||||||
|
|||||||
@@ -2,7 +2,22 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
pxeRoot = "/srv/pxe";
|
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" ''
|
menuIpxe = pkgs.writeText "menu.ipxe" ''
|
||||||
#!ipxe
|
#!ipxe
|
||||||
@@ -78,6 +93,10 @@ in
|
|||||||
"d ${pxeRoot}/nixos 0755 root root -"
|
"d ${pxeRoot}/nixos 0755 root root -"
|
||||||
"d ${pxeRoot}/ubuntu 0755 root root -"
|
"d ${pxeRoot}/ubuntu 0755 root root -"
|
||||||
"d ${pxeRoot}/rescue 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/menu.ipxe 0644 root root - ${menuIpxe}"
|
||||||
"C+ ${pxeRoot}/boot/ipxe.efi 0644 root root - ${pkgs.ipxe}/ipxe.efi"
|
"C+ ${pxeRoot}/boot/ipxe.efi 0644 root root - ${pkgs.ipxe}/ipxe.efi"
|
||||||
"C+ ${pxeRoot}/boot/undionly.kpxe 0644 root root - ${pkgs.ipxe}/undionly.kpxe"
|
"C+ ${pxeRoot}/boot/undionly.kpxe 0644 root root - ${pkgs.ipxe}/undionly.kpxe"
|
||||||
|
|||||||
Reference in New Issue
Block a user