2

I’m using Amazon Linux,

[davea@mymachine ~]$ uname -a
Linux mymachine.mydomein.org 4.4.35-45.83.amzn1.x86_64 #1 SMP Wed Jul 27 22:37:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

In my /etc/ssh/sshd_config, I have no value set for “ServerAliveInterval”. In this answer — What options `ServerAliveInterval` and `ClientAliveInterval` in sshd_config exactly do? , they say “Setting a value of 0 (the default) will disable these features so your connection could drop if it is idle for too long”. What does that mean? In precise terms, what is the default amount of time the connection will stay alive if this parameter is committed? Assume that I have set a value of “1000000000000” on the client side.

3

The value for ServerAliveInterval means that "if no data has been received from the server within this time then send a NULL message to the server".

Similarly, ClientAliveInterval means that "if no data has been received from the client within this time then send a NULL message to the client".

The default values are typically 0 which means these functions are disabled.

The main use of this is to prevent intermediate routers and firewalls from thinking a session is idle, and dropping it. It has no real impact on an ssh server, itself.

For example, many home NATting routers will drop idle sessions after a period of time (the exact time depends on your router; I've seen values from 1 hour to over 21 days). By setting the ServerAliveInterval you fake out this idle timeout in the router by making sure there's always some traffic within the router interval.

  • So does setting "ServerAliveInterval" to a lower value (e.g. "5") mean that the connection will be kept alive every 5 seconds, even if the server is not sending back any data to the client? – Dave Sep 20 '16 at 16:33
  • If you set it to 5 then "if the server has not sent any data for 5 seconds then the client will send a NULL message to the server". So it will send a packet only if the server has not sent any data. – Stephen Harris Sep 20 '16 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.