Roger Olofsson skrev:
Dear mailing list,

I am sorry if this question has been asked over and over again - however the htdig search interface for the lists is somewhat shaky and gives referrer errors for me.

Pre-conditions.
Dualhomed firewalled FreeBSD7.1. One nic is LAN and the other dynamical IP from ISP.

Question: What is the canonical way for catching the IP address from a DHCP assigned nic (from ISP that doesn't set hostname) and put the IP into /etc/hosts with a hostname?

Reason for asking
Firewall rules needs refreshing after new IP

Possible answers:
Create dhcp-exit-hooks (undocumented?) in /etc like so:

#!/bin/sh

if [ ! -z "$new_ip_address" ]; then
    IP=`ifconfig WAN | grep 'inet' | grep -v 'inet6' | cut -f 2 -d ' '`
    if [ ! -z "$IP" ]; then
        echo "$IP    wan.local.domain wan" >> /etc/hosts

    <refresh firewall rules here>

    fi
fi

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.17/1847 - Release Date: 2008-12-13 16:56



Sorry I mean dhclient-exit-hooks not dhcp-exit-hooks....

/R

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to