Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 want to configure my eth0 interface using an external DHCP server (resident in my subnet), so I edited /etc/network/configure with the lines

auto eth0  
iface eth0 inet dhcp

but I also want to use avahi autoconfiguration when the DHCP server is down.

So I tried ifup eth0 when the server is down, and after a certain amount of time it fails, but the interface eth0:avahi is correctly configured. What I'm looking for is a way to decrease the amount of time spent trying to connect to a DHCP server.

And ... is this the right way to use avahi when there's no DHCP server?

share|improve this question

For setting DHCP client timeout from CLI read this.

You can also just configure DHCP clients configuration file. You can find the guide for that here. On my 12.04 the dhclient.conf file that you need to edit is uder /etc/dhcp/

So from CLI open the file with this:

sudo nano /etc/dhcp/dhclient.conf

Scroll to the line where it says "#timeout 60;" and remove the "#" sign. Change the number to set the timeout in seconds. Press Ctrl + X to exit the editor and save the changes.

If you can't wait until the next reboot then to force Ubuntu to reacquire a new IP address from the DHCP server run:

sudo dhclient -r
share|improve this answer

You can try to set:

timeout 10;
backoff-cutoff 0;
initial-interval 0;
retry 15;

In /etc/dhcp/dhclient.conf.

See dhclient.conf manpage (man dhclient.conf) for reference.

share|improve this answer

I'm not sure about avahi but the default configuration file is /etc/network/interfaces. You can place those lines there and dhcp should give you the ipaddress right away. if you need a static ip address when the dhcp server is down you can set up an alias for eth0 or manually configure it using ifconfig eth0 x.x.x.x

share|improve this answer
Thank you. But what I really want is that if there isn't a dhcp server, so avahi can set up a link-local address by its own. This happens, but after a "long" time. Is it possible to reduce this time? I just want to set a timeout for a dhcp connection ... – JustTrying Oct 20 '12 at 12:41

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.