LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   resolv.conf keeps getting rewritten (https://www.linuxquestions.org/questions/linux-software-2/resolv-conf-keeps-getting-rewritten-725109/)

herpules 05-11-2009 12:36 AM

resolv.conf keeps getting rewritten
 
There is a file /etc/resolv.conf, and in that file are two nameservers which get accessed by internet applications. I know what two nameservers will make my applications successful in obtaining data from the web. So I set the file appropriately and everything works.

Then I reboot the computer and something rewrites it with two different nameservers. And my web pages time out.

I think I have gone through several different mysterious "somethings" since I've had this problem through several Ubuntu updates. I thought the culprit was called network-manager before, but I don't seem to have a network-manager now. There maybe twelve different applications all waiting their turn to helpfully rewrite resolv.conf for me.

So... I just want them to leave me alone.


Ubuntu 9.04
Qwest DSL
integrated MCP61 Ethernet card
(Is there other system information that might be relevant here?)

jdkaye 05-11-2009 12:50 AM

Quote:

Originally Posted by herpules (Post 3536659)
There is a file /etc/resolv.conf, and in that file are two nameservers which get accessed by internet applications. I know what two nameservers will make my applications successful in obtaining data from the web. So I set the file appropriately and everything works.

Then I reboot the computer and something rewrites it with two different nameservers. And my web pages time out.

I think I have gone through several different mysterious "somethings" since I've had this problem through several Ubuntu updates. I thought the culprit was called network-manager before, but I don't seem to have a network-manager now. There maybe twelve different applications all waiting their turn to helpfully rewrite resolv.conf for me.

So... I just want them to leave me alone.


Ubuntu 9.04
Qwest DSL
integrated MCP61 Ethernet card
(Is there other system information that might be relevant here?)

I think the "culprit" is your ISP acting through your router/modem. I had a similar problem (I wanted to use open dns servers and not the one supplied by my ISP). I solved it by installing the dhcp3-client and dhcp3-common packages. This will create an /etc/dhcp3/dhclient.conf file. As root or using sudo add the following line to this file:
Code:

prepend domain-name-servers {dns-server1_ip},{dns-server2_ip};
Just replace the {dns-server...} place holders with the ip number of the dns servers you want to use and Bob's your uncle. ;)
cheers,
jdk

herpules 05-11-2009 02:12 AM

That's not fixing it. Maybe it's trying, but something else is overcoming it? (Or did I miss a step? I can see dhclient running.)

/etc/resolv.conf is being rewritten by NetworkManager according to the first line of the file, which executes scripts in /etc/NetworkManager/dispatcher.d/, which currently contains 01ifupdown. 01ifupdown calls ifupdown scripts in /etc/network/, and so on and so on.

jdkaye 05-11-2009 03:44 AM

Quote:

Originally Posted by herpules (Post 3536725)
That's not fixing it. Maybe it's trying, but something else is overcoming it? (Or did I miss a step? I can see dhclient running.)

/etc/resolv.conf is being rewritten by NetworkManager according to the first line of the file, which executes scripts in /etc/NetworkManager/dispatcher.d/, which currently contains 01ifupdown. 01ifupdown calls ifupdown scripts in /etc/network/, and so on and so on.

You have to actually run
Code:

sudo dhclient
to activate things (and possibly also stop and start your network connection). cheers,
jdk

herpules 05-11-2009 07:34 AM

For some reason I thought you wanted me to actually include the curly braces.

Now it keeps rewriting all four nameservers, which I think is as functional as just having the good two. Thanks!

jdkaye 05-11-2009 08:36 AM

Quote:

Originally Posted by herpules (Post 3536974)
For some reason I thought you wanted me to actually include the curly braces.

Now it keeps rewriting all four nameservers, which I think is as functional as just having the good two. Thanks!

Well done! We have defeated the evil isp's ;)! You can edit the dhclient.conf file and remove the unwanted servers if you like.
cheers,
jdk


All times are GMT -5. The time now is 05:59 AM.