resolv.conf - No DNS servers known

Solution 1:

If /etc/netplan is empty then netplan does not configure your network.

Your network is probably configured in old ifup/ifdown style. That means you find the network configuration in /etc/network/interfaces.

In addition there is systemd-resolve with its DNS configuration file /etc/systemd/resolved.conf where you can put your DNS configuration in.

[Resolve]
DNS=8.8.4.4 8.8.8.8 2001:4860:4860::8844 2001:4860:4860::8888
#FallbackDNS=
Domains=example.com
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

You can check your DNS settings with

systemd-resolve --status

You can restart systemd-resolve with

systemctl restart systemd-resolved

Alternatively you can put your settings in /etc/resolvconf/resolv.conf.d/tail which will be added to /run/resolvconf/resolv.conf during boot.

Solution 2:

Ubuntu 20.04 uses /etc/netplan to set DNS. Do you have nameservers section in your /etc/netplan/?.yaml file?

yaml-file should have a section similar like this:

            nameservers:
                addresses:
                - 8.8.8.8
                - 2001:4860:4860::8888

resolve.conf is generated from netplan during boot and should should look like this.

nameserver 127.0.0.53
options edns0 trust-ad
search example.com

There is also a /etc/systemd/resolved.conf where static configuration may be strored. You can read more details man resolved.conf

Furthermore you can investigate journalctl -b and search for systemd-resolved messages.