I have Ubuntu 12.04, kernel 3.13. It can take 1sec to run "dig localhost" when computer is connected to Internet. When it is disconnected it is much faster. I checked /etc/hosts, I tried disabling dnsmasq in Network manager. Nothing helps. Applications that call localhost, just stop for a fraction of a second until Ubuntu goes to resolve localhost to remote servers. I search everywhere and did not find a solution. Can someone help me with this ?
; <<>> DiG 9.8.1-P1 <<>> localhost ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40343 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION: ;localhost. IN A
;; ANSWER SECTION: localhost. 10800 IN A 127.0.0.1
;; Query time: 359 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Sat Feb 7 23:02:10 2015 ;; MSG SIZE rcvd: 43