Port forward using iptables

To forward all requests from port 80 to port 8080, run

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Here is another command that specify network interface and forward traffic on port 80 to port 5000

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000

Back to iptables

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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