Port redirection with iptables With iptables, it is possible to redirect a TCP port to another TCP port. Example: If you need SSH to work on a different port than 22, but on 22 aswell, you can redirect eg. port 34770 to 22:
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 34770 -j REDIRECT --to-port 22
In this example ssh would listen on 22 and 34770.
Note that this command is only active until shutdown. admin / Dec 04, 2014
|