Configuring the DHCP client

To save power, my DSL router is automatically shut down when my computer is powered off. When I start the computer, the router is also started. This works fine.

The problem is that when the router is started, it takes about 30-60 seconds before it initializes the connection and starts servicing DHCP requests. In the meantime the computer has already tried to get an IP address from DHCP. More importantly, it gives up trying before the router is up. In order to get a configuration for the network, I then have to manually force an renewal of the IP address.

I did not find a way to make the default DHCP client, dhcpcd, wait longer before giving up, without also causing the boot process to hang. Instead, I opted to use the dhclient, which is also installed by default but not enabled. This is done in /etc/sysconfig/network/dhcp where:

DHCLIENT_BIN=””

is changed to:

DHCLIENT_BIN=”dhclient”

I also tweaked the options for dhclient a bit in /etc/dhclient.conf:

send dhcp-lease-time 3600;
request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers,
host-name, nis-domain, nis-servers;
require subnet-mask, domain-name-servers;
timeout 120;
retry 10;
reboot 10;
select-timeout 5;
initial-interval 2;
script “/sbin/dhclient-script”;

Now the DHCP client will run as a background process, waiting for the router to come up, but without slowing the boot process down.

  • Print
  • email
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • Google Buzz
  • Posterous
This entry was posted in Configuration. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *