SSH to a container from an external machine

0

Going slightly mad here. Trying to connect to my service from outside of my own network.

The situation is this:

  • ssh is running in a QNAP Docker container with ubuntu.
  • the container is using port forwarding, lets say Host:9999 to container:22.
  • I can then connect with Putty internally in my network using local ip or name.

So far all is good. Then I try to get access from outside:

  • router from internet provider is in bridge mode.
  • google wifi is configured with external port 9999 to NAS port 9999
  • "debugging" with "shields up":
    • port changes from 'stealth' to 'closed' when opening the port.
    • port changes from 'closed' to 'open' when starting the container.

...but somehow I still can't connect. Putty gives these errors:

  • when connecting from the remote machine: "Network error: connection timed out".
  • when using WAN ip from machine inside my network: "Network error: connection refused"

What am I not doing, or forgetting? Is there some ssh configuration I'm not aware of?

Stokke

Posted 2018-06-26T17:34:46.127

Reputation: 101

Answers

0

After some hours of rest I was able to solve this pretty quickly.

I came to the conclusion that I should test this on yet another network.

First I used ssh server test, which gave a positive result.

Then I proceeded to test it with a laptop via the phone, and there it also worked!

So,

  • When on the same network and using the public IP it would just not work (some kind of loop-back issue?).
  • The other test machine was on the company network, so it may have been that the firewall is blocking the connection.

Stokke

Posted 2018-06-26T17:34:46.127

Reputation: 101