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 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:


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:

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 ( using nslookup but explicitly setting the dns server resolved the URLs correctly:

> nslookup example.somedomain.com

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:


  • 1
    Try disabling dnsmasq by commenting out dns in NetworkManager.conf. #dns=dnsmasq
    – user822833
    Commented May 9, 2018 at 17:49
  • That seems to have worked. @MikaelSchultz Want to make it an answer?
    – Andrew M
    Commented May 22, 2018 at 14:19
  • Nice to hear that it worked. Sure I can make it an answer as well :)
    – user822833
    Commented 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
    Commented Sep 23, 2023 at 15:44

1 Answer 1


There seems to be an issue with the local DNS cache mechanism provided by dnsmasq (which runs at localhost, Not sure exactly what but if you disable the dnsmasq cache and always ask the primary ( and secondary ( 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:


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 .