[olug] Port Forwarding

Phil Brutsche pbrutsch at creighton.edu
Sat Jun 30 20:28:08 UTC 2001


Quoting LP <linuxposse at home.com>:

> Im using the RH  2.4.2-2 kernal and I'm searching the web for
> information on port forwarding.

Kernel 2.4 doesn't have "port forwarding" as you (possibly) knew of it in the
2.2 kernel series.

Real-quick-like introduction:

$IPT -A INPUT -p tcp -d $PUBIP --dport $PORTNUM -j ACCEPT
$IPT -t nat -A PREROUTING -p tcp \
        -d $PUBIP --dport $PORTNUM \
        -j DNAT --to-destination $NEWIP

Substitute as needed for:
   $IPT = the path to the iptables executable
   $PUBIP = the IP number given to you by your ISP
   $PORTNUM = the port number to "forward"
   $NEWIP = the IP number to send the packet to

A more concrete example:

/sbin/iptables -A INPUT -p tcp -d 24.22.x.y --dport 80 -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -p tcp \
        -d $PUBIP --dport 80 \
        -j DNAT --to-destination 192.168.0.2

Which I use on my home firewall ('net connection via Cox at Home) to redirect
incoming web traffic to the web server behind the firewall.

> Any good site you would suggest?

http://netfilter.samba.org/unreliable-guides/NAT-HOWTO/index.html


Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: olug-unsubscribe at bstc.net
For additional commands, e-mail: olug-help at bstc.net



More information about the OLUG mailing list