Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
    
Can you capture on (I) and on (R1)? Which of those is really sending the RST packets? –  joechip Jul 15 '11 at 4:07
add comment

migrated from stackoverflow.com Jul 15 '11 at 3:40

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

2 Answers

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

ServerAliveInterval 60
share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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