I have a Windows machine and a Linux machine. Since I'm not very familiar with Windows firewalling (and not sure the OS's application level firewalling security), I wanted to open the app port to the internet from the Linux machine but not from Windows. So, it's like: The internet -> Linux:7000 -> iptables (rules to block and forward) -> Windows:7000 over ssh .
I googled and read some stackexchange posts (like this or this), tried following commands that should have worked I thought. But didn't work.
# linux machine: 192.168.0.168:7000
# windows machine: 192.168.0.111:7000
# the linux's network interface is wlp2s0, and windows's is eth0
# ssh-ing, from the windows machine
ssh -L 7000:localhost:7000 user@192.168.0.168
# iptables
sudo iptables -t nat -I PREROUTING -p tcp -i wlp2s0 --dport 7000 -j DNAT --to-destination 192.168.0.111:7000
sudo iptables -A FORWARD -i wlp2s0 -o eth0 -p tcp -d 192.168.0.111 --dport 7000 -j ACCEPT
# curl to test
curl -I 220.xx.xx.xx:7000 # this should return curl: (52) Empty reply from server for succeed, but curl: (7) Failed to connect # the global ip is connected to the linux machine
So, what's wrong with the commands?