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
/etc/resolve.conf
to8.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 04:43