[Techtalk] Port forwarding with iptables?

perimorph perimorph at mindspring.com
Thu Sep 11 10:46:06 EST 2003


hi julie,

> I've tried everything I know, and I still can't get iptables to
> forward a port.  I want all packets to port 5907 on my cable
> modem interface sent to port 5900 on a machine inside the house.

i do it this way:

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p tcp --dport 80 -m state
--state NEW,ESTABLISHED,RELATED -j ACCEPT

$IPTABLES -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to
192.168.1.1:5000

(sorry for all the variables, it's part of a script and i don't have
much time on my hands right now.  port 80 is forwarded to port 5000 on
the machine i sit at in the 2nd line.)

--ashleigh



More information about the Techtalk mailing list