5

Ever since upgrading to 16.04, DNS resolution fails (returns Host Not Found) on the first attempt for any website. I can then immediately try it a second time and it works just fine.

A little background:

  • I have on my network a server running an older version of Ubuntu, and a Windows PC. Both of these are unaffected (using the same DNS servers as the problem computer).
  • After poking around on the web a bit, I took someone's advice and
    removed and purged resolvconf. That fixed the problem... until I
    rebooted. Then DNS resolution did not work at all (I fixed that but am back to square one now).

In my limited understanding, what seems to be happening is that when a query for a new website comes to the local DNS cache (resolvconf?), it is not in the cache, so the reply is empty. Then when the same query comes again, some process has in the meantime resolved the address and updated the cache, so the cache replies with the address.

What I want is that if the requested address is not in the cache, it will go and find it before replying the first time. Can anybody tell me how to make this happen?

Here is the output from dig (first time):

~$ dig www.foo.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.foo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 6505
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.foo.com.              IN      A

;; Query time: 23 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Thu Jun 02 13:44:49 JST 2016
;; MSG SIZE  rcvd: 34

And just a few seconds later, here is the output from dig (second time):

~$ dig www.foo.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.foo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53490
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.foo.com.              IN      A

;; ANSWER SECTION:
www.foo.com.       14310   IN      CNAME   foo.com.
foo.com.           210     IN      A       192.0.79.33
foo.com.           210     IN      A       192.0.79.32

;; Query time: 0 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Thu Jun 02 13:46:19 JST 2016
;; MSG SIZE  rcvd: 92
  • Facing similar problem, I now have set nameserver on /etc/resolve.conf to 8.8.8.8. I want a solution. I don't want setting it fixed to 8.8.8.8 always because it poll from 8.8.8.8 everytime I request, making request slow. – Techjail Jun 14 '16 at 4:43
  • This problem started when I did a fresh install with version 16.04. I can't believe that Techjail and I are the only two people experiencing this problem. Why isn't there a bug report for this? – Weilong Wang Jun 21 '16 at 13:05
5

I am facing the same problem. The workaround I am using for now is:

  • Open the Network Manager config file:

    sudo nano /etc/NetworkManager/NetworkManager.conf 
    
  • Modify the following line:

    #dns=dnsmasq
    
  • Save and restart the manager:

    sudo service NetworkManager restart
    
2

I am facing the same problem. The workaround I am using for now is to add a secondary dns server to my /etc/resolv.conf:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
nameserver 192.168.1.1
search lan

Additionaly I installed dnsmasq which caches any dns queries. So all requests first go to dnsmasq (127.0.0.1) and if the domain is not cached the request goes to 192.168.1.1 (my router which also runs a dns server, you could of course use something like 8.8.8.8)

This workaround is not ideal I know - but it works for now. I am by the way also using a fresh installation of Ubuntu 16.04

  • yeah, I am too doing it manually as: nameserver 192.168.100.1 everytime I restart. I know there is a permanent fix and set it to that but I may be on other network. I don't want 8.8.8.8 as it has some time delay. – Techjail Jul 30 '16 at 15:02
  • I just experienced this same issue out of nowhere. Adding my router as nameserver to resolv.conf fixed it temporarily for me. :( – Michael Dec 23 '16 at 4:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.