1

I am using Ubuntu 22.04 version and I am trying to ssh to the VM Linux server (of Azure). I succeeded in doing so from another computer over port 22 and now I am trying from the ubuntu 22.04 computer. What I have tried:

  1. I tried using the methods mentioned here https://serverfault.com/questions/371554/ssh-takes-a-long-time-to-connect-on-some-hosts without success
  2. I tried using direct IP public instead of the VM address, didn't work.
  3. Reinstall of ssh lib didn't help either.
  4. According to this thread https://stackoverflow.com/questions/12172188/ssh-server-connect-to-host-xxx-port-22-connection-timed-out-on-linux-ubuntu also, it doesn't seem to be a problem of connection or DNS problem

I ran ssh -vvv usr@test111-huji.eastus.cloudapp.azure.com and got this log:

OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/user/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/user/.ssh/known_hosts2'
debug2: resolving "test111-huji.eastus.cloudapp.azure.com" port 22
debug3: resolve_host: lookup test111-huji.eastus.cloudapp.azure.com:22
debug3: ssh_connect_direct: entering
debug1: Connecting to test111-huji.eastus.cloudapp.azure.com [20.106.142.77] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: connect to address 20.106.142.77 port 22: Connection timed out
ssh: connect to host test111-huji.eastus.cloudapp.azure.com port 22: Connection timed out
1
  • 1
    Is port 22 open in Azure firewall for the VM?
    – vidarlo
    Jun 21 at 8:04

2 Answers 2

1

I was having the same issue and I found that it was an issue related with how my router manages Quality-of-Service (QoS). To check if it's also your case, first try adding the the option -o IPQoS=none to your SSH call:

ssh -o IPQoS=none -vvv usr@test111-huji.eastus.cloudapp.azure.com

If it works, you can make this option the default by adding this line to your /etc/ssh/ssh_config:

    IPQoS none

No reboot needed.

1
  • What kind of QoS is that which blocks some types of connections (here ssh) altogether? That's severely broken...
    – raj
    Jul 13 at 21:43
0
Connecting to test111-huji.eastus.cloudapp.azure.com [20.106.142.77] port 22.

It is not a DNS problem, but it does not convert the host to the IP.

It could be that the ip range you are trying to access from is not allowed by fail2ban or other firewall or iptables rules.

Access from another PC, and temporarily the ufw or fail2ban service, and check from your pc, if you can connect or not

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.