11

I just upgraded my Ubuntu 22.04 boxes to 23.10 and then to 24.04.

They stopped resolving DNS queries.

They are using systemd-resolved and resolvconf.

David
  • 3,391

2 Answers2

12

If your /etc/resolv.conf file says your nameserver is 127.0.0.53 then you likely are using resolvconf and systemd-resolved.

1. Make sure your systemd-resolved is installed:

sudo apt install systemd-resolved

(You might need to temporarily change your /etc/resolv.conf to use a well known dns server directly, like Google's, 8.8.8.8, or CloudFlare's 1.1.1.1, or another one. Note: if installation was partially complete, you may need to do mv /etc/resolv.conf /etc/resolv.conf.orig if it is a symlink, and then add nameserver 1.1.1.1 to it, then don't forget to restore the symlink back once you have fixed the issue.)

2. Make sure your configuration files have references to dns servers in them.

For systems that use Debian style /etc/network/interfaces config files makes sure you have dns-nameservers set in the iface section. For example:

auto  eth0
iface eth0 inet static
  address   1.2.3.4 
  netmask   255.255.255.0
  gateway   1.2.3.1
  dns-nameservers  8.8.8.8

If you have a newer install you could instead be using Netplan. The config file is usually /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      addresses:
        - 1.2.3.4/24
      routes:
        - on-link: true
          to: 0.0.0.0/0
          via: 1.2.3.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1

3. Revert changes to resolv.conf

Backout any changes made in step 1. to your resolv.conf file. That is, the line with nameserver should just be nameserver 127.0.0.53

4. Restart services

Restart networking systemctl restart systemd-networking

Restart resolved systemctl restart systemd-resolved

David
  • 3,391
-2

i guess it should use dns specified on netplan config, so this most be a BUG ? anyway, i fixed like this:

change the symbolic link of the resolv.conf to other name:

sudo ln -sf /etc/resolv.custom.conf /etc/resolv.conf

then add your preferred name servers:

sudo nano /etc/resolv.custom.conf

like:

nameserver 8.8.8.8 nameserver 1.1.1.1

instantly solved without any other steps..this way DNS got saved permanently tested with latest ubuntu 24.04

Rickz
  • 1