15

After upgrading to 20.04, both my wired and wireless networking lost access to the internet. I confirmed my drivers were working when I was able to resolve a ping to the Google nameserver 8.8.8.8. Now, every time I reboot, I have to manually edit /etc/resolv.conf and add line:

nameserver 8.8.8.8

I have been unable to get to a permanent resolution in both the network manager and netplan.

IPV4 tab in network manager under DNS set to manual

8.8.8.8, 8.8.4.4

/etc/netplan/01.yaml*

network:
version: 2
renderer: networkd
ethernets:
   wlp58s0:
      dhcp4: true
      nameservers:
         addresses: [8.8.8.8, 8.8.4.4]

If someone could please advise me on how to get my DNS settings configured properly, I would greatly appreciate it. Thanks.

Mykle
  • 311
  • 1
  • 2
  • 7

6 Answers6

10

The following worked for me.

sudo systemd-resolve --set-dns=8.8.8.8 --interface=<interface name> 

E.g. sudo systemd-resolve --set-dns=8.8.8.8 --interface=eth0.

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
dpaks
  • 201
  • 2
  • 3
7

In Ubuntu 20.04, the expected configuration of /etc/resolv.conf is to point to a local systemd-networkd resolver:

nameserver 127.0.0.53

To check which upstream nameservers your local resolver is configured for, you can check the output of resolvectl status. This should show, for each of your network interfaces, the nameservers that have been associated.

You also show a netplan config that says to use the networkd renderer, but mention Network Manager in your question. If you are expecting your wireless interface to be manageable through NetworkManager, then you need to change this netplan config (or else, you have other netplan config already on your system that you didn't list here).

slangasek
  • 5,293
  • 2
  • 18
  • 26
  • 4
    Slangasek The output of resolvectl status is `Failed to get global data: Unit dbus-org.freedesktop.resolve1.service not found.` I've also changed netplan to NetworkManager renderer and that hasn't resolved it either. Is there someway I can start over and set DNS up all over again? I think I would prefer to use NetworkManager. – Mykle May 29 '20 at 20:03
  • What does 'systemctl status systemd-resolved' show? Something is certainly off if resolved is not available over dbus. – slangasek May 31 '20 at 03:35
  • `systemd-resolved.service - Network Name Resolution Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; ve> Active: inactive (dead) Docs: man:systemd-resolved.service(8) https://www.freedesktop.org/wiki/Software/systemd/resolved https://www.freedesktop.org/wiki/Software/systemd/writing-network-> https://www.freedesktop.org/wiki/Software/systemd/writing-resolver>` – Mykle May 31 '20 at 12:30
  • 1
    That doesn't look good. Is there a way I can reconfigure it? – Mykle May 31 '20 at 12:31
  • 1
    Once I re-enabled systemd-resolved, DNS is resolving correctly persistently. Thanks! – Mykle Jun 01 '20 at 13:43
6

The systemd-resolved.service became disabled, so once I enabled it and set it to auto start, my issues were resoled.

sudo systemctl enable systemd-resolved.service
sudo systemctl start systemd-resolved.service
Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
Mykle
  • 311
  • 1
  • 2
  • 7
1

Changes to the /etc/resolv.conf files will only last for a while and is not persistent. To work around this and make changes to your nameservers in resolv.conf permanent do the following:

Open the dhclient.conf with superuser privileges

sudo nano /etc/dhcp/dhclient.conf

Find the following lines:

#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;

Uncomment the above lines and use the domain-name and domain-name-servers which you want. Save it. Now the DNS related changes will be permanent.

ldias
  • 1,975
  • 9
  • 22
  • Thanks @Idias for the response but unfortunately neither solution worked for me. When I edit my /etc/resolvconf/resolv.conf.d/base file, it is empty. Is that normal? – Mykle May 29 '20 at 13:27
  • @Mykle Yes, that is normal. Just add your name servers like `nameservers 8.8.8.8, 1.1.1.1` to the file, save it and see if your DNS settings are persistent through reboots – ldias May 29 '20 at 13:29
  • @Idias Still not persistent through reboots. Anything else I can try? – Mykle May 29 '20 at 14:46
  • 1
    @Mykle You can try steps outlined here: https://superuser.com/questions/677343/how-to-make-name-server-address-permanent-in-etc-resolv-conf. Umm, you can also not reboot :) – ldias May 29 '20 at 15:06
  • @Idias Thanks for the help. I followed those steps and that did not resolve the issue either. I will never reboot again :) – Mykle May 29 '20 at 15:17
  • resolvconf is not recommended as a solution for this problem. – slangasek May 29 '20 at 17:55
  • 1
    @slangasek huh, any particular reason why? If there is, I'll remove it from my answer – ldias May 29 '20 at 17:56
  • resolvconf works by managing the contents of /etc/resolv.conf which is inconsistent with the deliberate design decision in Ubuntu 18.04 and later to use a local resolver by default. – slangasek May 29 '20 at 18:00
0

From /etc folder

sudo ln -sf ../run/systemd/resolve/resolv.conf resolv.conf

They did something weird with some last Ubuntu version. I faced the same intermittent DNS resolution issue with all my Ubuntu installation for the last year at least. This fix was tried and so far works Ok. By default the same file is pointed to stub. So do not know exactly what is the root cause. No time to investigate it. Hope they will fix it sooner or later.

Shtefan
  • 101
  • 1
0

I could ping everything... No internet browser could resolve any sites... My problem was a custom DHCPD config file. Thankfully I saved original file, so reverted that file back... & BOOM I was back in business. My version is xubuntu 20.04, so dhcpd.conf is under /etc/dhcp

No One
  • 1
  • 2