[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Passing "nowait" command line option to "dhclient"



Steffen Dettmer wrote:
> I configured several interfaces using ifupdown using DHCP by stanzas like:
> 
> auto eth2
>   iface eth2 inet dhcp

Your indention is terrible!  Don't indent the iface line.  Indent
lines _after_ the iface line that modify the iface.

> When booting and one of the DHCP interfaces has no cable attached,
> booting is delayed about around 60 seconds (seems to be value of
> dhclient.conf:timeout).

Why isn't your DHCP server responding?  Your dhcp server should
respond quickly and provide an IP address.  If it is not then look
there to solve the problem.  Debug your dhcp problems first.

> I think I have to pass the option "-nw" to dhclient, but how do I do
> that correctly?

If you want dhclient not to wait then change the "auto" to
"allow-hotplug".  Using "auto" means bring the interface up at system
boot time.  It runs the /etc/init.d/* scripts.  This is a synchronous
operation.  "allow-hotplug" means bring the interface up when the
interface is detected.  That is the new dynamic event driven way and
runs asynchronously.

The "auto" and "allow-hotplug" are documented here:

  http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_basic_syntax_of_etc_network_interfaces

> I noticed that DHCP leases are kept as long as the lease is valid when
> moving from one LAN to another, not sure if this behavior is correct.

It is required.  It is possible for clients to actively release the
lease.  But if a client crashes then the dhcp server never gets an
indication and therefore must keep the lease active for the full time
to live.

> I considered ifplugd which solves both issues, but then all static
> addresses of the interface are missing as long as no cable is plugged
> (which might usually be expected on Desktops / Laptops, but might not
> be desired on other devices, because it prevents from binding sockets
> to specific IP addresses).

If an application needs to bind to a specific address then IMNHO it
should detect when this interface becomes active and track the events
itself.  Nothing else makes sense.  IMNHO.

Instead I would go ahead and use a wildcard listen address.  And use
iptables to block access to the undesired addresses.  A completely
different strategy.

> How to configure DHCP correctly without causing boot delays?

Use "allow-hotplug".

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: