Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 238087 - /etc/resolv.conf overwritten when using fix IP setting
Summary: /etc/resolv.conf overwritten when using fix IP setting
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-19 09:29 UTC by Imre Péntek
Modified: 2008-09-25 23:47 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Imre Péntek 2008-09-19 09:29:27 UTC
when using fix IP like:
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default via 192.168.0.1" )

/etc/resolv.conf gets rewritten unneccessarily, the new version contains no nameserver info.

Reproducible: Always
Comment 1 Chí-Thanh Christopher Nguyễn gentoo-dev 2008-09-19 10:21:25 UTC
Use dns_servers_eth0 to configure static dns, as described in /etc/conf.d/net.example.

Maybe a warning could be added to /etc/resolv.conf that users are not supposed to modify this file themselves.
Comment 2 Arthur Hagen 2008-09-20 04:54:42 UTC
Users who want to edit /etc/resolv.conf themselves should absolutely be able to do so.  One good reason to do so is on multi-homed machines using dhcp, where the search list will be overwritten with the info for the last interface that comes up.
Or to fix the problem with domainname and search being mutually exclusive, and the script always writing a search line even when it shouldn't.

With dhcpcd, one can pass "-R" to it to avoid overwriting resolv.conf
For static addresses, this should also be possible.

As it is, to the original bug reporter, if you have the package net-dns/gentoo-resolvconf, uninstall it.  Unfortunately, gentoo will execute /sbin/resolvconf based on whether it's installed or not (better would be to check an /etc/conf.d variable for whether it should be used or not).
If you don't have this package, make sure that you don't set any of the following variables in net.* -- any one of them being present will cause resolv.conf to be overwritten:

dns_servers_{interface}
dns_domain_{interface}
dns_search_{interface}
dns_sortlist_{interface}
dns_options_{interface}
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2008-09-22 01:45:31 UTC
Please post your `emerge --info' too.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2008-09-23 18:53:08 UTC
(In reply to comment #1)
> Use dns_servers_eth0 to configure static dns, as described in
> /etc/conf.d/net.example.
> 
> Maybe a warning could be added to /etc/resolv.conf that users are not supposed
> to modify this file themselves.

In many situations editing resolv.conf manually makes a lot of sense, particularly when the tools that should edit it aren't doing it properly.
Comment 5 Raj Agarwal 2008-09-25 23:47:09 UTC
(In reply to comment #4)
> (In reply to comment #1)
> > Use dns_servers_eth0 to configure static dns, as described in
> > /etc/conf.d/net.example.
> > 
> > Maybe a warning could be added to /etc/resolv.conf that users are not supposed
> > to modify this file themselves.
> 
> In many situations editing resolv.conf manually makes a lot of sense,
> particularly when the tools that should edit it aren't doing it properly.
> 

Consider using the following configuration options for a granular control.

In the /etc/conf.d/net option, use:

# use eth0/eth1 etc to disable dhcpcd dns clobbering by specific interface(s).
dhcp_eth0="nodns"

This will stop dhcpd/dhclient etc from clobbering your resolv.conf based on specific interface(s).  If you use the -R option, you are restricting yourself to a specific dhcp client.