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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With