0

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?

0

3 Answers 3

0

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. https://askubuntu.com/a/58802/49237

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.

3
  • resolvconf already installed. that is not the issue Oct 2, 2012 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, 2012 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. Oct 3, 2012 at 11:32
-1

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.

0
-3

I fix it by removing resolvconf.

1
  • Removing resolvconf is almost never the right solution.
    – jdthood
    Oct 28, 2012 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .