Second day in a row I am having a hard time setting up port forwarding on my mac. I was working on a micro service and wanted to utilize through web. I might have messed up some settings, because a while ago I messed around with port forwarding and everything worked just fine. I want my running micro service on localhost:7171
to be accessible through my public IP address 71.XXX.XX.XXX:9890
.
Here's what I did:
- I've setup a port forwarding rule on my router and opened a port 9890
- As per rule all requests are forwarded from
71.XXX.XX.XXX:9890
to10.0.0.209:9890
(10.0.0.209
is IPv4 address of my mac) - I've setup ssh tunnel to forward
10.0.0.209:9890
to localhost:7171 asssh -L 10.0.0.209:9890:localhost:7171 localhost
What's weird and not good:
- Once I setup SSH tunnel I can ping my service from web as
71.XXX.XX.XXX:9890
, but only for 10 seconds, afterwards, service doesn't respond, even though it is running and I can hit it locally - I can run
10.0.0.209:9890
and still hit my micro service from mac that forwards me to localhost:7171 (SSH tunneling is working, yes!) - Another weird thing is that I can't access my micro service if I hit
71.XXX.XX.XXX:9890
from the same wi-fi network, it just hangs and never responds - The last thing, which might be normal is that my ssh tunnel dies when I shut down the terminal, tried to use autossh, but again it didn't work
Temporary solutions:
- Since I have dynamic IP on my phone, I keep reconnecting to internet via LTE and, thus, am able to hit my micro service for another 10 seconds, then it just hangs
- I played around with ssh config file set different properties, which again didn't help
- Not a solution: I am about to give up and don't know what the heck is going on.
Please, advice. Thank you!