1

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:

  1. I've setup a port forwarding rule on my router and opened a port 9890
  2. As per rule all requests are forwarded from 71.XXX.XX.XXX:9890 to 10.0.0.209:9890 (10.0.0.209 is IPv4 address of my mac)
  3. I've setup ssh tunnel to forward 10.0.0.209:9890 to localhost:7171 as ssh -L 10.0.0.209:9890:localhost:7171 localhost

What's weird and not good:

  1. 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
  2. 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!)
  3. 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
  4. 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:

  1. 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
  2. I played around with ssh config file set different properties, which again didn't help
  3. Not a solution: I am about to give up and don't know what the heck is going on.

Please, advice. Thank you!

1 Answer 1

0

In many situations port forwarding doesn't work. I have found this from personal experiences. Actual cause of the failure remains unknown most of the times. Also many ISPs notoriously close various ports randomly. Port triggering may serve purposes in some cases. This is not exactly an answer to your problem, I know. Take this as a general purpose comment on the port forwarding problem. I am not an expert in the field. Please consider my comments very general purpose.

1
  • Thank you for your contribution.
    – Coke
    Commented Apr 6, 2020 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .