Redirecting network traffic to a new port using IPtables

The following article describes how to redirecting traffic from port 443 to 143 in IPtables

The first thing to do is do enable IP forwarding. This is done either by using:
# echo “1” > /proc/sys/net/ipv4/ip_forward or  sysctl net.ipv4.ip_forward=1

 

Then, we will add a rule telling to forward the traffic on port 443 to  port 143:
iptables -t nat -A PREROUTING -p tcp –dport 443 -j DNAT –to-destination 143:443

 

And finally, we ask IPtables to masquerade:
iptables -t nat -A POSTROUTING -j MASQUERADE

Password Reset
Please enter your e-mail address. You will receive a new password via e-mail.

Power by

Download Free AZ | Free Wordpress Themes