Actually the same question to this one. But I didn't get answer there either.
My scenario is: a Linux box with two NICs acting as a router, running iptables rules for masquerading, firewall, ... etc. I'd like to forward certain port to internal servers which only have LAN IPs.
The router server uses ppp0 as external interface and 192.168.212.50 as internal IP. I'd like to forward port 2000 from external (connecting to hostname:2000) to internal 192.168.212.51:8088.
The sysctl net/ipv4/ip_forward has been set to 1 since it has masquerade set.
Now when I try port forwarding from external ip (hostname:2000) it is always timed out. In the log I could see the packets being dropped.
The iptables rules is here: https://pastebin.com/au9QDhQf
- If I setup the port forward to LAN only, i.e., not defined
-i $EXT_IFand connect with http://192.168.212.50:2000/ it could work.
- I also checked this post. However, since I have already had MASQUERADE set the second rule
iptables -t nat -A POSTROUTING -j MASQUERADEdoes not work here.
Any help will be very appreciated.