# Boot hangs on DHCP when ethernet cable not connected[SOLVED]

## cazort

I have a laptop, which, like many people, I like to connect to ethernet when it's available, and fall back on wireless support when it's not.  I have the ethernet set to DHCP because I use it at different locations.

When I boot and am not connected to an ethernet connection, it sees the ethernet and hangs for quite some time, waiting for DHCP.

The computer seems to have the capability to detect instantly whether or not a cable is plugged in for which a device is attached to it.  How can I have it utilize this information on boot so that it only tries to do DHCP if a cable is actually plugged in and attached to another device?  It seems a senseless waste of time, and it puzzles me that the default behaviour is for it to wait to do DHCP even when nothing is attached.

I'd like to not only solve this for myself personally, but contribute some of my time and energy to Gentoo to get the default behaviour improved.  Any ideas?

----------

## yabbadabbadont

From /etc/conf.d/net.example:

 *Quote:*   

> # For passing custom options to dhcpcd use something like the following.  This
> 
> # example reduces the timeout for retrieving an address from 60 seconds (the
> 
> # default) to 10 seconds.
> ...

 

If you can find how to get it to detect a connected cable, that would be better though.

----------

## cyrillic

 *cazort wrote:*   

> The computer seems to have the capability to detect instantly whether or not a cable is plugged in for which a device is attached to it.  How can I have it utilize this information on boot so that it only tries to do DHCP if a cable is actually plugged in and attached to another device? 

 

The Gentoo networking scripts already support this.

```
# emerge ifplugd

# /etc/init.d/net.eth0 restart 
```

----------

## cazort

If I understand it correctly, ifplugd is a daemon.  I don't want any daemon running, I just want it to make the correct decision at startup when it sets up the interface.  If I emerge ifplugd, will this fix the problem of loading at boot, without actually loading the daemon?

----------

## yabbadabbadont

Doesn't look like it.  But it is a very small daemon, about 25KB or so.

----------

## cyrillic

 *cazort wrote:*   

> If I understand it correctly, ifplugd is a daemon.  I don't want any daemon running ...

 

Your DHCP client is a daemon too ...

I personally use ifplugd because I love the convenience of being able to plug and unplug the cable whenever I want, and the networking scripts just do the right thing.

----------

## cazort

Thanks!  This worked!

----------

