SSH: can connect to computers on local network but cant connect remotely

2

1

I have 3 computers running ssh server on them:

  • PC1 is running Cygwin on Windows
  • PC2 is also running Cygwin on Windows
  • PC3 is running Linux

and they are on the same network connected to same router.

I can connect to all 3 of these locally. Funny thing is I can't connect to PC2 and PC3 remotely (but I can access PC1 remotely). I forwarded the ports of PC1, PC2 and PC3 in same way and used a custom port.

This is the same error message I get when trying to connect to PC2 and PC3 remotely:

$ ssh -l username username@externalIP -vvv
Reading configuration data /etc/ssh_config
ssh_connect: needpriv 0
Connecting to externalIP [externalIP] port X.
connect to address externalIP port X: Connection timed out
ssh: connect to host externalIP port X: Connection timed out

I can access PC2 remotely using remote desktop

user299028

Posted 2014-02-10T21:25:23.717

Reputation: 21

1I may have this wrong but a possible explanation that springs to mind is the port forwarding on your NAT router forwards to the IPs of the computers you find you are able to reach remotely, but doesn't forward to the others. You could run SSH on different ports and do port forwarding on your router separately for each computer. – barlop – 2014-02-10T21:35:50.833

Yes that fixed it! I used different ssh ports for both computers and it works now. Thanks. Any idea why the router did forward to these pcs? – user299028 – 2014-02-10T22:01:31.107

1It's not clear from your writeup, but the key would be you would need different external ports for each system. So port 2201 could go to port 22 of PC1, 2202 to PC2, etc. – ernie – 2014-02-10T22:10:19.020

Typing mistaking, I meant to say why the router didnt forward these ports – user299028 – 2014-02-11T07:18:51.073

Answers

0

Edit: The solution I was told above, was to change the port number of both PC2 and PC3. This is so that they dont use the same ssh port as each other and it works.

user299028

Posted 2014-02-10T21:25:23.717

Reputation: 21