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?
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
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.