Custom DNS settings lost on boot

Bug #91890 reported by StaticFish
66
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Fix Released
Low
Unassigned
Nominated for Intrepid by mati

Bug Description

Binary package hint: network-manager

This is a very very annoying little bug!

After every bootup, the DNS settings in System > Administration > Network revert back to the automatically detected ones from my University network (they are just awful so I have to use openDNS)

Can we make these user-defined settings 'stick' please!

Many thanks

Daniel

Revision history for this message
Roderick Drew (r-c-drew) wrote :

Yep, I experience the same thing (see my bug listing No. 108916)!

Revision history for this message
Roderick Drew (r-c-drew) wrote :

There seems to be a workaround which I stumbled upon somewhere herein. One can enter DNS name-servers by adding the following line to /etc/dhcp3/dhclient.conf:

prepend domain-name-servers 192.168.60.1, 172.16.254.2;

(The name-servers above are obviously examples)

Those name servers will always be placed first in /etc/resolve.conf

It has worked for me so far with no apparent ill side-effects.

Revision history for this message
StaticFish (staticfish) wrote : Re: [Bug 91890] Re: Custom DNS settings lost on boot

Thank you Roderick, these proved most useful

Dan

On 29/04/07, Roderick Drew <email address hidden> wrote:
> There seems to be a workaround which I stumbled upon somewhere herein.
> One can enter DNS name-servers by adding the following line to
> /etc/dhcp3/dhclient.conf:
>
> prepend domain-name-servers 192.168.60.1, 172.16.254.2;
>
> (The name-servers above are obviously examples)
>
> Those name servers will always be placed first in /etc/resolve.conf
>
> It has worked for me so far with no apparent ill side-effects.
>
> --
> Custom DNS settings lost on boot
> https://bugs.launchpad.net/bugs/91890
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Henrik Nilsen Omma (henrik) wrote :

Glad you've found a work-around, but it also needs fixing properly. Has anyone had a chance to test for this in Gutsy?

Do we know which component reverts the settings, are we sure it's network-manager?

Changed in network-manager:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
russofris (russofris) wrote :

Good afternoon,

I am experiencing the same. Manual network config, set static IP, GW, and netmask. Manually set DNS servers. Upon reboot, the DNS servers revert the ones that would have been picked up by DHCP. Problem is... I'm not using DHCP. I have to configure my DNS servers every reboot. Had the same issue with 7.04.

Also, just for the sake of my own sanity... Can someone please explain why this defect is marked incomplete? If you're going to mark a defect as incomplete, please put in a comment as to why. Especially since this is a show stopping bug.

Thank you for your time,
Frank Russo

Revision history for this message
Juicyfruits (mattleggett) wrote :

Not sure if it helps anyone but I had previously flashed the bios of my linksys router to the alchemy version.

The last time I lost network connectivity I went into the router admin and it had lost its IP address and DNS settings.
It was still able to serve internet for an XP machine, but not my ubuntu.
Releasing/Renewing the routers DHCP config restarted network connectivity in ubuntu.

Dont know why xp carried on working and Ubuntu didnt (I use static IP and the ISP's DNS servers in the IP config for each OS)

Revision history for this message
Pankrat (wkx) wrote :

I have the same problem as the OP on Ubuntu Gutsy using DHCP. Furthermore, I can't find the location where network-manager keeps the DNS server setting except for /etc/resolv.conf which is rewritten whenever I (re)connect to my network. If I run 'dhclient eth1' manually, the file is rewritten as well, with the added DNS server lost or replaced by the one returned by the DHCP server. Using a static IP address the DNS settings are kept in /etc/resolv.conf on my machine, so I can't confirm the behaviour russofris reported.

Using DHCP the "real" solution is certainly to set the DNS server in the DHCP server (if you have access to it) or to use the workaround described by Roderick Drew. In so far one could argue that it's not a bug. However, the nm-applet interface gives the impression that it can override the DNS setting; and that actually works, except that network-manager can't keep that information over multiple sessions.

If network-manager is designed to work that way, I think the behaviour should at least be documented.

It might even make sense to implement the DNS/DHCP workaround described by Roderick Drew in the network-manager (with the addition of "domain-name" for search domains). OTOH, this might also not be what the user expects, e.g. when roaming is activated.

Thanks for dealing with this issue.

Revision history for this message
mati (mati-wroc) wrote :

The status of this bug is Incomplete. What information do we have to provide in order to help fixing it?
I'll be glad to attach them, I'm also suffering from this issue.

Revision history for this message
Jonas Jørgensen (jonasj) wrote :

Again, what is incomplete about this report?

Adam Niedling (krychek)
Changed in network-manager:
status: Incomplete → New
Revision history for this message
Matt Sicker (jvz) wrote :

Enough people here (including myself) can confirm this issue, and despite having an interesting workaround, this is a UI issue that should be looked into.

Changed in network-manager:
status: New → Confirmed
Revision history for this message
mati (mati-wroc) wrote :

I've just installed 8.04 - the issue is still there.

Revision history for this message
c_t (chefturner) wrote :

I experience the same annoying issue.
The workaround provided by Roderick Drew works but I absolutely agree with all others here, that it would be nice to be able to define static dns-servers for any (W)LAN listet by NetworkManager that take precendence over those sent by DHCP (ok, this part is already possible). However these settings really should be kept upon NetworkManager restart!

Revision history for this message
Can Kaya (ckaya) wrote :

I can confirm this one too. I use 8.04 and did all the updates until now.

Here is the detailed workaround for OpenDNS users:
https://www.opendns.com/start?device=ubuntu&print

Revision history for this message
JamesLavin (james-patriotsbook) wrote :

Another confirmation of this bug and request that it (finally) get fixed.

Thanks!

Revision history for this message
Juan Delgado (zzzarate) wrote :

Hi there,

As a note, this is happening to me even *during the same session*. I mean, after setting up dns on network manager, without rebooting, logging out, hibernate or anything like that, dns get lost.

Thanks

Revision history for this message
Daniel Hill (daniel-hill) wrote :

"low Importance", This is a very frustrating bug, it's anything but low importance, it also shows why Linux can't work as a desktop computer yet, because an average user shouldn't be editing config files(even tho this doesn't work for me because I don't use DHCP)

Revision history for this message
Daniel Hill (daniel-hill) wrote :

ok I believe this should work
 $echo "nameserver 10.1.1.1" | sudo resolvconf -a eth0
I'm not sure how this works with DHCP but I believe this is how it was meant to happen

Revision history for this message
JamesLavin (james-patriotsbook) wrote :

Since this bug will apparently never get fixed, I just applied Roderick's work-around.

Thanks for that tip.

--James

Revision history for this message
ebeneezer (michael-alft) wrote :

I've had this same server from Edgey through Hardy and I never had this NetworkManager problem. I upgraded to Intrepid Ibex (alpha 4) and static ips were no longer assigned upon reboot.

None of the above solutions worked.

I finally had to fix it by uninstalling NetworkManager and DHCP-client3 taking care to preserve /etc/resolv.conf first. Server now boots up fine.

It shouldn't have to be this way.

Revision history for this message
Fede (fserrani) wrote :

I found another way to "solve" this bug.
I 've edited /etc/resolvconf/resolv.conf.d/base, and added a line with "nameserver xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx", where "x" needs to be replaced by your ips numbers.
Then you can run resovconf -u, this will write the content of base into resolv.conf, you can check if it's ok. Restart the networking services (/etc/init.d/networking restart), or reboot the machine.
It has worked for me.

Revision history for this message
JamesLavin (james-patriotsbook) wrote :

Thanks, Fede! Sounds like the right work-around. I found some more posts recommending your "solution":

https://launchpad.net/ubuntu-doc/+bug/49706
http://ubuntuforums.org/archive/index.php/t-6704.html
www.noah.org/wiki/Resolv.conf
http://ubuntuforums.org/showthread.php?t=281346

--James

Revision history for this message
Alexander Sack (asac) wrote :

this is fixed in intrepid in various ways: a) resolvconf works, b) NM now supports setting dns details manually, etc.

