If you're running
Ubuntu Linux 20.04 (probably older versions as well), you may have noticed that your
DNS server is set to
127.0.0.53. I believe that this is called a
local stub DNS.
The issue is that sometimes, when running local services, your
stub DNS resolver will actually be the first one to respond, not your actual DNS server (internal or external).
I'm not a sysadmin, but I've found a way to resolve (no pun intended) the issue for me:
systemctl stop systemd-resolved systemctl disable systemd-resolved
Now you can edit
/etc/resolv.conf and add your own
nameservers into it. If the file is unwritable or it doesn't exist, you should be able to add it yourself.
See for yourself:
# service systemd-resolved disable # service systemd-resolved stop # ping www.google.com ping: www.google.com: Temporary failure in name resolution # nano /etc/resolv.conf
nameserver at the bottom of the file:
# This file is managed by man:systemd-resolved(8). Do not edit. # # This is a dynamic resolv.conf file for connecting local clients to the # internal DNS stub resolver of systemd-resolved. This file lists all # configured search domains. # # Run "resolvectl status" to see details about the uplink DNS servers # currently in use. # # Third party programs must not access this file directly, but only through the # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way, # replace this symlink by a static file or a different symlink. # # See man:systemd-resolved.service(8) for details about the supported modes of # operation for /etc/resolv.conf. nameserver 10.4.0.2 # my local DNS server
Retried the ping:
# ping www.google.com PING www.google.com (220.127.116.11) 56(84) bytes of data. 64 bytes from yyz10s03-in-f4.1e100.net (18.104.22.168): icmp_seq=1 ttl=116 time=1.11 ms 64 bytes from yyz10s03-in-f4.1e100.net (22.214.171.124): icmp_seq=2 ttl=116 time=1.26 ms