Subject: Re: How-to IP NAT (masquerading)
To: Charles Sebold <pretender@macstore.com>
From: Scott Reynolds <scottr@og.org>
List: port-mac68k
Date: 07/10/1997 16:11:33
On Tue, 8 Jul 1997, Charles Sebold wrote:

> >Q: Could this be done at boot time by using:
> >	map ppp0 192.168.1.0/24 -> 0.0.0.0/32 portmap tcp/udp 10000:65000
> >	map ppp0 192.168.1.0/24 -> 0.0.0.0/32
> 
> I don't think so, since the whole point of this rule is to convert the fake
> address (192.168.1.x) to an address that will work when sent to the
> internet.

if you are using PPP, which of course you are in this case, there is a
better way.

---[/etc/ipnat.tmpl]---
# map all connections from 10.0.0.0/24 to @IPADDR@
map @IFACE@ 10.0.0.0/24 -> @IPADDR@/32 portmap tcp/udp 1025:65535

---[/etc/ppp/ip-up]---
#!/bin/sh
sed -e "s/@IFACE@/$1/" -e "s/@IPADDR@/$4/" </etc/ipnat.tmpl >/etc/ipnat.conf
/usr/sbin/ipnat -C -f /etc/ipnat.conf

This works regardless of whether you have a static or dynamic IP address.
It's cool. :-)

> Actually, I have had trouble with this too, since NetBSD seems to be
> unwilling to route things through ppp0 when it has ae0 configured as an
> inet network.

The `defaultroute' option works fine for me.  The relevant options in my
/etc/ppp/options file are:

defaultroute
noipdefault
ipcp-accept-local

Also, the kernel you are using must have the GATEWAY option.  GENERIC
kernels are compiled this way.

--scott