Change dnsmasq config to set next_server properly

Fixes a bug where menus would always be loaded remotely, so local config
didn't apply. Also simplifies the config a bit.
This commit is contained in:
Sam Mesterton-Gibbons 2022-07-20 22:14:01 +00:00
parent 5f6f306330
commit 4eef355c91
2 changed files with 24 additions and 19 deletions

View file

@ -8,22 +8,18 @@ log-dhcp
# option space. That's to avoid confusing some old or broken DHCP clients.
dhcp-no-override
# Identify the type of PXE client, and set the boot filename accordingly
# Copied from https://github.com/linuxserver/docker-netbootxyz#dd-wrt
dhcp-match=set:bios,60,PXEClient:Arch:00000
dhcp-boot=tag:bios,netboot.xyz-undionly.kpxe
dhcp-match=set:efi32,60,PXEClient:Arch:00002
dhcp-boot=tag:efi32,netboot.xyz.efi
dhcp-match=set:efi32-1,60,PXEClient:Arch:00006
dhcp-boot=tag:efi32-1,netboot.xyz.efi
dhcp-match=set:efi64,60,PXEClient:Arch:00007
dhcp-boot=tag:efi64,netboot.xyz.efi
dhcp-match=set:efi64-1,60,PXEClient:Arch:00008
dhcp-boot=tag:efi64-1,netboot.xyz.efi
dhcp-match=set:efi64-2,60,PXEClient:Arch:00009
dhcp-boot=tag:efi64-2,netboot.xyz.efi
# send disable multicast and broadcast discovery, and to download the boot file immediately
# DHCP_PXE_DISCOVERY_CONTROL, should be vendor option? Needs more understanding and source
dhcp-option=vendor:PXEClient,6,2b
# Boot the relevant PXE image
pxe-service=x86PC,"Run netboot.xyz, BIOS mode",netboot.xyz-undionly.kpxe
pxe-service=X86-64_EFI, "Run netboot.xyz, UEFI mode", netboot.xyz.efi
pxe-service=BC_EFI, "Run netboot.xyz, UEFI mode", netboot.xyz.efi
# Detect whether this is an iPXE dhcp request, or an initial boot
dhcp-match=set:ipxe-bios,175,33
dhcp-match=set:ipxe-efi,175,36
# For initial boot, just provide the file
pxe-service=tag:!ipxe-ok,X86PC,PXE,netboot.xyz-undionly.kpxe
pxe-service=tag:!ipxe-ok,BC_EFI,PXE,netboot.xyz.efi
pxe-service=tag:!ipxe-ok,X86-64_EFI,PXE,netboot.xyz.efi
# The DHCP request case is handled on the command line for dnsmasq, because it requires the container IP

View file

@ -1,3 +1,12 @@
#!/usr/bin/with-contenv bash
dnsmasq --no-daemon --dhcp-range=${DHCP_RANGE_START},proxy ${DNSMASQ_ARGS}
if [ -z ${CONTAINER_IP} ]; then
# If an IP wasn't given, assume the default route is the one to go for and get IP from that
CONTAINER_IP=$(ip route get to 1.1.1.1 | awk '/1.1.1.1/ { print $7}')
fi
# Start dnsmasq
dnsmasq --no-daemon --dhcp-range=${DHCP_RANGE_START},proxy \
--dhcp-boot=tag:ipxe-bios,netboot.xyz.kpxe,,${CONTAINER_IP} \
--dhcp-boot=tag:ipxe-efi,netboot.xyz.efi,,${CONTAINER_IP} \
${DNSMASQ_ARGS}