Port forwarding

Andy ag1234 at carmen.se
Tue Jan 18 16:14:12 UTC 2005


Hi,

Jari Marikainen wrote:
> I would like to forward incoming traffic from internet to
> "<195.198.111.x> port 80" to "<some other ip on the internet> port 80"
> in FC3 on the same interface.

I would try the DNAT/SNAT iptables targets, along the lines of:
iptables -t nat -A PREROUTING -p tcp --dport 80 -d 195.198.111.x \
	-j DNAT --to-destination 65.114.4.69
iptables -t nat -A POSTROUTING -p tcp --dport 80 -d 65.114.4.69 \
	-j SNAT --to-source <your external IP address on this machine>

The second line makes the real server send it's replies through the same
path (otherwise it will reply directly to the client)

You have to enable/allow forwarding for everything to work.

hth,
/Andy




More information about the fedora-list mailing list