I use dnsmasq to manage DHCP and DNS for my local network. This allows connecting to LAN hosts by name on all of my systems... except for the server itself. Unless I disconnect the WAN link, in which case DNS falls back to the LAN, which is set up to use localhost as the server.
Now, dnsmasq itself seems to have the right idea ignoring localhost as a DNS source. The problem seems to be that NM preferentially uses the WAN DNS server.
Is there a way to force NM to use localhost as the first DNS server? (Note that I still need to acquire a DNS server from the WAN DHCP so that I can resolve internet server names.)
To clarify, right now /etc/resolv.conf looks like:
# Generated by NetworkManager
search <redacted> <redacted>
nameserver 192.168.1.1
nameserver 127.0.0.1
nameserver <redacted ipv6>
I want it to look like:
# Generated by NetworkManager
search <redacted> <redacted>
nameserver 127.0.0.1
nameserver 192.168.1.1
nameserver <redacted ipv6>
(Note: 192.168.1.1 is the IP of my upstream router/gateway.)
dnsmasqdoes. Having multiple DNS servers inresolv.confeach being authoritative for different domains will not do what you think it should