2

tl:dr my ubuntu 16.04 system often struggles to resolve DNS that my colleagues (mostly using OSX/mac) have no problems with. We're all using 8.8.8.8 from the same wifi network. The domains in question are AWS urls that are frequently created or updated. Having read this question - I fear my nsswitch.conf doesn't make sense.

/etc/nsswitch.conf contains the line:

hosts:          files mdns4_minimal [NOTFOUND=return] dns

Does that look right? If I understand rightly it will check (in order) hosts file, mdns (local dns?) then fail before it would check dns servers?

running the command nmcli dev show | grep DNS (from this question - how to know what dns I am using) returns the following:

IP4.DNS[1]:                             8.8.8.8
IP4.DNS[2]:                             8.8.4.4

I've also checked my hostfile doesn't contain any unexpected clashing entries. Where else should I look for clues?

The DNS lookups fail consistently (ie - it's not a slow DNS server that fails on the first attempt until a value is cached).

An example failed nslookup (with the domain changed to remove work domain) looks like:

> nslookup example.somedomain.com:      127.0.1.1
Address:    127.0.1.1#53

Non-authoritative answer:
*** Can't find example.somedomain.com: No answer

Online nslookup tools can resolve the urls correctly, and reveal that the time to live is 59 seconds, pretty short but not crazy.

Edit: More information (which I don't really understand, but may help an expert) after reading a few more questions:

the above nslookup seems to be using a local DNS server (127.0.1.1) using nslookup but explicitly setting the dns server resolved the URLs correctly:

> nslookup example.somedomain.com 8.8.8.8
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   example.somedomain.com
Address: 10.116.[blah].[blah]
Name:   example.somedomain.com
Address: 10.116.[blah].[blah]

/etc/NetworkManager/NetworkManager.conf looks like the following:

[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=false
4
  • 1
    Try disabling dnsmasq by commenting out dns in NetworkManager.conf. #dns=dnsmasq
    – user822833
    May 9, 2018 at 17:49
  • That seems to have worked. @MikaelSchultz Want to make it an answer?
    – Andrew M
    May 22, 2018 at 14:19
  • Nice to hear that it worked. Sure I can make it an answer as well :)
    – user822833
    May 22, 2018 at 14:32
  • i found this detailed explanation very helpful and enlightening. zwischenzugs.com/2018/06/08/… Apparently nothing is straight forward, and it keeps changing. eg my NetworkManager.conf doesn't have a dnsmasq entry, and its just suddenly fired up. Hope it helps.
    – j jay
    Sep 23, 2023 at 15:44

1 Answer 1

2

There seems to be an issue with the local DNS cache mechanism provided by dnsmasq (which runs at localhost, 127.0.1.1). Not sure exactly what but if you disable the dnsmasq cache and always ask the primary (8.8.8.8) and secondary (8.8.4.4) DNS servers directly instead it might work better.

To disable dnsmasq you edit the file /etc/NetworkManager/NetworkManager.conf and comment out dns=dnsmasq like in the config below:

[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

Hope it works out for you :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .