iptables port redirection wont work for localhost

iptables

Solution

The `nat` table is used for Network Address Translation, and is only used for external interfaces. You have to add the rule to a table that handles internal communication as well.

Problem

I redirect port 80 to port 8000 via: ``` iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000 ``` The other host can access my webserver via 80 port, but the redirection cannot work in local host when I access 127.0.0.1:80. Can port direction work for loopback network adapter?

Original source

Related problems