Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 2003 18:06:37 +0000
From:      Jonathan Vaughan <jonathan@turnip.org.uk>
To:        FreeBSD Stable <stable@FreeBSD.ORG>
Subject:   Re: Natd stops working on Firewall
Message-ID:  <20030327180637.GA2791@mashed.turnip.org.uk>
In-Reply-To: <PAEEIJCHPFHEDADDGJFLCELFDNAA.scotrn@cox.net>
References:  <20030325092007.GB73657@sunbay.com> <PAEEIJCHPFHEDADDGJFLCELFDNAA.scotrn@cox.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 25, 2003 at 08:33:12PM -0500, Scot wrote:
> Thanks Ruslan ;
> I'll give it a try right now.
> 
> Just want to send this out before I switch firewalls,
> assuming I might be down for an hour or so tweaking.
> 
> oip and iip are static variables in rc.firewall but
> under DHCP oip is a moving target. Is there a recommended
> way to pass these to rc.firewall so a re-edit is not needed?

I just use a perl script (below), and use its output as the value for
$oip in rc.firewall

No doubt there's a better way of doing it, and it won't deal with
changes to your IP after you've booted (I know that won't happen in my
case).

If you want to use it, then in rc.firewall put

$oip=`/usr/local/bin/myip <interface-name>`
(or whatever you call it)

and put the following in that file, changing $and chmod +x it

#!/usr/bin/perl -w
use strict;
my $if = $ARGV[0] || 'de0';

chomp (my $ifc = `ifconfig $if | grep inet | head -1`);
$ifc =~ /inet\s(\d+\.\d+\.\d+\.\d+)\s/;
print $1;

Jon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030327180637.GA2791>