PDA

View Full Version : [ubuntu] resolv.conf keeps overwriting



Lucky75
June 14th, 2009, 07:52 AM
Hi all,

I've been having a problem where my resolv.conf seems to keep updating itself? What happens is that whenever I enter something in my address bar as a "feeling lucky" search, my firefox always redirects to my annoying ISP's (Rogers) "not found" 404 page. However, sometimes this happens even when I'm not entering information into the address bar and just clicking on a link, or when the address is correct.

It seems to be a problem with the resolv.conf file? I'm not too sure what it all means, but here's the file:

/etc/resolv.conf:


# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
search <router/network name>


Would removing the "search" line work? The resolv.conf keeps getting overwritten though. Not too sure how to fix it.


/etc/dhcp3/dhclient.conf:



option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name "<hostname>";
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;



Thanks for the help!

dcstar
June 14th, 2009, 08:05 AM
Hi all,

I've been having a problem where my resolv.conf seems to keep updating itself? What happens is that whenever I enter something in my address bar as a "feeling lucky" search, my firefox always redirects to my annoying ISP's (Rogers) "not found" 404 page. However, sometimes this happens even when I'm not entering information into the address bar and just clicking on a link, or when the address is correct.

It seems to be a problem with the resolv.conf file? I'm not too sure what it all means, but here's the file:

/etc/resolv.conf:


# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
search <router/network name>


Would removing the "search" line work? The resolv.conf keeps getting overwritten though. Not too sure how to fix it.
...........
Thanks for the help!

Nothing to do with your resolv.conf, if your ISP has a Transparent Proxy then it is nothing whatsoever to do with Linux.

Lucky75
June 14th, 2009, 08:06 AM
Well, it randomly redirects when I click on links sometimes. I've tried removing the "search" line, and it *seems* to work, but it always gets put back there.

Edit: And it's only a problem for my ubuntu. Other computers work fine.

ddrichardson
June 14th, 2009, 08:09 AM
Since Hardy (I think) resolv.conf is overwritten by Network Manager. The 404 is being redirected by your router. You can change the file and make it persistent as a work around.

Lucky75
June 14th, 2009, 08:13 AM
Since Hardy (I think) resolv.conf is overwritten by Network Manager. The 404 is being redirected by your router. You can change the file and make it persistent as a work around.

The 404 is being redirected by my router? What do you mean?

And how would I make it persistent? I think I installed some dhclient package or something that was supposed to take care of that, but I have no idea how to use it.

ddrichardson
June 14th, 2009, 08:16 AM
Well, if it works when you change resolv.conf, stop NM overwriting it by:
chattr +i /etc/resolv.conf

Lucky75
June 14th, 2009, 08:22 AM
Well, if it works when you change resolv.conf, stop NM overwriting it by:
chattr +i /etc/resolv.conf


sudo chattr +i resolv.conf
chattr: Operation not supported while reading flags on resolv.conf


And won't this break something? Surely there's a better way then just blocking NM from changing the file through permissions?

kerry_s
June 14th, 2009, 08:22 AM
in /etc/dhcp3/dhclient.conf look for "prepend domain-name-servers" uncomment it and put the dns servers you want.

example opendns:

prepend domain-name-servers 208.67.222.222,208.67.220.220;

i'm using the fastest for my area, calculated on this page from round trip times: http://www.dnsserverlist.org/
scroll down till you see the "Here are the top three calculated DNS servers for your IP"

i run my own dns cache as well as those 3 fastest's servers.
mine looks like this:

prepend domain-name-servers 127.0.0.1,204.74.97.104,209.213.196.218,69.111.95. 106;

ddrichardson
June 14th, 2009, 08:26 AM
sudo chattr +i resolv.conf
chattr: Operation not supported while reading flags on resolv.conf
And won't this break something? Surely there's a better way then just blocking NM from changing the file through permissions?
You asked about it being overwritten, I told you a workaround. You have a better solution like using a different dhcp configuration as suggested by the other responder then crack on.

Lucky75
June 14th, 2009, 03:51 PM
You asked about it being overwritten, I told you a workaround. You have a better solution like using a different dhcp configuration as suggested by the other responder then crack on.

I guess...but it didn't work. Did I do something wrong?

Lucky75
June 19th, 2009, 02:04 PM
Yeah, so...I finally got chattr to work, but my resolv.conf still changed back.

Any other suggestions?

Thanks!

Lucky75
June 22nd, 2009, 07:58 PM
bump

mkormendy
February 17th, 2010, 06:45 AM
Bump!

mkormendy
February 18th, 2010, 07:36 AM
This problem can be now fixed by removing the resolvconf package, using this command:

sudo apt-get remove resolvconf

Then add your nameservers to resolv.conf file, save it, then reboot your system.

timwaters
February 19th, 2010, 01:46 PM
Wait. Doesn't our systems need the resolvconf package? Don't applications and scripts use this?

Or am I missing something?

Iowan
February 19th, 2010, 11:53 PM
From what I've read/seen - resolvconf is responsible for updating resolv.conf. I've seen problems fixed by adding it - and others by removing it. If memory still works, mkormendy fixed a problem (http://ubuntuforums.org/showthread.php?t=1408217) recently by removing it.

oshunluvr
February 20th, 2010, 02:29 AM
I only way I've ever solved this is to remove network-manager (which IMO is one of the worst things ever released) and configure your network manually.

To be fair - network manager seems to work OK on my laptop where I use wireless most of the time, but on a desktop with hardwired network and multiple NIC's it's way more trouble than it's worth. In fact, I've never gotten it to work correctly and it doesn't configure port aggregation at all.

The file to edit is "/etc/network/interfaces"

something like...

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.100
gateway 192.168.1.1
nameserver 192.168.1.1
netmask 255.255.255.0
mtu 7692