Red Hat Bugzilla – Bug 421251
Prevent disconnections by enabling ServerAliveInterval by default
Last modified: 2008-04-04 13:32:30 EDT
On the modern Internet, rarely do you get a "clean" TCP connection. Devices
between you and the server, like firewalls, NAT, load balancers, and so on, do
various things to your TCP connections. Unfortunately, one of the things these
devices often take the liberty to do is to disconnect "inactive" connections -
where inactive often means just a few minutes of inactivities.
The result is that nowadays, in most situations I came across, SSH connections
rarely survive more than a few minutes of inactivity. Did you stop typing for a
few minutes? Next time you try to type in that window, you'll realize it is gone.
Luckily, OpenSSH (since version 3.8) has exactly the option to fix this problem!
Put "ServerAliveInterval 120" (for example) in the ssh client config file, and
the client will send a do-nothing message every 2 minutes and will allow the
connection to keep working for hours.
I think that in today's Internet, like I explained above, most people will face
this problem, and this option should be enabled by default /etc/ssh/ssh_config
which fedora distributes. I can't think of any reason why this should not be the
By the way, if you don't want the "ServerAliveInterval 120" to also cause a
disconnection after 6 minutes of network inavailability (3 failed message
sending), you can increase ServerAliveCountMax to something higher than 3
(perhaps much higher than 3). See the ssh_config(1) manual for more information.