ssh connection sporadically hangs

4

Whenever I ssh to elsewhere, the connection is fine for 1-10 minutes, then hangs: no error messages, just stops accepting input. I can exit (CR-~-.) but that's it. I can't find anything suspicious in my logs, or on the server I'm connecting to. Running ssh -vvv doesn't produce any messages around the time of disconnection, and connecting to sshd -dd doesn't say anything then either. I don't think it's a timeout, since it happens at irregular intervals: sometimes 1 minute, sometimes 10. I can tell exactly when it disconnects by running while $(sleep 1); do date; done on the remote computer.

Other notes:

  • All ssh connections I have running at once hang at the same time.
  • tcpdump shows me that when it hangs, it also stops sending or receiving packets.
  • netstat says that the connection is still ESTABLISHED, however.
  • It sounds a lot like this thread, but setting ServerAliveInterval to e.g. 30 instead results in the connection ending with Timeout, server not responding.
  • I'm running openssh 1:6.7p1-2 in Debian sid.

This may well be a problem with connectivity, not just ssh, but I'm trying to get debugging information, somehow.

How can I debug this?

petrelharp

Posted 2014-10-17T05:29:25.303

Reputation: 262

this sound like a firewall/router is blocking you. – Archemar – 2014-10-17T07:03:51.693

is there any way to tell? – petrelharp – 2014-10-17T15:46:33.780

Can you run tcpdump on the server ? This might give a clue about what's happening. I'd run it inside a screen session and detach it so it doesn't interfere / isn't affected by disconnects.

– lemonsqueeze – 2014-10-18T08:23:06.270

We had a similar problem which turned out to be caused by routing problems on a device with multiple VLANs and a physical connection. – zpon – 2018-02-13T12:49:03.617

No answers