SSH Session Disconnection Issues

If you face SSH proxy sessions that frequently drop, an important setting to check in SSH clients like Putty or MobaXterm is “keepalive”. Adjusting this setting correctly can help maintain connection stability and prevent unexpected drops.

Understanding and Configuring Keepalive:

  1. Keepalive Function:
  • The keepalive feature sends null packets or “heartbeats” to the server at regular intervals to keep the connection alive. This is useful for preventing session timeouts that can occur if a connection is idle for an extended period of time.
  1. Checking the Keepalive Configuration:
  • Access the settings of your SSH tool, whether Putty or MobaXterm.

  • Navigate to the connection options and locate the keepalive setting.

  • In Putty, this option is usually found under “Connection → Seconds between keepalives”, and should be set to a non-zero number to enable keepalive.
    image

  • Moba

  1. Recommended Keepalive Value:
  • An appropriate keepalive value depends on the network environment and the policies of the server you are connecting to. A common range is 60 seconds, but you may need to adjust this based on your specific network requirements.
  1. Effect of Zero Value:
  • If the set keepalive value is zero, the keepalive feature is disabled. This can lead to disconnections if the session remains idle for periods that exceed the server timeout limits.
  1. Tuning and Testing:
  • Set keepalive to an appropriate value and save the settings. Test the SSH session to see if the connection stability has improved. Monitor whether these adjustments reduce or eliminate disconnections.