Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to start eth0 network interface during boot, but only if cable is plugged in. I have following in my /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

The problem is, when the cable is not plugged in, the computer still tries to reach the dhcp server and it takes long time to time out and eventually boot.

Is there some way to skip the eth0 configuration if link is not detected?

I am using Debian Wheezy

share|improve this question
did you tried to set static insted of dhcp, and put some static address, if this works for you – klerk May 29 '14 at 21:52
@vladeli - no, I need to use dhcp. – Martin Vegter May 29 '14 at 21:54

You can modify the amount of time used to wait for the DHCP response by editing /etc/dhcp3/dhclient.conf:

#timeout 60
timeout 10

This will set a ten-second window of opportunity for the DHCP server to respond. You might want to experiment with the timeout speed. Or, you could disable eth0 at startup by editing /etc/network/interfaces:

#auto eth0

Then, bring up eth0 manually when you want it, with sudo ifup eth0.

share|improve this answer
the DHCP server is sometimes slow to respond. If I set the timeout too low, then my client will mistaken slow response for no response. If I set the timeout high enough, then I am back where I have started. I know, I can detect if link is up with ethtool eth0. Is there no possibility (i.e. a ifup hook) to check if link is up? – Martin Vegter May 30 '14 at 7:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.