USB Stick preparation
I used a spare USB-Stick that I formated with ext4 and lableing the partition tftp.
mkfs.ext4 -L tftp /dev/sdXX
Replace /dev/sdXX with your partition path. ie /dev/sdc1 OpenWRT preparation
This was done on OpenWRT Version 19.07
opkg update
opkg install usbutils kmod-usb-storage block-mount kmod-fs-ext4 wget
mkdir -p /mnt/usb/
wget package is needed because the dropbear version does not support SSL Mount USB-Stick reboot persistent¶
uci set fstab.@mount[0].label=tftp
uci set fstab.@mount[0].target=/mnt/usb
uci set fstab.@mount[0].options=noatime,nodiratime
uci commit
block mount
Get PXE images
Instead of pulling each OS image individually I use netboot.xyz. netboot.xyz is basically a menu wrapper for all kinds of operating systems.
cd /mnt/usb/
Legacy (PCBIOS) iPXE Bootloaders
wget --no-check-certificate https://boot.netboot.xyz/ipxe/netboot.xyz.kpxe
UEFI iPXE Bootloaders
wget --no-check-certificate https://boot.netboot.xyz/ipxe/netboot.xyz.efi
Configure dnsmasq
Unfortunately I was only able to set one bootfile.
The linuxserver.io documentation states that multiple entries should be possible. This didn't work for me =(
uci set dhcp.@dnsmasq[0].enable_tftp=1
uci set dhcp.@dnsmasq[0].tftp_root=/mnt/usb/
uci set dhcp.@dnsmasq[0].dhcp_boot=netboot.xyz.kpxe
uci commit
/etc/init.d/dnsmasq restart
Finally a crucial but hard to find configuration change for OpenWRT
Disable the LAN interface to announce itself as a Local IPv6 DNS server which in turn somehow conflicted with the iPXE DNS lookup (even though booted in IPv4 mode).
Available through the OpenWRT interface. Network -> Interfaces, LAN -> Edit, DHCP Server -> IPv6 Settings. Untick this box if ticked.