Local Port Forwarding.

Taylor, Grant gtaylor at riverviewtech.net
Fri Apr 22 23:59:58 CEST 2005

> 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?
> Thanks in advance,
> 	Alejandro

Alejandro, are you wanting to redirect the traffic of someone (or something / some daemon) running locally on the box that will be doing the redirection?  Or are you wanting to redirect the traffic from an internet connected client to a different system?  From what I read of your question the situation is the former.  As such I'm going to answer that question.

iptables -t nat -A OUTPUT -d $HostX -p tcp --dport $PortX -j REDIRECT --to-ports $PortY

Grant. . . .

More information about the netfilter mailing list