[RndTbl] dhclient-exit-hooks

Trevor Cordes trevor at tecnopolis.ca
Thu Jan 2 01:15:55 CST 2014


Yet another obscure problem.  /etc/dhcp/dhclient-exit-hooks is supposed to 
run (if it exists) after dhclient has accepted a new DHCP IP from your ISP 
and done all its stuff.  One would assume that would include setting the 
IP on your actual interface.

I have a problem where a script that /etc/dhcp/dhclient-exit-hooks talks 
to (async through a named pipe, so after that it won't block) then does 
some stuff based on what /sbin/ip says the ip address is.  I am expecting 
this to be the *new* ip address.  But what it seems to be doing is still 
using the old ip, meaning (if I'm following my extremely complex scripts 
properly) /sbin/ip is still returning the old ip at that point.

Does anyone have experience with dhclient, or its hooks?  Is this even 
possible?  Even weirder is my scripts wait an additional 10s before 
checking /sbin/ip so even if there was a short delay, it shouldn't still 
give me the old ip.

The /sbin/ip command I use it:
/sbin/ip -o -4 addr list <interface>
then I parse out the address.

Is there anything in the linux networking layer that would cause an IP 
bind to "not show up" for >10s?

Secondly, debug testing this will be very difficult because our Shaw IP's 
change so infrequently.  I suppose I could "trick it" by switching NICs 
and/or changing my NIC's MAC.  I've never done that before, is that easy 
and safe?


More information about the Roundtable mailing list