port 22: Connection timed out

Today, I have established a droplet succesfully. The information: 512MB Ram 20GB SSD Disk San Francisco 1 CentOS 6.7 x64


However, when I try ssh root@ The error occurred: ssh: connect to host port 22: Connection timed out

Also, when I try ping It failed to connect to the server

But, I can connect to the gateway. ping is successful.

How can I solve this problem.

Thanks very much.

Best wishes



I have the same issue from a windows 10 computer. since it is a corporate computer, even though I am able to access websites and all, I am wondering if it is an issue with the windows side where something is disabled… or is it something on the droplet side which I can tweak or tinker to be able to access console (as well as through cygqin ssh) any ideas appreciated thanks jviyer

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Not sure if anyone needs anymore discussion on this, but I faced the same problem and got a lead from this post to fix. Yes, I think port was blocked. When I did sudo ufw allow 22 from console and tried to connect, I was able to connect


Login to your digital ocean account and go to launch console under access in your droplet. then type in your username and then your password.

Once you are logged in type $ sudo ufw allow 22

Try again in your terminal and it will work. :)

Hello! I had the same problem and it persists even after enabling port 22 in the firewall.

In my case (I estimate that for having too many ssh keys) I had to initialize the ssh agent and add the key “manually”. And it worked.

The steps I followed were:

To initialize the ssh agent

eval $ (ssh-agent -s)

To add the key

ssh-add -i ~ / .ssh / key

— If your password has a paraphrase, you should insert it — In my case, the key was in the ~ / .ssh / directory and was called “key”, check the names of your files and replace them.

To enter the Droplet via ssh

ssh -i ~ / .ssh / key root @ droplet-ip

— It is important to add the argument “-i” to the ssh command and tell it the full path where your key is located — Then you can indicate with which user and to which IP you will connect

I hope it works for you too.


sudo ufw allow 22 

did it for me

I started experiencing this issue after enabling ufw using the command

sudo ufw enable

I had to disable ufw using the command:

sudo ufw disable

That’s all.

I hope this helps

thanks a lot for : run $sudo ufw allow 22

The problem is MTU related try setting your client’s network card mtu smaller for example

ifconfig enp10s0 mtu 1000 (linux)

I have a few questions.

What operating system is your server? Are you able to log in via web console with DigitalOcean? Did you make any firewall rules - If so you may have blocked 22.

You can always try stopping the firewall service to see if that allows connection via SSH. If so you know you’ll have to add a rule.

Did you install any software? Check if you got a firewall running like ufw, iptables,Gufw etc. Maybe the port is blocked, also check your pc if it is allowing outgoing ssh connections (port 22)

Is this a fresh droplet or one you’ve connect to before?