SSH timeouts

gboyce gboyce at badbelly.com
Thu Apr 6 14:53:34 EDT 2006


On Thu, 6 Apr 2006, Jerry Feldman wrote:

> On Wednesday 05 April 2006 11:37 am, gboyce wrote:
>
>> Have you tried decreasing /proc/sys/net/ipv4/tcp_keepalive_time?
>>
>> If it times out after 15 minutes, setting tcp_keepalive_time to 840 (14
>> minutes), could keep your connection alive.
> I changed the subject on this.
> From my desk at work (SuSE 10.0 retail/Linux COE) I can maintain a
> connection to home and the 2 BLU servers for days (I am currently connected
> for over 1 week to both). My connection at work goes through a proxy
> server.
>
> From home (SuSE 10.0 retail) via a Linksys WRT54GX4 I get disconnected after
> a fairly short time. My desktop uses a wired connection through the router.
>
> My settings in ~/.ssh are the same for both my home and my work systems
> except for known_hosts and authorized_keys (obviously).
> A while back, my connections to the Red Hat 7.1 host would remain up but my
> connection to the Fedora Core 2 host would time out after a few hours.
>
> One thing I have not had the time to do is to run ssh in verbose mode and
> see if I can track the problem. It's not really much more than a minor
> irritant since I use public key authentication.

SSHD's configuration file allows you to decide if you want to send 
keep-alive packets or not.  The default setting in the Linux kernel is to 
send keep-alive packets every 2 hours (I believe), which isn't frequent 
enough for some routers.

The only way I've found to adjust the keep-alive packet frequency is using 
/proc/sys/net/ipv4/tcp_keepalive_time, but that is a global setting rather 
than an application specific setting.  I've never seen adjusting it cause 
a problem though.

--
Greg



More information about the Discuss mailing list