Ubuntu – No DNS lookup with Google’s DNS servers


Some mornings when my Ubuntu 18.04 wakes from hibernate, it takes around 30 minutes before I can do any DNS lookups.

I already disabled automatic DNS and added Google's DNS servers instead:

DNS Settings

How I set up Google's DNS servers

But nevertheless, I can ping but not google.com:

can't ping Google

Usually after much fruitless enabling/disabling Wifi, and connect and disconnecting Wifi networks, it suddenly springs into action and all is well for the rest of the day.

But here's the mystery: if Ubuntu is using as its DNS lookup, how can it be the case that I can ping the IP but not the URL?


Here's the output of dig:

➜  dig @ www.google.com

; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @ www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39427
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 512
;www.google.com.                        IN      A

www.google.com.         297     IN      A

;; Query time: 21 msec
;; WHEN: Thu Aug 20 19:52:43 BST 2020
;; MSG SIZE  rcvd: 59


sudo tcpdump -ni lo port 53

This command showed nothing until about 20 minutes after booting up, at which point it exploded into life with things like:



netstat -acpn | grep ":53"

This is the output of netstat when DNS lookup isn't working.

netstat no DNS output

And with DNS working, later in the day:

netstat with DNS output

Best Answer

  • Try

    dig @ www.ubuntu.com

    just to rule out that DNS traffic somehow gets mangled.

    edit: dig is a tool to query DNS-Servers. By using the the @serverIP syntax you can bypass the systems DNS settings and directly talk to a DNS server of your choice. IMHO this helps a lot in diagnosing if the problem is your machine (dig with @syntax working) or on the network side (dig with @syntax returning the same result)

  • Related Question