I work with embedded Linux systems that sometimes want to get their IP address from a DHCP server. The DHCP Client client we use (dhcpcd) has limited retry logic. If our device starts up without any DHCP server available and times out, dhcpcd will exit and the device will never get an IP address until it's rebooted with a DHCP server visible/connected. I can't be the only one that has this problem. The problem doesn't even seem to be specific to embedded systems (though it's worse there). How do you handle this? Is there a more robust client available?
-
The reference dhclient from the ISC should run forever in the default configuration, and it should acquire a lease later if it doesn't get one at startup.
I am using the out of the box dhcp client on FreeBSD, which is derived from OpenBSD's and based on the ISC's dhclient, and this is the out of the box behavior.
See http://www.isc.org/index.pl?/sw/dhcp/
From Daniel Papasian -
You have several options:
- While you don't have an IP address, restart dhcpcd to get more retries.
- Have a backup static IP address. This was quite successful in the embedded devices I've made.
- Use auto-IP as a backup. Windows does this.
benc : This is a good answer. The asker should remember that having the DHCP client broadcast forever could be bad behavior in some environments.From Jason Cohen -
Add to rc.local a check to see if an IP has been obtained. If no setup an 'at' job in the near future to attempt again. Continue scheduling 'at' jobs until an IP is obtained.
From jpbarto
0 comments:
Post a Comment