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?
+2
A:
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.
Daniel Papasian
2008-09-15 15:05:00
+2
A:
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.
Jason Cohen
2008-09-15 15:05:18
This is a good answer. The asker should remember that having the DHCP client broadcast forever could be bad behavior in some environments.
benc
2009-07-17 10:58:16
+1
A:
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.
jpbarto
2008-09-15 17:04:47