How to redirect port using IPTABLES

You can redirect the port in IPTABLES using the prerouting parameter.

Following is the command you can use to redirect the traffic of port 587 to port 25.

$ /sbin/iptables -t nat -I PREROUTING -p tcp –dport 587 -j REDIRECT –to-port 25
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart

You can change the ports in the above command according to your need


Both comments and pings are currently closed.

Comments are closed.