DNS issues after upgrading to 20.04

53,809

Solution 1

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

Solution 2

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).

Solution 3

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

Solution 4

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.

Share:
53,809
Mykle
Author by

Mykle

I enjoy using Ubuntu.

Updated on September 18, 2022

Comments

  • Mykle
    Mykle over 1 year

    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
    Mykle almost 4 years
    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?
  • ldias
    ldias almost 4 years
    @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
  • Mykle
    Mykle almost 4 years
    @Idias Still not persistent through reboots. Anything else I can try?
  • ldias
    ldias almost 4 years
    @Mykle You can try steps outlined here: superuser.com/questions/677343/…. Umm, you can also not reboot :)
  • Mykle
    Mykle almost 4 years
    @Idias Thanks for the help. I followed those steps and that did not resolve the issue either. I will never reboot again :)
  • slangasek
    slangasek almost 4 years
    resolvconf is not recommended as a solution for this problem.
  • ldias
    ldias almost 4 years
    @slangasek huh, any particular reason why? If there is, I'll remove it from my answer
  • slangasek
    slangasek almost 4 years
    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.
  • Mykle
    Mykle almost 4 years
    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.
  • slangasek
    slangasek almost 4 years
    What does 'systemctl status systemd-resolved' show? Something is certainly off if resolved is not available over dbus.
  • Mykle
    Mykle almost 4 years
    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-ne‌​twork-> https://www.freedesktop.org/wiki/Software/systemd/writing-re‌​solver>
  • Mykle
    Mykle almost 4 years
    That doesn't look good. Is there a way I can reconfigure it?
  • Mykle
    Mykle almost 4 years
    Once I re-enabled systemd-resolved, DNS is resolving correctly persistently. Thanks!
  • Thomas Aichinger
    Thomas Aichinger over 3 years
    I guess problem is with indentation in yaml.
  • Mihir Kumar Thakur
    Mihir Kumar Thakur over 3 years
    This solved my issue sudo systemctl start systemd-resolved