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 the SMTP server port 587 to port 25.
This is very useful when your ISP may have the SMTP port 25 blocked so you need an additional SMTP port to connect to send emails.

iptables -t nat -I PREROUTING -p tcp –dport 587 -j REDIRECT –to-port 25

Then Run iptables save

/etc/init.d/iptables save

Restart Iptables

/etc/init.d/iptables restart

One Response to “How to redirect port using IPTABLES”

  1. 3designerson 13 Jan 2022 at 1:54 am

    3deficit…

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.