I am using Ubuntu Server 20.04.2 LTS on a raspberry pi 4 8gb. DNS resolution stops working after a few hours after reboot. A reboot solves the issue but it's just a band-aid. My DNS is set to 8.8.8.8 and 8.8.4.4.
I have tried running tcpdump -n -i eth0 host 8.8.8.8
and dig @8.8.8.8 www.google.com
simultaneously and the output is
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
22:06:51.643074 IP 192.168.0.2.57220 > 8.8.8.8.53: 6359+ [1au] A? www.google.com. (55)
22:06:51.651180 IP 8.8.8.8.53 > 192.168.0.2.57220: 6359 1/0/1 A 142.250.200.4 (59)
(The IP of the device is 192.168.0.02)
NSLookup also fails, running the following: nslookup www.google.com
returns
;; connection timed out; no servers could be reached
I would like the DNS to not break every 6 hours or so and rebooting it every time it breaks is a little inconvenient.
Edit:
Running telnet returns this:
root@najemi:~# telnet 8.8.8.8 53
Trying 8.8.8.8...
Connected to 8.8.8.8.
Escape character is '^]'.
Connection closed by foreign host.
Running tcpdump
without any arguments returns this
Date looks about right:
root@najemi:~# date
Sat Jul 3 05:14:10 UTC 2021
sudo tcpdump -n -i eth0 host 8.8.8.8
while running dig +cdflag @8.8.8.8 www.google.com
returns:
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
05:18:07.377351 IP 192.168.0.2.43923 > 8.8.8.8.53: 37809+% [1au] A? www.google.com. (55)
05:18:07.422270 IP 8.8.8.8.53 > 192.168.0.2.43923: 37809 1/0/1 A 142.250.180.4 (59)
IP is static.
Also thought I'd mention that these problems started arising after installing pihole. It has since been uninstalled yet the problems remain.
Edit 2:
Contents of /etc/resolv.conf
are:
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
nameserver 8.8.8.8
nameserver 8.8.4.4
# /etc/resolv.conf.tail can replace this line
Edit 3:
The output of nmcli device show eth0 | grep IP4.DNS
is empty.