dhclient trashing alias IP address upon reconnect

When a host boots, I don't want DHCP to come up right away; I want that to wait until an arbitrary point later. But what I do want at boot time is a hard IP address (for example, 10.0.0.3) to be automatically associated with the interface. I use ifconfig(8) for that in an rc file, and it works.

Later, at an arbitrary point, I use dhclient(8) with only one parameter: the interface name. This adds an IP address to that interface, and the old hard IP address remains. Fine so far.

The problem arises when the network cable is disconnected and then reconnected. At that point, the DHCP IP address remains, but the previously defined hard IP address (in this example, 10.0.0.3) disappears. Sad!

For now my workaround is to launch a Perl script at boot time which checks once a minute, detects the problem, and uses, say, ifconfig em0 10.0.0.3 netmask 255.255.255.0 alias to patch things up. Is there a way I can change the behavior of dhclient(8) so I don't need this workaround?
 
Back
Top