10
Redirecting Ports Using iptables Prerouting
Filed Under (Commands, Firewall, Mail) by jc on 10-03-2008
Tagged Under : iptables, mta, prerouting, redirect
Prerouting can be very useful if you need a quick fix and do not want to mess with the application itself. For example, if you need to have your MTA listen on port 587 and do not want to alter the configuration files (the daemon will not actually listen on port 587, iptables will redirect the traffic), you can use the following iptables rule to preroute traffic going to port 587 to port 25.
/sbin/iptables -t nat -I PREROUTING -p tcp --dport 587 -j REDIRECT --to-ports 25
