Debian – /etc/resolv.conf keeps resetting itself

debianresolv.conf

I'm running some tests on a Debian server. The network in which this server is located has two DNS servers (I don't know why and I can't change this). I used to need to point /etc/resolv.conf to one of these servers and I recently had to change which server I use. Since I changed /etc/resolv.conf to point to the new server, the configuration keeps changing behind my back every few days (it changes back to the old server).

For all I know, the machine has not rebooted. What should I check to figure out why this happens, and how can I stop it?

Best Answer

You are probably using DHCP for automatic IP configuration.

Best option to try:

/etc/dhclient.conf 

or

/etc/dhcp/dhclient.conf 

file contains configuration information for dhclient. You can toggle the DNS updates/ point to different DNS server from this file. The man pages for DHCLIENT.CONF and DHCP-OPTIONS point out that in dhclient.conf, you should add this:

option domain-name-servers 8.8.8.8 8.8.4.4

where

8.8.8.8 8.8.4.4

are DNS server IPs

Following link have more scenarios/possible solutions covered.