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
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.
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}
Please post your `emerge --info' too.
(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.
(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.