iptables redirect port

Iptables is one of the simple firewall that we can use as a server administrator. Especially in Linux server computer.
In this example I want to redirect port 8080 or 80 to 3128 which is port for proxy squid that I have.
#

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 80 -j REDIRECT –to-ports 3128

#

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 8080 -j REDIRECT –to-ports 3128

#

iptables-save

Just remember to do it in root access (administrator).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.