[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NAT and DHCP



> Is there an elegant way to use NAT when your ISP assigned IP address is
> dynamic?
>
> My current way of handling it is just to edit the nat.conf file whenever
> the IP address changes (which seems to be about once every 30-45 days)
>

I'm running 3.1, but this should work for 3.0 too.  In your /etc/nat.conf 
don't use your ip address, use your external interface name.  Here's mine for 
example:

	nat on sis0 from 192.168.1.0/24 to any -> sis0

And then you'll need to edit your dhcp scripts so that each time it gets a new 
ip it reloads your nat rules, otherwise the new ip won't take.  I edited my 
/sbin/dhclient-script, and added this at the end of it:

	# Pick up new interface address for packet filter rules
	/sbin/pfctl -N /etc/nat.conf

That should do it (I think, I just did it myself, so I haven't really had time 
to test it).  If you need some better instructions check out 
http://www.xciv.org/byhsi/

-Matt



Visit your host, monkey.org