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

2 Answers2

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

Steve
  • 29