Question regarding dhclient-script exit-hooks

Bryan Mesich bryan.mesich at ndsu.edu
Tue Dec 16 23:59:13 UTC 2008


Good evening to all on the dhcp mailing list,

I'm trying to use the exit-hooks functionality dhclient-script
provides to update a NAT entry in my iptables configuration.  The
system in question is being used as a gateway for others to gain
access to the outside world.  My iptables configuration is as
follows:

*nat
-A POSTROUTING -o eth0 -j SNAT --to-source xxx.xxx.xxx.xxx
COMMIT

Where the IP address xxx.xxx.xxx.xxx is the IP address the cable
modem has issued to the system.  When the system renews a new IP
address, the NAT entry needs to be changed as well.  Reading the
dhclient-script man page, there are a number of reasons why
dhclient-script might be called.  The documented reasons are:

MEDIUM,  PREINIT,  BOUND,  RENEW,  REBIND, REBOOT, EXPIRE, FAIL,
STOP, RELEASE, NBI and TIMEOUT

I'm a little confused which reason(s) I should be checking for.
If I down the interface and then bring it up via "ifup eth0",
dhclient-script is executed twice (PREINIT, and REBOOT). This 
makes sense upon reading the documentation.                

My question is, which $reason should I be checking for in my
dhclient-exit-hooks script to detect a change in my IP address?  
Is having reason=RENEW good enough?  

Bryan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20081216/922a1843/attachment.bin>


More information about the dhcp-users mailing list