Ubuntu – Timeout in a connection to a DHCP server


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?

Best Answer

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
Related Question