Originally Posted by dlugasx
does anybody knows how can I forward port using iptables ?
in my server I have three interfaces
eth0:2 22.214.171.124 (ip is not real just for example)
I would like to redirect port from interface eth0:2 to 192.168.1.12:80.
I know how to do it with normal interface, I mean eth0, eth1 etc etc. Iptables doesnt work correctly with alias eth0:2 on my machine.
How can I redirect port 80 from IP: 126.96.36.199 from interface eth0:2 to local address 192.168.1.12:80 ???
It have to be NAT...
The beauty of linux is several ways to do one thing.
One way would be
iptables -i eth0 -t nat -A PREROUTING -p tcp -d 188.8.131.52 --dport 80 -j DNAT --to-destination 192.168.1.1:80
specifying port and incoming ip is optional..
iptables -i eth0 -t nat -A PREROUTING -p tcp -j DNAT --to-destination ipaddr/ipaddrrange/port/portrange
actually.....i dont think i have even answered your question....i just read it properly...