/etc/resolv.conf keeps resetting itself

Solution 1:

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.

Solution 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.