I have a CentOS vm at work where I can SSH to it locally with it's local IP address, but when I am outside the office, I'm unable to SSH using it's external IP address. It is using OpenSSH. I have a feeling this is getting blocked at the network level because I get a connection refused message when trying to telnet to port 22 of the external IP. I wasn't the one who originally setup the vm. Could there be something else on the server that is causing this? Is there anything else I can test?

  • Can you access any other service on this VM using its external IP? Companies typically don't make their internal systems accessible from the public Internet. Usually you'd have to go through a VPN or some other gateway. – jjlin Mar 24 '14 at 17:03

If you can use it locally then SSHd is running and that is OK.

Most probably thing you need to do is to put a redirection of the port 22 (or some other port not used) from the router/gateway that is serving your office network to port 22 of the VM you want to connect to. This is most probably missing. (so a redirection from external IP:22, or even another port, to VM_IP:22)


The likely issue is a port forwarding rule either incorrectly specified or not in place. Ensure the following is accurate:

  • sudo vi /etc/ssh/sshd_config - Specify whichever port you wish to use in here
  • Enter your router and direct your specified port to the internal IP of your system. You can get this IP via ifconfig.

If this isn't the issue your network security could be blocking this as part of their standard rules, in which case speak to your system administrator.

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.