Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a SSH disconnection problem, disconnection occurs randomly. Sometimes, it works fine and other times I am frequently disconnected. After the disconnection I can again re-connect and continue to work.

Between the client to destination server ssh connectivity the flow is like this:

  Client (C1)   ->   Intermediate Server (I)   -> Destination Server (R1)
(Windows/Linux) -> (Linux + OpenVPN/IPTables)  ->         (Linux)    

Routing from Client C1 to destination server R1always happens through intermediate server I.

With Wireshark, I could see the RST packets I'm getting whenever I have a disconnection issue. Wireshark logs on C1 shows R1 is sending RST tcp pakets whenever I get a disconnection problem.

What could be causing this issue?

share|improve this question

migrated from Jul 15 '11 at 3:40

This question came from our site for professional and enthusiast programmers.

Can you capture on (I) and on (R1)? Which of those is really sending the RST packets? – joechip Jul 15 '11 at 4:07

Without delving into your particular problem, I've found these configuration lines have solved similar issues for me:

ClientAliveInterval 150
ClientAliveCountMax 10

It solves disconnects due to laggy or flapping links. I'm not saying these are perfect values, but they have worked for me so far.

share|improve this answer
I found that keepalives actually exacerbated disconnects on poor quality connections. The connection would drop because the keepalive failed. Without it, the period of congestion would go unnoticed as the link was not transmitting. In other situations where the firewall state table would eventually purge, keepalives helped the SSH connection remain in the state table. – Jodie C Jul 22 '11 at 18:30

Turn on keepalive. Add the following line to your .ssh/config:

ServerAliveInterval 60
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.