I have setup 2 distinct dnsmasq instances for each network:
/etc/config/dhcp
config dnsmasq 'dnsmasq_lan'
option domainneeded '1'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option domain 'lan'
option local '/lan/'
option expandhosts '1'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp_lan.leases'
option noresolv '1'
option nonegcache '1'
option cachesize '0'
option localservice '1'
option logdhcp '1'
list interface 'lan'
list server 1.1.1.2
option confdir '/tmp/dnsmasq.d'
config dnsmasq 'dnsmasq_guest'
option domainneeded '1'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option domain 'guest'
option local '/guest/'
option expandhosts '1'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp_guest.leases'
option noresolv '1'
option nonegcache '1'
option cachesize '0'
option localservice '1'
option logdhcp '1'
list interface 'lan'
list server 1.1.1.3
option confdir '/tmp/dnsmasq.d'
I noticed that this configuration will overwrite the file `/tmp/resolv.conf`, in the order of how they appear in the configuration.
Now, when we make DNS queries from the router itself, it simply look at /etc/resolv.conf , which happens to be a symbolic link to `/tmp/resolv.conf`.
I do not want the last configured dnsmasq instance in my configuration to dictate what the router itself uses as DNS. I want it to be the first instance in my configuration. What is the clean way to do this?
I could of course reverse my configuration, but I’d like to learn the proper way to do this. I have a lingering doubt that the fact both dnsmasq override the same `/tmp/resolv.conf` also mean the configuration is actually incorrectly intertwined (does the first dnsmasq instance actually use the second dnsmasq’s config?)