View Single Post

  #2 (permalink)  
Old 03-16-2005, 07:25 PM
monk's Avatar
monk monk is offline
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Code:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.222 --dport 4080 -j DNAT --to-destination 192.168.1.118
But it did not work. I also observed that,

Because you did not specified the port in --to-destination IP:PORT. You need to give port also it can not guess it

Code:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.118 --dport 4080 -j DNAT --to-destination 192.168.1.118:4088
works, i.e, port redirection works.

Answer it as above for second

This port redirection (iptables based) will only works if the destination is in the same network on locally attached interface. If you need to forward it to other network then you need tiny utility called rinetd which is a TCP port redirector. See http://www.boutell.com/rinetd/ for more and to download it.
Reply With Quote