This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 141709 - dhcp client takes a long time to fail on boot
dhcp client takes a long time to fail on boot
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: dhcp (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-02 21:26 EST by David Kaplan
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-03 10:00:03 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description David Kaplan 2004-12-02 21:26:01 EST
Description of problem:
When I boot my machine without the ethernet cable in, it takes dhcp a
long long time to fail, thus holding up the boot process a couple of
minutes.  This seems a bit excessive

Version-Release number of selected component (if applicable):
dhclient-3.0.1-11

How reproducible:
always

Steps to Reproduce:
1.use dhcp to make network connection
2.boot without out cable plugged in
3.wait...
  
Actual results:
takes forever to move on

Expected results:
should give up within a more reasonable time.

Additional info:
Comment 1 Jason Vas Dias 2004-12-03 10:00:03 EST
The dhcp client (/sbin/dhclient) has a default timeout of 5 minutes,
that is configurable in the file /etc/dhclient.conf (see dhclient.conf
man-page), with the 'timeout' and 'retry' parameters:
 timeout: Time between issuing a DHCPDISCOVER and deciding no response
          has been received (default: 60 seconds)
 retry:   Time between attempts to contact the server 
          (default: 5 minutes) 
So for instance you could put this in /etc/dhclient.conf:
'  timeout 5;
   retry   2;
' 
and dhclient will timeout for 5 seconds twice, giving up after 10
seconds.
To ensure that, during the DHCPDISCOVER process, timeouts also do not
occur on DNS lookups, put the following line in the file
/etc/dhclient-enter-hooks  :
'  /bin/rm -f /etc/resolv.conf
'
As this problem is correctable with configuration options, and the
defaults are sensible, this issue is not a bug . 
Comment 2 David Kaplan 2004-12-03 14:46:37 EST
If I understand correctly the man page for dhclient.conf, the lines
you gave me:

timeout 5;
retry 2;

mean to try for 5 seconds, then wait for 2 seconds and then try again.
 In the man page, it doesn't state how many times this process
repeats.  Is this the correct interpretation of those lines?  Do you
know how many times this repeats?

About dhclient-enter-hooks, this will remove resolv.conf every time I
want to use DHCP.  I use a mix of fixed and DHCP IP addresses and I am
wondering how these will work together.  In particular, is usually try
to keep the search domain constant no matter where I am.  Will I have
to reenter this every time I use DHCP?
Comment 3 Jason Vas Dias 2004-12-03 17:59:30 EST
Actually, on further consideration I think all you need is a 
' timeout 10;
'
statement in /etc/dhclient.options, since when run from ifup
dhclient is given the '-1' "one-shot" option and will never
retry, so retry is not used.
Setting 'timeout 10' means it will decide that the server is
not contactable after 10 seconds trying. 

You don't need to remove the /etc/resolv.conf in
/etc/dhclient-enter-hooks .

To keep your existing resolv.conf 'search' path after dhclient 
gets DNS information from the server, you can either :
- set PEERDNS=no in /etc/sysconfig/network-scripts/ifcfg-$IF 
  This will disable any DNS information obtained from DNS being
  written to resolv.conf, and the existing resolv.conf file will 
  always be retained.
- You can use the the supersede, prepend and append options in 
  /etc/dhclient.conf - eg.
   ' prepend domain-name "mydomain.com ";'
  means that 'mydomain.com' will be written to the resolv.conf
  'search' path before the search path obtained by DHCP;
  '  append domain-name " mydomain.com";' will add it to the end
  of the dhcp search path in resolv.conf;
  and 
  '  supersede domain-name "mydomain.com";' replaces the dhcp search
  path with "mydomain.com" .
  These can also be used for the 'domain-name-servers' option to 
  prepend / append a DNS server address(es) to the DHCP DNS server
  list, eg. 'prepend domain-name-servers 127.0.0.1;' .
 
Comment 4 David Kaplan 2004-12-03 20:33:24 EST
Thanks for the help and education.  It aborts much quicker now.
Comment 5 Tethys 2004-12-12 20:55:15 EST
Yes, this problem has a relatively easy workaround. But the defaults
as shipped aren't sensible, and a suitable /etc/dhclient.conf should
be shipped with the OS to provide sane defaults. Something like 10-15
seconds would be far more reasonable (IIRC, Windows uses 5s).

I woudl reopen this, but apparently I don't have permission to do so...

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