Score:0

Ubuntu 20.04 unable to ping domains but can ping IP addresses

de flag

Some how I've messed up the DNS after a failed app install! I notice that in /etc/ there are 3 resolv files: resolv.conf resolv.conf_bak resolv.conf-tmp

resolv.conf contains:

#Generated by NetworkManager
search lan
nameserver 127.0.0.53

resolv.conf_bak contains:

# This file is managed by man:systemd-resolved(8) ...
nameserver 127.0.0.53
options edns0 trust-ad
search lan

resolv.conf-tmp contains:

nameserver 1.1.1.1
nameserver 8.8.8.8

systemctl status systemd-resolved returns:

systemd-resolved.service
Loaded: masked (Reason: Unit systemd-resolved.service is masked)
Active: inactive (dead)

In the Wifi network settings (GUI) the IPs 8.8.8.8 and 1.1.1.1 are listed under IPv4 DNS and IPv4 method is Automatic (DHCP), DNS and Routes are also set to Automatic.

I had installed OpenLiteSpeed webserver which is accessible via localhost:7080 but probably this install has upset domain name resolution and browsing. I don't know enough about Linux DNS to know where else to look for the conflict. Should I try re-installing systemd-resolved as posted here?

UPDATE 1:

Following suggestions in this post I ran ls -l /etc/systemd/system/systemd-resolved.service and got this reply: "ls: cannot access '/etc/systemd/system/systemd-resolved.service': No such file or directory" I then ran sudo systemctl unmask systemd-resolved and the reply was "Removed ...". I then ran the following commands:

sudo systemctl daemon-reload
sudo systemctl start systemd-resolved
sudo systemctl enable systemd-resolved

The last one confirmed the creation of a symlink from /etc/systemd/system/dbus-org.freedesktop.resolve1.service to /lib/systemd/system/systemd-resolved.service and also one from /etc/systemd/system/multi-user.target.wants/systemd-resolved.service to /lib/systemd/system/systemd-resolved.service

sudo systemctl status systemd-resolved now returns Unit system-resolved.service could not be found.

UPDATE 2:

If I add nameserver 8.8.8.8 to /etc/resolv.conf then name resolution/browsing is restored, but this file is generated by resolvconf so I assume it will be overwritten!

This post suggests adding the nameserver to /etc/dhcp/dhclient.conf with supersede domain-name-servers 8.8.8.8;

Any ideas please?

mpboden avatar
do flag
First thought….why is systemd-resolved masked? Did the install of OpenLiteSpeed do that? Also, `/etc/resolv.conf` is supposed to be a symlink to `/run/systemd/resolve/stub-resolv.conf`. I suspect this has been changed as well.
Nick avatar
de flag
@mpboden thank you for your pointer. So there maybe something wrong with the symlink or it's missing. I've found more info at https://askubuntu.com/questions/1207493/unit-systemd-resolved-service-is-masked I will try the resolutions suggested there.
mpboden avatar
do flag
The last command at the end of your "Update 1" has a typo in it. It should be `systemd-resolved` not `system-resolved`. Please edit question again with the output of `systemctl status systemd-resolved`. Also, add the output of `ls -l /etc/resolv.conf`.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.