This is what I'm trying to do:
192.168.1.1#53
is normal, unfiltered dnsmasq
192.168.1.2#53
is https-dns-proxy
forwarded to a filtered upstream DNS server
Then I can use tags in dnsmasq to assign the appropriate DNS server, depending on whether I want the device to get filtered or unfiltered DNS responses. This DHCP tagging is easy to do.
the relevant snippet of /etc/config/dhcp
config tag 'pihole'
list dhcp_option '6,192.168.1.2'
config host
option name 'laptop'
option dns '1'
option ip '192.168.1.7'
option mac 'FF:FF:FF:FF:FF:00'
config host
option name 'kids-laptop'
option dns '1'
option ip '192.168.1.8'
option mac 'FF:FF:FF:FF:FF:01'
option tag 'pihole'
I am having a problem, though. When creating an IP alias to put two addresses on my LAN interface, in the modern Linux style, they are both put on the same interface, so dnsmasq
listens on both of the addresses:
ip addr show br-lan
44: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ff:ff:ff:ff:ff:03 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global br-lan
valid_lft forever preferred_lft forever
inet 192.168.1.2/24 brd 192.168.169.255 scope global secondary br-lan
valid_lft forever preferred_lft forever
the relevant snippet of /etc/config/networks
config interface 'lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '64'
option stp '1'
option ip6hint '00'
option device 'br-lan'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1.1'
config interface 'lan2'
option device '@lan'
option proto 'static'
option ipaddr '192.168.1.2'
option netmask '255.255.255.0'
Because both addresses are on the same interface, I can't use notinterface
to tell dnsmasq
to ignore the second address. There also doesn't seem to be a uci
method of setting the dnsmasq
option listen-address
.
Is there a way to put the secondary IP address on a separate interface, so then I can use notinterface
to force dnsmasq
to ignore it?
Failing that, is there a uci
method of creating files in /tmp/dnsmasq.d
/ so I can put a bunch of listen-address
lines?
Or, am I on the wrong track, and there is a better way to run two different DNS resolvers?