DNS resolving once, then answer from external DNS

/etc/resolv.conf

#Generated by NetworkManager
search lan
nameserver 192.xxx.xxx.61
nameserver 192.xxx.xxx.62

I tested to disable systemd-resolved on my Ubuntu desktop and now it is working as I guessed it would work.

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved
vi /etc/NetworkManager/NetworkManager.conf <

Add
[main]
dns=default
[…]

sudo rm /etc/resolv.conf
sudo reboot

Don’t need to remove /etc/resolv.conf…

You have to launch these commands and all should works.

systemctl stop systemd-resolved
systemctl disable systemd-resolved
ifconfig /flushdns

Then check DNS configuration in NetworkManager. Can be helpful also ifconfig command.

3 Likes

Thanks, that works :grinning:!
I wonder why systemd-resolved are implemented in Ubuntu.
One reason I switched over from Zentyal server to Nethserver was theirs DNS not working - when it was Ubuntu’s… But many other things fits my needs better with Nethserver.

2 Likes

Probably systemd-resolved creates an uncorrect dns cache. Please mark the answer as solution: it can be helpful for other Linux users :wink:

Have a nice evening :slight_smile:

1 Like

Some extra info if you have to fix this on Ubuntu 18.04 server. Do like this (rm /etc/resolv.conf because it is a link to a file under /run and cannot be edited):

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved
rm /etc/resolv.conf
vi /etc/resolv.conf

Add following in /etc/resolv.conf (replace 192.xxx.xxx.xxx with the ip address of your DNS servers)

#Generated by NetworkManager
search lan
nameserver 192.xxx.xxx.xxx
nameserver 192.xxx.xxx.xxx

reboot

Now you have control over the DNS settings again.

1 Like

Consider using NetPlan for configure network interfaces on Ubuntu Server.
https://netplan.io/examples

2 Likes