Changed in network-manager:
status: Confirmed → Fix Released
Revision history for this message
darking358 (gaowenyu1982) wrote :

seems this bug didn't fix until now
i have to set the dns and default route every time after reboot
if this bug will be fixed or not?

establish 2 new connections,set the ip&mask for them,add a default route,set the nameserver in resolv.conf
pc can connect to internet successfully
after reboot
connection auto eth0 and auto eth3 were up,they get ip,dns by dhcp,now,in resolv.conf,the name server change to which was got form dhcp server,the default route was lost
change the connections created by me,in resolv.conf,not any nameserver

Revision history for this message
Djihed (djihed) wrote :

This issue still exists in Intrepid. This bug should be reopened. What is the "fix released", is it the hack above?

Revision history for this message
darking358 (gaowenyu1982) wrote :

"is it the hack above?"
what's the meaning?

Revision history for this message
Djihed (djihed) wrote :

I meant the opendns workaround.

I am afraid this bug is still unfixed for Intrepid.

Newly installed Intrepid:

Edit connections->IPv4 settings->Automatic address only->I put my DNS servers.

DNS servers are reverted to old settings on next boot. So no, even though NM allows you to set the DNS servers, it doesn't obey them.

Changed in network-manager:
status: Fix Released → New
Revision history for this message
mati (mati-wroc) wrote :

Confirmed again. Today I've installed Intrepid on another machine. Had to enter DNS settings for my wired connection manually (in XP it is unnecessary - I don't know what is with that connection). I opened NM, set DHCP with custom-set DNS in the IPv4 tab and everything was fine until reboot. Connection was reset to pure DHCP, DNS settings were lost.

Changed in network-manager:
status: New → Confirmed
Revision history for this message
VK Sameer (vksameer) wrote :

This document (https://help.ubuntu.com/community/NetworkManager0.7 - in section titled 'Creating/Modifying a User connection') has an interesting claim:

  Hint Auto created connections are not editable. Modifying them without changing names will not be saved

Yet to confirm with a reboot, but custom DNS servers remained in /etc/resolv.conf after a variation on this sequence:

- Edit Connections...
- Edit 'Auto eth0'
- Change to Automatic (DHCP) addresses only in 'IPv4 Settings' tab
- Added DNS Servers 4.2.2.1, 4.2.2.2
- Change 'Auto eth0' to 'DHCP+static-DNS' (arbitrary name) and 'Close'
- Verify /etc/resolv.conf contains custom DNS servers
- Uncheck 'Enable Networking' to disable networking and verify /etc/resolv.conf empty
- Re-check 'Enable Networking'

Revision history for this message
Alexander Sack (asac) wrote :

dupe of bug 284298

Changed in network-manager:
status: Confirmed → Triaged
Revision history for this message
Alexander Sack (asac) wrote :

well ... actually this is fixed since intrepid as NM now allows you to set custom DNS in connection editor. if you still see the same as the title says, you are seeing bug 284298.

Changed in network-manager:
status: Triaged → Fix Released
Revision history for this message
t405 (tent405) wrote :

I've got another fix.

Edit your /etc/resolv.conf for the nameservers you want.

And then

sudo chattr +i /etc/resolv.conf

Chattr +i works well for screwy configuration workarounds :)

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.