fix(pxe-infra): put free pool in dhcp-range, not dhcp-host
dhcp-host and dhcp-range are different dnsmasq keys. The free-pool lines from the optional rangeStart/rangeEnd options were being concatenated into the dhcp-host list, which dnsmasq rendered as dhcp-host=52:54:00:12:34:56,10.66.0.10,pxe-vm-01,set:known dhcp-host=10.66.0.100,10.66.0.200,12h i.e. it would try to give IP 10.66.0.200 to the device whose MAC is 10.66.0.100. Even worse, with no dhcp-range at all, dnsmasq does not open its DHCP server socket — it only runs TFTP. The UEFI firmware in the VM would send DISCOVER and get nothing back, ending in PXE-E18: Server response timeout. Move the pool to its own list, with a sane default (the entire /24 minus the host address) so the server actually starts even when rangeStart/rangeEnd are left null. The MAC filter (dhcp-ignore=tag:!known) still prevents unknown MACs from getting a lease from the range. Co-authored-by: Sisyphus <sisyphus@local>
This commit is contained in:
1 parent
a1aaa46908
commit
f7acbc6868
1 file changed
+16
-6
@@ -32,10 +32,20 @@ let
|
||||
in "${body},set:known")
|
||||
cfg.guests;
|
||||
|
||||
# Free address pool — only configured when both bounds are set.
|
||||
rangeLines = lib.optionals
|
||||
(cfg.rangeStart != null && cfg.rangeEnd != null)
|
||||
[ "${cfg.rangeStart},${cfg.rangeEnd},${cfg.leaseTime}" ];
|
||||
# Free address pool. Always set so dnsmasq actually opens
|
||||
# its DHCP server socket — without a `dhcp-range` line, dnsmasq
|
||||
# silently runs TFTP only and the UEFI firmware's DHCP DISCOVER
|
||||
# times out. The range is gated by the MAC filter
|
||||
# (dhcp-ignore=tag:!known) below, so unknown MACs never see a
|
||||
# lease, but the range must exist.
|
||||
dhcp-range =
|
||||
if cfg.rangeStart != null && cfg.rangeEnd != null
|
||||
then [ "${cfg.rangeStart},${cfg.rangeEnd},${cfg.leaseTime}" ]
|
||||
# Default: the entire bridge subnet minus the host address.
|
||||
# Hardcoded for /24 because the bridge defaults to
|
||||
# 10.66.0.1/24; if the bridge address/prefix changes,
|
||||
# update this default.
|
||||
else [ "10.66.0.2,10.66.0.254,12h" ];
|
||||
|
||||
base = {
|
||||
# Bind to the private bridge only — never 0.0.0.0, never eth0.
|
||||
@@ -52,8 +62,8 @@ let
|
||||
log-dhcp = true;
|
||||
log-queries = false;
|
||||
log-facility = "-";
|
||||
# Reservations + free pool (lists become repeated keys).
|
||||
dhcp-host = dhcpHostLines ++ rangeLines;
|
||||
# Static reservations.
|
||||
dhcp-host = dhcpHostLines;
|
||||
};
|
||||
|
||||
# Optional TFTP module on the same dnsmasq instance. Used to
|
||||
|
||||
Reference in new issue
Block a user