What the message looks like
ssh: connect to host 203.0.113.10 port 22: Connection timed outCommon causes
- A firewall or cloud security group drops port 22.
- Wrong IP address or hostname, or DNS points to an old server.
- The server is down, frozen or has lost its network.
- SSH listens on another port, or only on a different interface.
- Your IP was banned by fail2ban or a similar tool, or your network blocks outgoing port 22.
Check
- See where the connection stops
ssh -v user@server.example.com - Is the port reachable? (5 second timeout)
nc -vz -w 5 server.example.com 22 - Does the name resolve to the address you expect?
- On the server (via console): is SSH listening?
ss -ltnp | grep sshd
Fix
- Open the port in the firewall:
ufw allow 22/tcp, or in the cloud provider's security group. - Use the right port if you changed it:
ssh -p 2222 user@host. - If fail2ban banned you, unban the address:
fail2ban-client set sshd unbanip 198.51.100.7. - Check the server in the provider's console: is it running, does it have network?
- Try from another network (a mobile hotspot) to rule out a block on your side.
Typical scenario
At your provider you created a new cloud VM and opened the security group only for 80 and 443. ssh -v user@203.0.113.10 hangs for minutes after "Connecting to … port 22" and ends with "Connection timed out". Not even a banner arrives. First test with nc -vz 203.0.113.10 22 from a second network whether the port is reachable, then look at the provider's firewall rules.
FAQ
What is the difference between timed out and refused?
Timed out means no answer came back, typically a firewall that silently drops the traffic, or a machine that is down. Refused means the machine answered and said nothing is listening on that port.
Could this be a brute-force protection?
Yes. After several failed logins, tools like fail2ban block your address. Check the jail status from the server console.
Does a working ping mean SSH is reachable?
No. Ping uses ICMP, SSH needs TCP on port 22, and a firewall can allow one and drop the other. Conversely, some providers block ping but let SSH through, so a missing ping proves nothing.
Why does it work from a mobile hotspot but not from the office?
Then the block is usually on your side: a corporate firewall dropping outgoing port 22, or a rule on the server that only allows your old public IP. Compare your current public address with the allowed sources.
What do I do if I locked myself out with a firewall rule?
Use the provider's console or rescue mode to fix the rule. In future, allow SSH before running ufw enable and keep a second session open until you have tested the new access.