Cannot connect with ssh to a server: connection timed out
I have always used
ssh to connect to a server, then, suddenly, I can no longer connect to it.
$ ssh firstname.lastname@example.org ssh: connect to host server1.example.com port 22: Operation timed out
Note that this is happening only on a specific server, while I can still connect with ssh to the others.
What can I do?
The reasons can be:
- Wrong hostname or IP address
- Your local network (e.g. public network) does not allow ssh connections (try to connect to a different server to see if it works)
- Firewall rules set in your cloud provider network or a firewall in the remote server may block the connections, dropping all the packets before they reach the ssh daemon
- The remote machine is turned off
- The remote server is completely stuck and thus it cannot respond to the connection request (check the server CPU and other metrics from hypervisor or from a cloud dashboard and then restart the server)
You can also try to connect to the remote machine with a different method (e.g. from a browser console, offered by many cloud providers) instead of using ssh.