I have had several requests for the summery of NAT on Linux so I am posting
this to the list. Many thanks to Greg Haverkamp who was able to figure this
out in the first place and let me know.
What I found that you can do if you have a finite list of connections you
are trying to make (I am connecting many web sites that are inside to the
outside) is as follows.
Using Linux kernel version 2.0.30 with FWTK 2
real ip address of f/w 126.96.36.199
addresses the web sites should appear as 188.8.131.52 to 184.108.40.206
real ip addresses of web sites 100.100.100.2 to 100.100.100.200 for 199 web
for each web site do the following:
setup the alias
ifconfig eth0:2 220.127.116.11
setup an input firewall filter (I created a file rc.fw that I run after
ipfwadm -I -a accept -r 10002 -S 0/0 -D 18.104.22.168 80
ipfwadm -I -a accept -r 11002 -S 0/0 -D 22.214.171.124 443
start up two copies of the plug-gw (from the TIS Firewall Toolkit)
/usr/local/etc/plug-gw -daemon 10002 plug-gw
/usr/local/etc/plug-gw -daemon 11002 plug-gw
The folowing two rules should appear ing the /usr/local/etc/netperm-table
plug-gw:port 10002 * -plug-to 100.100.100.2 -port 80
plug-gw:port 11002 * -plug-to 100.100.100.2 -port 443
what this does....
the ifconfig sets the alias so the firewall will listen to the port.
the input filters accept a incoming packet from anywhere addressed to
126.96.36.199 on port 80 and change it to arrive at port 10002. the plug-gw
then listenes at port 10002 and plugs anything it hears to 100.100.100.2
port 80 (standard http port). the other set does the same for the https ssl
to do this you need to have experimental options turned on, normal firewall
and forwarding options turned on, and the EXPERIMENTAL IP_TRANSPARENT_PROXY
must be turned on for the -r option to work in ipfwadm.
This is a very ugly way to do this but it does work.
let me know if you have any other questions.