In sshd config you can specify the option TCPKeepAlive yes. These Pakets are not encrypted so the could be spoofed.
With the options
ClientAliveInterval
ClientAliveCountMax
ServerAliveInterval
ServerAliveCountMax
you can specify the interval of the keep alive packets and the timeout (*CountMax) after which the connection is dropped. See also here What options `ServerAliveInterval` and `ClientAliveInterval` in sshd_config exactly do?
With TCPKeepAlive you can only enable it.
So what is the interval for the TCP-Pakets beeing sent?
After how many unsuccessful packets the connection is regarded broken and closed? Since default values are:
#TCPKeepAlive yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
As far as I understand: The detection and closing of broken/inactive connections solely depends on the TCPKeepAlive option in the default configuration. So it is quite important to know that values.