My current networking setup (on Arch Linux) involves:
- stubby to resolve DNS requests with DNS-over-TLS.
- dnsmasq to cache DNS queries (and nothing else).
- openresolv to manage
- NetworkManager to set-up and tear-down network connections.
I have stubby listening on
locahost on some random port, dnsmasq listening on
localhost:53 and resolving DNS queries through stubby, and openresolv is set up to put
resolv.conf and provide any other DNS entry (for example those obtained through DHCP by NetworkManager) to dnsmasq via separate configuration files:
# /etc/resolvconf.conf name_servers=127.0.0.1 dnsmasq_conf=/etc/dnsmasq-conf.conf dnsmasq_resolv=/etc/dnsmasq-resolv.conf
However, at the moment those extra entries are being ignored.
What is the best way to use these entries only when connected to one of a few whitelisted networks?
To clarify, I know that with NetworkManager I can override the DNS entries provided over DHCP on a network-by-network basis, but what I would like to do is the opposite: use stubby by default and the DHCP entries for only one or two networks, as needed.