2

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?

3 Answers3

4

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.

kaji
  • 2,588
2

On a server (or anything that's not being moved around a lot, or at least has a static IP) you don't need tools that automagically configure networking for you. It just gets in the way.

Remove the following:

apt-get --purge remove resolvconf network-manager

Then kill any dhcp client that may still be running:

ps -ef|grep dhcp
kill PID   <-- i.e. the ID of any process you found

Once done I am pretty sure your networking and resolv.conf will not mysteriously change anymore.

After that make sure your resolv.conf as well as your network configuration are configured the way you want it to be. Any changes you make will stay that way.

aseq
  • 4,740
1

Is your setup running NetworkManager? Consider disabling it if that suits your needs.