Score:0

Where is my DNS configured on my upgraded Ubuntu server?

bd flag

I have an Ubuntu VM that was installed with Ubuntu 16.04. It was functioning normally with network access and was able to resolve DNS.

I then upgraded it, via do-release-upgrade to Ubuntu 18.04, Ubuntu 20.04 and then Ubuntu 22.04. Between each upgrade there was a reboot. I therefore must assume that DNS was working as of the 20.04 upgrade since it was able to download and process package updates.

Now, with 22.04, I am getting SERVFAIL errors when attempting lookups via nslookup.

$ nslookup google.com
Server:         127.0.0.53
Address:        127.0.0.53#53

** server can't find google.com: SERVFAIL

The error refers to the DNS server 127.0.0.53 which I understand to be a loopback address. However, I cannot find where to change this.

Most sites say that I should be looking in the netplan.yaml configuration, but the netplan folder is empty:

/etc/netplan$ ls -la
total 16
drwxr-xr-x   2 root root  4096 Sep  7  2021 .
drwxr-xr-x 116 root root 12288 Nov 25 13:32 ..

I have tried to edit /etc/network/interfaces and changing the dns-nameservers line:

auto eth0
iface eth0 inet static
address 10.100.99.xxx
netmask 255.255.255.0
gateway 10.100.99.yyy
dns-nameservers 8.8.8.8

After this change, I've restarted the networking service and rebooted - no change.

I know that I can edit the /etc/resolv.conf - which currently reflects the 127.0.0.53 address, and I am able to get DNS services to work instantly. This change does not survive a reboot.

systemctl status network-manager reveals network-manager.service could not be found.

Where do I change my DNS settings?

Score:0
ng flag

Using nmcli, for example: nmcli device mod $deviceName ipv4.dns "8.8.8.8 8.8.4.4". nmcli device to list defined devices.

To check DNS: nmcli device show | grep IP4.DNS

EDIT: The systemd-resolved service overwrites /etc/resolv.conf. If it is running you can set DNS in /etc/systemd/resolved.conf and restart the service with systemctl restart systemd-resolved.

Philip avatar
bd flag
```$ nmcli device show | grep IP4.DNS Command 'nmcli' not found, but can be installed with: sudo snap install network-manager # version 1.2.2-29, or sudo apt install network-manager # version 1.36.6-0ubuntu2 See 'snap info network-manager' for additional versions.```
Philip avatar
bd flag
My question, I suppose, is that if ```nmcli``` is not currently installed, is there something else managing the DNS?
Anthony Kelly avatar
ng flag
Sorry, I thought nmcli was installed by default. Is the systemd-resolved service running? Try `systemctl status systemd-resolved`. This is what overwrites `/etc/resolv.conf`.
Anthony Kelly avatar
ng flag
If this service is running then I think you can set your DNS in `/etc/systemd/resolved.conf` and restart the service with `systemctl restart systemd-resolved`.
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.