I am working on an embedded system running Linux. There is a USB ethernet adapter that can be attached to this system for debugging purposes. I would like this adapter to automatically request an IP address whenever it is active with a link (on boot, or when plugged in to a running system).
This particular system is running a derivative of RedHat EL 5, and I tried simply configuring this adapter in the /etc/sysconfig/network-scripts/ifcfg-ethx file, however this only works if the adapter is present on boot, and the link is active. I would prefer not to delay the boot if the DHCP server is not available.
Ideally, the solution will start trying to get an address as soon as the adapter is present and the link is active, and continue trying forever. I believe Network Manager would do this, but I don't want to install it and it's dependencies on this system. I've tried using dhcpcd and plain old dhclient, but there doesn't appear to be any way to have them continue trying after initially failing to get an address, and dhcpcd does not daemonize until after it gets an address.
I thought of writing a shell script, but there doesn't appear to be any way to get notified when the link becomes active for an interface.