You are not logged in.

#1 2005-06-03 14:29:36

viniosity
Member
From: Washington, DC
Registered: 2005-01-22
Posts: 377
Website

resolv.conf overwritten at boot

I am moving my laptop between home and work.  At home I use a wireless connection (via DHCP) while at the office I dock in via Ethernet.  When I start up at the office (acpi still not working..) my resolv.conf seems to be set to some setting I may have had at home.

Every day I redo my resolv.conf file and no matter how many times I save it it keeps getting overwritten the next day!  This is frustrating b/c the name server really doesn't need to change between my two connections yet the one that it's putting in is only compatible with my wireless connection.

How can I stop arch from messing with my resolv.conf?

Offline

#2 2005-06-03 14:57:43

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: resolv.conf overwritten at boot

dhcp overwrites the resolv.conf - thats the way it works... resolv.conf needs to be modified on a connection by connection basis, as it lists nameservers to use for dns lookups (chances are name servers will not be the same from network to network).

Try switching to a static IP for wireless

Offline

#3 2005-06-03 14:59:14

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: resolv.conf overwritten at boot

resolv.conf is being changed by dhcpcd, the daemon managing dhcp client connections. It is being started in the initscripts (/etc/rc.d/network) when the system reads the configs in /etc/rc.conf and decides how the interfaces are going to be started. There might be some options to make dhcpcd NOT change /etc/resov.conf.

On a sidenote, it is quite normal for it to change the config for the DNS servers (/etc/resolv.conf), since they're normally supplied by the DHCP server.

Offline

#4 2005-06-03 15:02:21

viniosity
Member
From: Washington, DC
Registered: 2005-01-22
Posts: 377
Website

Re: resolv.conf overwritten at boot

True, but it should be optional.  On OS X for instance, if you don't supply the DNS it takes it from the DHCP server, but it you do it overrides the DHCP server.

I like the suggestion of making it static though.. will try that tonight.

Offline

#5 2005-06-03 15:02:41

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: resolv.conf overwritten at boot

It's dhcp who messes with resolv.conf. So either tell dhcp to not do it, or make the file read only and hope that fixes it.

Offline

#6 2005-06-03 15:04:28

viniosity
Member
From: Washington, DC
Registered: 2005-01-22
Posts: 377
Website

Re: resolv.conf overwritten at boot

How would I tell DHCP not to do it?

Also, I thought a bit more about making my wireless static but the problem is the IP I get from wireless is 10.0.2.x while the IP I have at work is 192.168.1.x.  More to the point, the gateway for eth0 (ethernet) is 192.168.1.1 while the gateway for eth1 (wireless) is 10.0.2.1.  Does rc.conf support two different gateways?  How would I handle that?

Offline

#7 2005-06-03 15:11:21

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: resolv.conf overwritten at boot

you're missing the point: the resolv.conf must be different for different connections... if you tell DHCP not to overwrite resolv.conf then you're going to be using the resolv.conf from work and nothing will resolve (e.g. firefox will sit at "resolving host www.blah.com...")

the easiest option is to use dhcp in both places.

or use static ips in both both places and write a simple script to overwrite the resolv.conf with your proper settings...

and yes, check rc.conf for the example static ip line... you must specifiy the gateway when setting the IP

Offline

#8 2005-06-03 15:19:44

viniosity
Member
From: Washington, DC
Registered: 2005-01-22
Posts: 377
Website

Re: resolv.conf overwritten at boot

phrakture wrote:

you're missing the point: the resolv.conf must be different for different connections... if you tell DHCP not to overwrite resolv.conf then you're going to be using the resolv.conf from work and nothing will resolve (e.g. firefox will sit at "resolving host www.blah.com...")

Actually, there are several DNS servers that I know that will resolve correctly both in my office and at home.  So this isn't the issue.  In fact, I'm overwriting every day with the same DNS server regardless of location.


I don't have DHCP at the office currently so that's not an option right now.  I might be able to set up a box to act as a DHCP server but that's not my first choice.  Still it'd be easier for me than writing a script.. yeesh.

Offline

#9 2005-06-03 15:39:18

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: resolv.conf overwritten at boot

If you have dhcp installed then you can read in the manpage which option tells dhcpd to not overwrite resolv.conf.

Offline

#10 2005-06-05 23:40:30

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: resolv.conf overwritten at boot

...or do some search on the fourms first. For example:
http://bbs.archlinux.org/viewtopic.php?t=7459

You'll probably need to add -R option to /etc/conf.d/dhcpcd (read the manpage for details)

Offline

Board footer

Powered by FluxBB