I have manually edited /etc/resolvconf/base
to add openDNS
name servers, and then run sudo resolvconf -u
to update the /etc/resolv.conf
file.
However changes are discarded on each reboot.
How do I preserve those changes?
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
edit:
/home/pkaramol
$ cat /etc/resolvconf/resolv.conf.d/base
nameserver 208.67.222.222
nameserver 208.67.220.220
/home/pkaramol
$ sudo resolvconf -u
/home/pkaramol
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
You can add the nameservers in the
resolv.conf
and make it immutable, which means - it can not be modified.That should do a trick. To modify the file again do:
sudo chattr -i /etc/resolv.conf
You are placing the changes you want into the wrong directory. NetManager allows custom configuration of the file by editing the base, head and tail by placing your preferences in this directory:
You can correct this by moving your
/etc/resolvconf/base
to/etc/resolvconf/resolv.conf.d/base
.The content you're seeing after reboot is the content of the
/etc/resolvconf/resolv.conf.d/head
file. It takes precedence over all and as you can see, is preserved.The priority choices should be placed there.