KEEPALIVE timeout? default taken from server, or other? length settable?

Darren Tucker dtucker at
Fri Apr 24 09:55:19 AEST 2015

On Fri, Apr 24, 2015 at 7:40 AM, L. A. Walsh <openssh at> wrote:

> I see options for turning keepalive on or off, in both
> the server and client config files.

There are 2 types of keepalives: the TCP level one (TCPKeepAlive) and
application level keepalives (ServerAliveInterval+ServerAliveCountMax in
the client, ClientAliveInterval+ClientAliveCountMax).

Does one or the other take precendence?

The're independent.  If they're enabled on a particular end then it'll send
the keepalive and act on the presence (or not) of the response from the
other end.

> If it is "on", does it use the OS's default values?

TCPKeepAlive: yes.  The others: no.

Or, if not, are the values settable?

TCPKeepAlive: it's a system-wide setting.  The others: yes.

> I am running a win-client to OpenSuse/linux server that
> has a default TCP_KEEPALIVE set to the linux default of 2 hours.

On Linux that's usually the net.ipv4.tcp_keepalive_time sysctl or maybe the
equivalent under /proc or /sys.

> I don't know if the Win client has its own KEEPALIVE value
> (or where I'd set it).

Either way, is there a way to change the default value?
> Right now, from the docs (6.2p2-3.1.2.x86_64), it looks
> like if I turn off keepalive on Clnt+Serv, then the default on
> the server would be used (2 hours?) -- or would some default
> on Windows kill it sooner?

That's a question for the author of the client software.

> (which is why I want to find out if there are KeepAlive vals
> on both ends -- and if so, how to change them globally and/or
> per openssh-config).

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list