Prevent resolv.conf to be overridden

I found two ways to configure the /etc/resolv.conf file to prevent it to be overridden by the system.

  1. Edit the base file under the resolv.conf.d file
sudo vim /etc/resolvconf/resolv.conf.d/base

and then add the nameservers to the file:

nameserver 8.8.8.8
nameserver 8.8.4.4

lastly, update resolvconf:

sudo resolvconf -u

2. Install dnsmasq and edit /etc/dnsmasq.conf to add the nameservers you want.

sudo apt install dnsmasq
and
vim /etc/dnsmasq.conf

Then restart the network services:

sudo service dnsmasq restart and
sudo service network-manager restart

You should be all set now.

References:
1. https://unix.stackexchange.com/questions/128220/how-do-i-set-my-dns-when-resolv-conf-is-being-overwritten

Cheers!

Leave a comment