Wednesday, March 23, 2011

Re-routing ports using iptables

The usual command for rerouting port 80 to 8080 on Linux is:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Fedora is a little bit stranger. You have to type:
/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
If you don't type the exact path, Fedora thinks it is a package, and asks you if you want to install it.


To save under Fedora:
service iptables save

Forum thread

No comments: