Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I switch between different networks with different dhcp servers, my resolv.conf file doesn't change (other settings like ip and gw change).

Workaround is to remove resolv.conf and run dhclient manually.

My interfaces file looks like this:

cat /etc/networK/interfaces

auto lo iface lo inet loopback

How to fix it permanent?

share|improve this question

I had same issue a while back, and it was because the resolvconf package was not install. try to install it using

sudo apt-get install resolvconf

then edit resolvconf file and restart the network via

sudo /etc/init.d/networking restart

also what does your /etc/network/interfaces file look like?

I also got a tip from this answer in a previous thread similar to yours.

A possible trigger for the seemingly spontaneous updates to /etc/resolv.conf is when your DHCP lease is renewed. Check how long you get DHCP leases for (this should appear in the system logs, I think in /var/log/syslog).

You can use auditd to find out what modifies the file. Start the daemon (sudo service auditd start) and tell it to watch for modifications to that file:

sudo auditctl -w /etc/resolv.conf -p w

Audit logs are in /var/log/audit/audit.log. You'll see the time the file was modified and the name of the program that modified it.

If you have the resolvconf package installed, Network Manager may be stepping on its toes. Try bringing all network interfaces down, then stop Network Manager (sudo service network-manager stop), then restart it.

share|improve this answer
resolvconf already installed. that is not the issue – Alexey Plutakhin Oct 2 '12 at 10:12
do you think the problem is with that specific dhcp server, maybe its not supplying the endpoint with the right nameserver and domains. – kmassada Oct 2 '12 at 14:33
DHCP servers are different. On each network I still have a problem. Previously there was no problem on these system with all these dhcp servers. – Alexey Plutakhin Oct 3 '12 at 11:32

From the fact that you have no iface definitions in /etc/network/interfaces I infer that you are using NetworkManager to configure your interfaces.

Possibly the original problem was misconfigured connections in NetworkManager, e.g., having selected "Automatic (DHCP) addresses only" instead of "Automatic (DHCP)" as the "Method".

Also consider the possibility that your symbolic link /etc/resolv.conf -> ../run/resolvconf/resolv.conf was missing for one reason or another. See bug #1000244. The fix for that would have been to run "dpkg-reconfigure resolvconf".

Removing resolvconf was not the best solution. By doing that you are relying upon legacy support in the DHCP client for directly futzing with /etc/resolv.conf. That may work for now, but resolvconf was introduced precisely in order to bring order to that kind of intervention.

share|improve this answer
up vote -3 down vote accepted

I fix it by removing resolvconf.

share|improve this answer
Removing resolvconf is almost never the right solution. – jdthood Oct 28 '12 at 20:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.