Connection Timeout for ssh connection depending to the ip location?

17,846

Solution 1

This sounds like a firewall problem to me. Try using ssh with the -v flag for debugging output. This will give you a better clue as to what the problem may be. Also try to telnet to your ssh server on port 22 like this:

telnet yourserver 22

You should get a response back with the ssh version number.

Solution 2

That sounds like a firewall or proxy block on that specific port is in place. Try tcptraceroute, it should help pinpoint where you are being blocked.

tcptraceroute serveraddress 22

(Assuming the ssh server is on standard port 22.)

Additionally use the ssh switch -vvv and examine the output. Pipe the output through tee, because there will be a lot.

Be careful if you post the output from -vvv. It can contain things you don't want public.

The isp may be blocking, or the country may have blocking rules and laws. My answer is predicated on this being legal in the jurisdiction you are in.

Share:
17,846

Related videos on Youtube

Fran b
Author by

Fran b

Updated on September 18, 2022

Comments

  • Fran b
    Fran b almost 2 years

    I have a machine where I can connect it using ssh from different networks. But when I have moved to other country I have not be able to connect it. What may be the cause?

    I am able to ping the server but I get an error time out trying to do an ssh connection.

    UPDATE 1:

    Traceroute

      1     1 ms     1 ms     1 ms  <ip>
      2     5 ms     1 ms     5 ms  192.168.10.1
      3     5 ms     4 ms     6 ms  85.88.129.209
      4     5 ms     4 ms     4 ms  85.88.144.97
      5    15 ms    15 ms    17 ms  te0-3-0-0-pr1.MAD.router.colt.net [212.74.87.17]
      6    17 ms    14 ms    12 ms  uni2-1.espanix.net [193.149.1.12]
      7     *        *        *     Time out.
      8     *        *        *     Time out.
      9     *        *        *     Time out.
     10     *        *        *     Time out.
     11     *        *        *     Time out.
     12    41 ms    43 ms    38 ms  <my_ip>
    

    Telnet:

    Connecting to <ip>... It cannot open connection to host on port 22. Connection error.
    

    SSh -v:

    Event Log: Writing new session log (SSH raw data mode) to file: file.log 
    Event Log: Looking up host "<ip>" 
    Event Log: Connecting to <ip> port 22 
    Event Log: Failed to connect to <ip>: Network error: Connection timed out 
    Event Log: Network error: Connection timed out
    
    • Run CMD
      Run CMD about 9 years
      Since it's a bit unlikely that ssh connections are suppressed in the cross-country scenario altogether (think e-commerce) you should start to look for other causes. Is the machine behind a router, is the port even forwarded, does your new network block ssh, you name it.
  • Fran b
    Fran b about 9 years
    Connecting to <ip>... It cannot open connection to host on port 22. Connection error. ssh log: Event Log: Writing new session log (SSH raw data mode) to file: file.log Event Log: Looking up host "<ip>" Event Log: Connecting to <ip> port 22 Event Log: Failed to connect to <ip>: Network error: Connection timed out Event Log: Network error: Connection timed out
  • Raza
    Raza almost 5 years
    Thank you. I figured it out. The server wasn't blocking the port, but it was one of the router blocking the port.
  • Admin
    Admin about 2 years
    I got this error telnet: Unable to connect to remote host: Connection timed out the other PC on my home network wifi router and sshd are running on port 22 but I cannot connect to it.
  • Admin
    Admin about 2 years
    I have same issue I'm using my home 4g wifi router, could it's blocking these ports even sshd running on the other PC.