resolv.conf overwritten on dhcp renew when using NetworkManager vpn plugins

Bug #126592 reported by Zach
16
Affects Status Importance Assigned to Milestone
dhcp3 (Ubuntu)
New
Undecided
Unassigned
network-manager (Ubuntu)
New
Undecided
Unassigned

Bug Description

I'm using NetworkManager plugins for vpn connections (both openvpn and vpnc). I've noticed that when the dhcp lease is renewed on the local network, it clobbers the resolv.conf that NetworkManager created for the VPN connection, and I have to disconnect/reconnect to the VPN.

All of my interfaces are managed by network-manager, so the original, non-vpn resolv.conf was created by network manager, as well as the vpn one.

When it gets overwritten from the dhcp renewal, it no longer says:
# generated by NetworkManager, do not edit!

I don't know if this is a network-manager bug or a dhcp3-client bug.

Revision history for this message
Nick Webb (webbn) wrote :

I can confirm this bug... is there any good workaround?

Revision history for this message
Barak (barak-naveh) wrote :

bug confirmed.

as a temp workaround, one can use a script that adds the name servers back to the /etc/resolv.conf file.

echo "nameserver {dns-address1-goes-here}" > /etc/resolv.conf
echo "nameserver {dns-address2-goes-here}" >> /etc/resolv.conf

and run this script using sudo after each time the VPN is connected. annoying, but works.

Revision history for this message
claud_j_greengrass (jlk-osml) wrote :

A not so nice work-around is to edit /sbin/dhclient-script and comment out the line

mv -f $new_resolv_conf /etc/resolv.conf

then restart networking. Your settings, if any, from /etc/dhcp3/dhclient.conf will now appear in resolv.conf and dhclient will stop overwriting it.

/sbin/dhclient-script appears to be a duplicate of /etc/dhcp3/dhclient-script. Can anyone suggest why there are two copies of this script?

This is just a work-around. The real problem appears to be in dhclient and it ignoring the prepend domain-name-servers and supersede domain-name-servers some time after a restart. When first initialized, dhclient will put the correct information into resolv.conf, but later, some 10-15 mintues or so, dhclient looks at your router/cable modem and clobbers resolv.conf with the information for it.

Revision history for this message
William Gallafent (william-gallaf-deactivatedaccount) wrote :

This is strongly related to my recently-reported bug #159114, where I originally thought the problem was with KNetworkManager, before spotting that it's delegating to NetworkManager. There was no appropriate supersede line in /etc/dhcp3/dhclient.conf on my system until I added one by hand, along the lines of:

supersede domain-name-servers 1.2.3.4,5.6.7.8;

I would have liked NetworkManager to put it there for me when I added the DNS servers there, but it didn't! See the referenced bug for more information about my (very simple) configuration.

This is using 7.10, by the way.

Revision history for this message
Babar (babarhaq) wrote :

Confirming the bug and the work around given by claud_j_greengrass. Though I am wondering if I will ever need to enable it?

Revision history for this message
Paul Dufresne (paulduf) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug #90681, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.