Bug 306381 - dhclient overwrites /etc/resolv.conf even when it can't get a lease
dhclient overwrites /etc/resolv.conf even when it can't get a lease
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: dhcp (Show other bugs)
8
All Linux
low Severity low
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 418441
  Show dependency treegraph
 
Reported: 2007-09-26 00:45 EDT by Arjan van de Ven
Modified: 2008-02-07 15:31 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-07 15:31:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Arjan van de Ven 2007-09-26 00:45:07 EDT
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


How reproducible:

always

Expected results:

dhclient shouldn't overwrite a valid looking /etc/resolv.conf if it cannot get a
new lease.
Comment 1 David Cantrell 2007-10-08 13:16:39 EDT
It's actually /sbin/dhclient-script that does the rewriting, but that's invoked
by dhclient.

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.
Comment 2 Arjan van de Ven 2007-10-08 13:22:38 EDT
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 
minutes.

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 
behavior.
Comment 3 David Cantrell 2007-10-08 13:33:10 EDT
Are you using NetworkManager?
Comment 4 Arjan van de Ven 2007-10-08 13:36:34 EDT
nope
Comment 5 David Cantrell 2007-10-08 13:57:29 EDT
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.

Thanks.
Comment 6 clive darra 2008-02-07 12:31:47 EST
i also have a problem with dhclient-script clobbering /etc/resolv.conf search
parameter

http://www.usenet-forums.com/linux-networking/64473-resolve-conf-clobbered-dhcp.html
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 !
Comment 7 David Cantrell 2008-02-07 15:31:56 EST
(In reply to comment #6)
> i also have a problem with dhclient-script clobbering /etc/resolv.conf search
> parameter
> 
>
http://www.usenet-forums.com/linux-networking/64473-resolve-conf-clobbered-dhcp.html
> 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:

PEERDNS=no

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
running.

These changes will be in dhcp-4.0.0-10.fc9


Note You need to log in before you can comment on or make changes to this bug.