SSH and NAT Disconnects.

Have you ever noticed that your ssh sessions will disconnect if idle to long, no matter what you set the idle time out and keep alive settings at? This can be quite annoying when you are trying to administer a few boxes and you are working between different ssh sessions in different windows..

This is usually the result of a packet filter or NAT device timing out your TCP connection due to inactivity. You can enable ClientAliveInterval in the server's sshd_config, or enable ServerAliveInterval in the client's ssh_config (the latter is available in OpenSSH 3.8 and newer).

Enabling either option and setting the interval for less than the time it takes to time out your session will ensure that the connection is kept "fresh" in the device's connection table.

Here is what I use in my sshd_conf

# added 10/17/06  Possible fix for nat time out disconnects.
ClientAliveInterval  60
ClientAliveCountMax  30

This has worked well for me over the past couple years on my ubuntu boxes and my redhat boxes..

-Steve

Powered by Drupal - Design by artinet