[opensuse] ssh keep alive?
Hi, I don't have this problem on the LAN, but when connecting via Internet to my home server, I find after some time of no use that the terminal does not respond any more. I have to "kill ssh" to recover that terminal. I suppose I have to use a keep alive option. The manual has some: -o option ServerAliveInterval ServerAliveCountMax TCPKeepAlive Which one? -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))
Am 19.02.2017 um 22:19 schrieb Carlos E. R.:
Hi,
I don't have this problem on the LAN, but when connecting via Internet to my home server, I find after some time of no use that the terminal does not respond any more. I have to "kill ssh" to recover that terminal.
I suppose I have to use a keep alive option. The manual has some:
-o option
ServerAliveInterval ServerAliveCountMax
TCPKeepAlive
Which one?
Carlos, in the output of "man ssh_config" you find the meaning of those parameters. ServerAliveInterval Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server. ServerAliveCountMax Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any messages back from the server. If this threshold is reached while server alive messages are being sent, ssh will disconnect from the server, terminating the session. It is important to note that the use of server alive messages is very different from TCPKeepAlive (below). The server alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The server alive mechanism is valuable when the client or server depend on knowing when a connection has become inactive. The default value is 3. If, for example, ServerAliveInterval (see below) is set to 15 and ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after approximately 45 seconds. TCPKeepAlive Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2017-02-19 23:37, Werner Flamme wrote:
Am 19.02.2017 um 22:19 schrieb Carlos E. R.:
Hi,
I don't have this problem on the LAN, but when connecting via Internet to my home server, I find after some time of no use that the terminal does not respond any more. I have to "kill ssh" to recover that terminal.
I suppose I have to use a keep alive option. The manual has some:
-o option
ServerAliveInterval ServerAliveCountMax
TCPKeepAlive
Which one?
Carlos,
in the output of "man ssh_config" you find the meaning of those parameters.
Ah, didn't think of that manual. Thanks :-)
ServerAliveInterval Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server.
ServerAliveCountMax Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any messages back from the server. If this threshold is reached while server alive messages are being sent, ssh will disconnect from the server, terminating the session. It is important to note that the use of server alive messages is very different from TCPKeepAlive (below). The server alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The server alive mechanism is valuable when the client or server depend on knowing when a connection has become inactive.
The default value is 3. If, for example, ServerAliveInterval (see below) is set to 15 and ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after approximately 45 seconds.
TCPKeepAlive Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying.
Well, I tried "ssh -o ServerAliveInterval=60 ..." and it appears to do the trick. I will add that setting in the .ssh/config file: host myhost.domain Port someport ServerAliveInterval 60 and see what happens... [...] Yes, it worked. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))
On 02/19/2017 05:31 PM, Carlos E. R. wrote:
Well, I tried "ssh -o ServerAliveInterval=60 ..." and it appears to do the trick. I will add that setting in the .ssh/config file:
host myhost.domain Port someport ServerAliveInterval 60
and see what happens...
Let me guess, one (or both) end of this is ADSL ? Got to feed them some packets once in a while. Had the same problem with our Australian Office some years ago. -- After all is said and done, more is said than done.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 El 2017-02-20 a las 17:20 -0800, John Andersen escribió:
On 02/19/2017 05:31 PM, Carlos E. R. wrote:
Well, I tried "ssh -o ServerAliveInterval=60 ..." and it appears to do the trick. I will add that setting in the .ssh/config file:
host myhost.domain Port someport ServerAliveInterval 60
and see what happens...
Let me guess, one (or both) end of this is ADSL ?
Got to feed them some packets once in a while. Had the same problem with our Australian Office some years ago.
Near guess :-) It is fiber to the block, coax to the home on the client side, and fiber to the home on the server side. Not ADSL. I suspect the router on the receiving end, may forget about the NAT assigned to the connection, times out. Next packet doesn't reach the server. Thus needs something transmitting to keep the connection up. Now it seems to work reliably :-) - -- Cheers Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlirl/4ACgkQja8UbcUWM1yTDAEAl1j4xHxLkEroRrvDQGyd3fpU iGf23D9TbsmI7nQip0EBAJK3p+ugdYzwK061wDD+2LuBH7IgZ53D0aVDT+WVLOEU =VSgi -----END PGP SIGNATURE-----
participants (3)
-
Carlos E. R.
-
John Andersen
-
Werner Flamme