Local Port Forwarding.

Jason Opperisano opie at 817west.com
Fri Apr 22 23:57:56 CEST 2005

On Fri, Apr 22, 2005 at 05:41:38PM -0400, Alejandro Villarroel wrote:
> Hello:
> 	I'm kind of new to IpTables, and I'm having problems to do this kind of
> port forwarding in my Fedora Core 3:
> Suppose I have some user trying to access Host X:Port X on the Internet
> from my Linux, but Instead of that I want to forward this traffic to the
> localhost:Port Y, what rule I have to apply?

your kernel needs to be compiled with the option to nat local


(i *believe* that FC3 includes this in their kernel--don't quote me on

with that, you can DNAT local connections in the nat table, OUTPUT

  iptables -t nat -A OUTPUT -p tcp -d $HostX --dport $PortY \
    -j DNAT --to-destination $LocalHost:$PortY



"Diane: Tom, you're so deep in the closet you're finding Christmas
        --Family Guy

More information about the netfilter mailing list