port forwarding

der.hans plug-discuss@lists.plug.phoenix.az.us
Sun, 19 May 2002 20:48:37 -0700 (MST)


Am 18. May, 2002 schwätzte Virgil Silhanek so:

> I'm having some problems configuring coyote linux to do NAT.  I've been
> running a web server on Mandrake 8.1 and also had that same machine using
> iptables to share a connection with a Win2k computer.
>
> Now, I set up coyote linux to run off a 3rd computer and want my linux web
> server and Win2k boxes behind it.  Everything seems to be working fine except
> accessing the web server.  From both computers, I can access my web page by
> entering http://192.168.0.5 (linux IP).  But, when I type in my external IP
> given box cox, I am unable to get it to forward port 80 to the 192.168.0.5
> computer.
>
> I've been following directions on
> http://www.dalantech.com/coyote-faq.shtml#portforward
>
> I added this line to my rc.firewall
>
> /sbin/ipmasqadm portfw -a -P tcp -L x.x.x.x 80 -R 192.168.0.5 80
> x being the IP assigned by dhcp/cox.
>
> I also tried this and it didn't seem to work either.
> /sbin/ipmasqadm autofw -A -r tcp 80 80 -h 192.168.0.5

Here's what I'm using for iptables.

	/sbin/iptables -t nat -A POSTROUTING -s $intranet -o $intra_eth -d $intranet -j MASQUERADE

Where $intranet is my internal network and $intra_eth is the ethernet device
hooked up to the the internal network.

For ipchains, make sure you have forwarding setup correctly, then something
like the following should work.

      /sbin/ipchains -A forward -p ICMP -j MASQ -s $intranet
      /sbin/ipchains -A forward -p UDP -j MASQ -s $intranet
      /sbin/ipchains -A forward -p TCP -j MASQ -s $intranet

I'd think. Haven't tried this particular task with ipchains.

For the port forwarding I have something like the following from when I was
using ipchains.

	/sbin/ipmasqadm portfw -a -P tcp -L $external_ip $FROM_PORT -R
$internal_host $TO_PORT

Play with the --check option for ipchains to toss packets at your rules and
see what happens.

ciao,

der.hans
-- 
#  https://www.LuftHans.com/
#  HERE LIES LESTER MOORE
#  SHOT 4 TIMES WITH A .44
#  NO LES
#  NO MOORE
#        -- tombstone, in Tombstone, AZ