0

I installed openssh-server. I am able to ssh into the server via my ehternet local network, I can ssh from the local host. I have set up port forwarding on my router. I have run 'sudo ufw allow 22/tcp' to ensure my port 22 is open.

But everytime I try to connect remotely, i.e. ssh my_server_ip, I get the error: connect to host my_server_ip port 22: Operation timed out

I have no idea how to fix this.

When I use a port scanning service online my port 22 is open, and I have told the router to do port forwarding to the server for port 22.

  • 1
    Are you connecting from the same LAN that the server is on but using your outside IP? Or are you remote from the network, Some routers have a problem with the former. – squareborg Jun 8 '14 at 22:35
  • OMG!. It was the former. Just used 3G connection and tried again. Worked first time! Thanks so much, spent way too many hours trying to make that work. – Will Beauchamp Jun 8 '14 at 22:44
  • Okay I added it as an answer. – squareborg Jun 8 '14 at 22:49
1

Some routers have a problem traversing NAT when trying to connect to a server, using its external IP, but on the same LAN. It should work just fine from an outside network.

  • You may be able to get around the NAT problem by mapping port 22 to the server's LAN IP. The method of doing this varies depending on your router. If you have more than one server on your LAN you will need to configure each one to use a different port for SSH (e.g. 2222) and map each port to the specific server. When connecting from a Linux machine use ssh [user]@[WAN IP]:[port] to specify which server you are trying to connect to. – Leah96xxx Mar 16 '20 at 11:18
  • Of course, using the method I mentioned above, you will need to allow these ports through your router's firewall. You will also need to change your server's firewalls from port 22 to whichever port you are using. – Leah96xxx Mar 16 '20 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.