SSH connection hangs with packet loss

I am trying to connect to a server at work using ssh after having established an openvpn connection.

This worked perfectly for months up till yesterday. Since of today the ssh user@server just hangs.

A verbose output gives me

OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to *** [***] port 22.
debug1: Connection established.
debug1: identity file ~/.ssh/id_rsa type -1
debug1: identity file ~/.ssh/id_rsa-cert type -1
debug1: identity file ~/.ssh/id_dsa type -1
debug1: identity file ~/.ssh/id_dsa-cert type -1
debug1: identity file ~/.ssh/id_ecdsa type -1
debug1: identity file ~/.ssh/id_ecdsa-cert type -1

And then nothing happens....

Nothing changed in the configuration. I actually succesfully connected just the other day.

I also pinged the server to be sure he was not down. And there I noticed I get a huge packet loss (order 70%)

Any idea what is going wrong?


Solution 1:

The reason is not the SSH server/client connection but the connection itself. If you are seeing a huge packet loss you should check:

  1. The physical cables, routers, switches, etc. Change everything. If the packet loss is only when you ping the server, then check the server physical installation
  2. Check the server workload, maybe is hanged. Restart the server if necessary.

Solution 2:

In case the connection issues aren't on your side and you need to get some work done, mosh (man page, home page) handles flaky connections way better than plain SSH can. Once installed on both machines, you can use it just like ssh.