The server has an ip address 192.168.154.200, when I connect to port 80, I would like this to be forwarded to 127.0.0.1:8000, similar to proxy_pass http://127.0.0.1:8000 of nginx.So I tried the following,sysctl -w net.ipv4.ip_forward=1iptables -t nat -I PREROUTING -d 192.168.154.200 -p tcp --dport 80 -j DNAT --to 127.0.0.1:8000iptables -t nat -A POSTROUTING -j MASQUERADEIt does not work at all, when I do curl 192.168.154.200 on the client, it stuck, what did I miss? P.S curl 127.0.0.1:8000 works on the server.
Forward remote address to local, DNAT just stuck
iptables;port forwarding
Trysysctl -w net.ipv4.conf.eth1.route_localnet=1orsysctl -w net.ipv4.conf.all.route_localnet=1You may need to double check to ensure kernel supports route_localnet. Replace eth1 appropriately.Please note that this route_localnet is off for security reasons.