On Tue, 4 Jul 2000, Doug Barton wrote:

>       I updated my dhclient script to handle this case, since it
> happens on the roadrunner network as well. I can send you the patch
> if you want, but I have a lot of other hacks in my script so it
> might be confusing.  Starting right around line 106 of the default
> script, I have:

A hook is already provided for this kind of thing.  You can create a
separate program called /etc/dhclient-exit-hooks, which get run at
various times by dhclient-script.  Since /etc/dhclient-exit-hooks is
sourced by /sbin/dhclient-script, you have access to all of its
internal variables, such as '$reason', '$old_ip_address',
'$new_ip_address', etc.

Thus, you don't have to maintain a separate /sbin/dhclient-script like
you do now.

Also, if you run a firewall, you should re-instantiate your rules with
the new IP address here as well.  Mine (which is still evolving) looks
something like this:

# File: /etc/dhclient-exit-hooks

# redirect to syslog
logger="/usr/bin/logger -t dhclient-exit-hooks -i"

checkit ( ) {
  /bin/echo "REASON=$reason  OLDIP=$old_ip_address  NEWIP=$new_ip_address"
  if [ -z "$old_ip_address" ] || [ -z "$new_ip_address" ]; then
    /bin/echo "old and/or new is empty"
  elif [ "$old_ip_address" != "$new_ip_address" ]; then
    /bin/echo "flushing ARP tables"
    /usr/sbin/arp -d -a
    /bin/echo "re-establishing firewall rules"
    . /etc/rc.firewall.local

checkit | $logger

I notice you also flush the routing table.  Is that necessary - it
appears that dhclient-script does this when it's needed?

I found this exit hook feature by looking at the source for
dhclient-script, but, oddly enough, it is even documented in the man


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to