LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Port forwarding with iptables (https://www.linuxquestions.org/questions/linux-networking-3/port-forwarding-with-iptables-793374/)

cigarette 03-05-2010 05:57 AM

Port forwarding with iptables
 
Say I have two IPs on the server as follows:

1.2.3.4 and 5.6.7.8

1.2.3.4 is listening on port 21 (FTP Daemon)

5.6.7.8 is listening on 55555 (Another FTP Daemon)

What iptables rule do I add so that port 21 to 5.6.7.8 is forwarded to port 55555 on 5.6.7.8? It should not affect the other IP.

troop 03-05-2010 10:06 AM

iptables -A PREROUTING -p tcp -m tcp --dport 21 -d 5.6.7.8 -j DNAT --to-destination 5.6.7.8:55555


All times are GMT -5. The time now is 03:21 AM.