nixos-module/container/dhcp-server: enhance matching for pxe/efi/rpi4

This commit is contained in:
Astro 2022-08-22 23:31:18 +02:00
parent 2c9d36ff00
commit eeef53a268
1 changed files with 19 additions and 12 deletions

View File

@ -44,7 +44,7 @@ in
''
) config.site.dns.localZones}
option arch code 93 = unsigned integer 16;
option guid code 97 = text;
group {
default-lease-time ${toString dhcp.time};
max-lease-time ${toString dhcp.max-time};
@ -53,17 +53,24 @@ in
option domain-name-servers 172.20.73.8, 9.9.9.9;
ddns-domainname "${domainName}";
next-server ${config.site.net.serv.hosts4.nfsroot};
if option arch = 00:00 {
filename "netboot.xyz.kpxe";
} else {
filename "netboot.xyz.efi";
}
if option vendor-class-identifier = "PXEClient:Arch:00000:UNDI:002001" {
# RPi4
option vendor-class-identifier "PXEClient";
option vendor-encapsulated-options "Raspberry Pi Boot";
option tftp-server-name "${config.site.net.serv.hosts4.nfsroot}";
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server ${config.site.net.serv.hosts4.nfsroot};
option tftp-server-address ${config.site.net.serv.hosts4.nfsroot};
if suffix(reverse(1, option guid), 5) = 34:69:50:52:00 {
# RPi4
option vendor-class-identifier "PXEClient";
option vendor-encapsulated-options "Raspberry Pi Boot";
option tftp-server-name "${config.site.net.serv.hosts4.nfsroot}";
} elsif option pxe-system-type = 00:00 {
filename "netboot.xyz.kpxe"; # BIOS
} elsif option pxe-system-type = 00:07 {
filename "netboot.xyz.efi"; # EFI
option bootfile-name "netboot.xyz.efi";
} elsif option pxe-system-type = 00:06 {
filename "netboot.xyz.efi"; # ia32_EFI
}
}
subnet ${subnet4Net} netmask ${lib.netmasks.${toString subnet4Len}} {