Zaixu
By:
Zaixu

port 22: Connection timed out

August 24, 2015 25.3k views
Configuration Management CentOS

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

Gateway: 162.243.152.1

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

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

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

How can I solve this problem.

Thanks very much.

Best wishes

Zaixu

1 comment
  • 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

6 Answers

You can check if your ssh service is running on your droplet by going to the Console Access
Also check your ssh config if you are allowed to login as root, and if you made a ssh key at the creating, you need to use that. For more information check here

by Justin Ellingwood
SSH is an important tool used for administering remote Linux and Unix-like computers. In this guide, we will discuss the basic usage of this utility and how to configure your SSH environment.
  • I think it is not the problem of ssh, since I cannot ping 162.243.159.46 successfully.
    Also, when I go to console access, the black screen does not appear.
    I was so confused.

  • Dear,

    I have entered the console access, and input the command 'ps -ef | grep sshd'.
    The output is root 945 .... /user/sbin/sshd
    So, the ssh service is running on my droplet.

    I can login as root, and I haven't made a ssh key.

    In fact, I have successfully ssh to the server for three times, but the connection is failed soon.

    Can you give me some help.

    Best wishes

    Zaixu

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

  • Dear,

    Yeah, it's a fresh droplet set up two day ago.

    In fact, I have successfully ssh to the server for three times, but the connection failed soon.

    And now, I cannot connect to it any more.

    I have tried power off the server and then power on, or reboot the server through console access, but I still cannot connect to the server.

    Can you give me some help.

    Best wishes

    Zaixu

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)

  • I have destroyed the droplet and then rebuild it.
    This time, I use New York 3 rather than San Francisco.
    Everything is OK now, although I don't why the problem is fixed.

    Thanks very much.
    You are so nice.

    Wishes you all the best.

    Zaixu

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.

  • I have destroyed the droplet and then rebuild it.
    This time, I use New York 3 rather than San Francisco.
    Everything is OK now, although I don't why the problem is fixed.

    Thanks very much.
    You are so nice.

    Wishes you all the best.

    Zaixu

  • I think you had a firewall rule blocking it. The new droplet wouldnt have them.

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

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

ifconfig enp10s0 mtu 1000
(linux)

Have another answer? Share your knowledge.