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:
But nevertheless, I can ping 8.8.8.8
but not google.com
:
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 8.8.8.8
as its DNS lookup, how can it be the case that I can ping the IP but not the URL?
dig
Here's the output of dig
:
➜ dig @8.8.8.8 www.google.com
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @8.8.8.8 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
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.google.com. IN A
;; ANSWER SECTION:
www.google.com. 297 IN A 216.58.206.100
;; Query time: 21 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Aug 20 19:52:43 BST 2020
;; MSG SIZE rcvd: 59
tcpdump
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
netstat -acpn | grep ":53"
This is the output of netstat
when DNS lookup isn't working.
And with DNS working, later in the day:
ping -a yahoo.com
and go about your day, until you hear it, then rush back and check your logs to see if anything just registered. Look at the trafficsudo tcpdump -n port 53
is the traffic going out without a return?netstat -acpn | grep ":53"
shows if a stub listener is running, if so, you'd probably have tosudo tcpdump -ni lo port 53
to watch the requests the stub us handling. Wired connection behavior? Static IP? right after reboot?ping
actually making a ping sound. Didn't know that was an option.)