Configuring dnsmasq
on OpenWRT has a few peculiarities.
First, enable the dnsmasq
internal TFTP server by editing /etc/config/dhcp
:
config dnsmasq option domainneeded 1 option boguspriv 1 option filterwin2k '0' #enable for dial on demand option localise_queries 1 option local '/lan/' option domain 'lan' option expandhosts 1 option nonegcache 0 option authoritative 1 option readethers 1 option leasefile '/tmp/dhcp.leases' option resolvfile '/tmp/resolv.conf.auto' #list server '/mycompany.local/1.2.3.4' #option nonwildcard 1 #list interface br-lan #list notinterface lo option 'enable_tftp' '1' option 'tftp_root' '/tftpboot' <snip>
add these lines | |
Do not set |
When the machine boots and the PXE stack asks the DHCP server for a file to boot, it should be ordered to fetch undionly.kpxe
.
But when that file has been loaded into memory and it in turn asks the DHCP server which file to use for its configuration, it should be orderen to fetch script output from the HTTP server.
We edit edit /etc/dnsmasq.conf
(see theKelleys.org example) to accomplish that:
<snip> dhcp-match=gpxe,175 dhcp-boot=net:#gpxe,undionly.kpxe dhcp-boot=http://1.2.3.4/boot/boot.php
Dnsmasq rearranges DHCP packages by default, but that is incompatible with gPXE.
Running dnsmasq
with then dhcp-no-override
option cancels that behaviour, so we edit /etc/init.d/dnsmasq
(see etherboot docs) and add the option:
<snip> include /lib/network scan_interfaces config_load dhcp args="--dhcp-no-override" config_foreach dnsmasq dnsmasq config_foreach dhcp_host_add host config_foreach dhcp_boot_add boot config_foreach dhcp_mac_add mac <snip>
... and reboot