Domain Resolver

Disable systemd-resolved
CentOS 7 resolv.conf make changes permanent

Ubuntu uses systemd-resolve, to see the status, run

systemd-resolve --status

On Linux, Domain resolver configuration is stored in

/etc/resolv.conf

On Ubuntu, it is a symlink.

root@ok-pc-01:/etc# ls -l | grep resol
drwxr-xr-x  3 root root     4096 Apr 26  2018 resolvconf
lrwxrwxrwx  1 root root       39 Jun 13 23:02 resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
root@ok-pc-01:/etc# 

You can remove the symlink and create your own file if you don’t want it managed by systemctl. You can see systemctl DNS resolver details with command

systemd-resolve --status

Disable systemd-resolved

If you want to use old /etc/resolv.conf, you can disable systemd-resolved

systemctl disable systemd-resolved.service
systemctl stop systemd-resolved
rm -f /etc/resolv.conf
tee /etc/resolv.conf << END
nameserver 8.8.8.8
nameserver 1.1.1.1
END

On Ubuntu, NetworkManager will update /etc/resolv.conf, to avoid this, edit

vi /etc/NetworkManager/NetworkManager.conf

Under [main] section, add

dns=none

Here is what I have on my PC

root@pc10:~# cat  /etc/NetworkManager/NetworkManager.conf 
[main]
plugins=ifupdown,keyfile
dns=none

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no
root@pc10:~# 

To configure systemd-resolvd, see Ubuntu Configure systemd-resolved

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *