Red Hat Bugzilla – Bug 306381
dhclient overwrites /etc/resolv.conf even when it can't get a lease
Last modified: 2008-02-07 15:31:56 EST
Description of problem:
I have 2 network interfaces, and both get a dhclient started during boot.
When I get home, only one of them actually is connected, the other (wireless) is
just fruitlessly looking for an AP. However both get dhclient started (which is ok).
The bug is new in F8t2 (f8t1 was ok); after some time the dhclient on the second
interface times out, and somehow thinks it's smart to overwrite the
/etc/resolv.conf from the first, working lease it got. What is worse, it keeps
doing this every few minutes, so if you fix it (by bouncing the working
interface), it just breaks and overwrites it again after a few minutes
dhclient shouldn't overwrite a valid looking /etc/resolv.conf if it cannot get a
It's actually /sbin/dhclient-script that does the rewriting, but that's invoked
The dhclient-script will always write out resolv.conf, but settings in
/etc/dhclient.conf will override the default behaviour. You can use the
supersede domain-name and supersede domain-name-servers to locally override the
DHCP settings. This is most useful for networks where the DHCP server does not
provide all information.
See the dhclient.conf(5) man page for more information.
I don't want to override nameservers; I'm perfectly OK with with dhclient-
scripts creating /etc/resolv.conf WHEN DHCP GETS A LEASE. What I do not
consider OK is for it to overwrite the file when there is no lease.
What I very much object to is it overwriting it OVER AND OVER AGAIN when it
still has no lease.... destroying other things that set the file ever few
It really should only write that file if it got a lease; if it didn't get a
lease.. just leave it alone. Not that hard and much more clearly the expected
Are you using NetworkManager?
OK, my guess right now is that dhclient-script needs updating since I removed
dhcdbd. I've just walked through the entire script and removed the dhcdbd code,
so I want you to try that and then we'll go from there.
Wait for the new dhcp packages to appear in rawhide and then give it a try.
i also have a problem with dhclient-script clobbering /etc/resolv.conf search
suggests editing /etc/sysconfig/network-scripts/ifcfg-ethX and adding at the end
SEARCH="dns.suffix.one dns.suffix.two etc"
that file is read by /sbin/dhclient-script which generates /etc/resolv.conf
however that then overwrites the search supplied by DHCP ! when i really just
want to add search's to the one provided by dhcp !
(In reply to comment #6)
> i also have a problem with dhclient-script clobbering /etc/resolv.conf search
> suggests editing /etc/sysconfig/network-scripts/ifcfg-ethX and adding at the end
> SEARCH="dns.suffix.one dns.suffix.two etc"
> that file is read by /sbin/dhclient-script which generates /etc/resolv.conf
> however that then overwrites the search supplied by DHCP ! when i really just
> want to add search's to the one provided by dhcp !
You can disable rewriting of the resolv.conf file completely by adding this line
to your ifcfg-ethX file in /etc/sysconfig/network-scripts:
The /sbin/dhclient-script process that runs after dhclient gets a lease will
skip writing out a new /etc/resolv.conf file and just leave it as is. There's
not an easy way to have the SEARCH variable append to an existing search line
and if I made that change now, it's inconsistent with the existing behavior for
as long as we've had these config files.
Regarding Arjan's initial problem, I have modified dhclient-script so that if
dhclient receives EXPIRE, FAIL, RELEASE, or STOP, it will only restore
configuration files if there is not another dhclient process running. I have
also modified the script so it makes the backup copies of the different
configuration files and adds '.predhclient.$interface' to the end of the
filename rather than just '.predhclient'. This should allow the configuration
backup and restore code to more happily coexist with multiple dhclient processes
These changes will be in dhcp-4.0.0-10.fc9