0

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.)

3
  • "I still need to acquire a DNS server from the WAN DHCP so that I can resolve internet server names" - not really; that's part of what dnsmasq does. Having multiple DNS servers in resolv.conf each being authoritative for different domains will not do what you think it should Commented Jan 17, 2021 at 18:20
  • Uh... dnsmasq still needs an upstream? I want to get that upstream from DHCP, but I want the local system to ask localhost (i.e. dnsmasq) first. Commented Jan 17, 2021 at 18:53
  • @roaima, see edit. I don't know where domains came into this. The point is I still need the upstream DNS in the list, just not first in the list (localhost should be first). I'm pretty sure this setup will work. Commented Jan 17, 2021 at 19:03

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.