Re: Port forwarding

From: Whoever (nobody@devnull.none)
Date: 04/15/03


From: Whoever <nobody@devnull.none>
Date: Mon, 14 Apr 2003 23:39:28 GMT

On Fri, 11 Apr 2003, Jeremia d. wrote:

> On Fri, 11 Apr 2003 23:37:58 +0800, Scan Dompass DFG wrote:
>
> > Can anyone teach me by using an example for how to forward incoming TCP
> > connection on port 80 to another box's port 1080 in the internal subnet by
> > using iptables on a internet gateway/firewall?
> >
> > Appreciate your help.
> >
> > sdc
> iptables -I FORWARD -s 0/0 -d IP -p tcp --dport 80 -i $external -J ACCEPT
> iptables -t nat -A PREROUTING -i $external -p tcp \
> --dport 80 -j DNAT --to-destination OTHERBOXIP:1080

Should not the first rule use "--dport 1080": since the destination port
was changed in the PREROUTING chain, which the packet traverses before the
FORWARD chain.

>
>