Domain Resolver
Disable systemd-resolved
CentOS 7 resolv.conf make changes permanent
Ubuntu use systemd-resolve, to see status, run
1 |
systemd-resolve --status |
On Linux, Domain resolver configuration is stored in
1 |
/etc/resolv.conf |
On Ubuntu, it is a symlink.
1 2 3 4 |
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 deails with command
1 |
systemd-resolve --status |
Disable systemd-resolved
If you want to use old /etc/resolv.conf, you can disable systemd-resolved
1 2 3 4 5 6 7 |
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
1 |
vi /etc/NetworkManager/NetworkManager.conf |
Under [main] section, add
1 |
dns=none |
Here is what i have on my PC
1 2 3 4 5 6 7 8 9 10 11 |
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