You need to enable
In your client ssh_config (e.g. /etc/ssh/ssh_config or in ~/.ssh/config) and your destination SSH server running OpenSSH (e.g. /etc/ssh/sshd_config).
So every time your connection idles, OpenSSH sends some dummy packet to your destination host
Login to the server and run this:
# nano /etc/ssh/sshd_config
Uncomment this line
Then, restart ssh
# service sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ]
Sets idle timeout limit to time in seconds (s or nothing afternumber),
in minutes (m), in hours (h), in days (d), or in weeks (w).If the
connection have been idle (all channels) for that long time thechild
process is killed with SIGHUP, and connection is closed down.
ClientAliveInterval The server will wait 60 seconds before sending a null packet to the client to keep the connection alive
TCPKeepAlive Is there to ensure that certain firewalls don’t drop idle connections.
ClientAliveCountMax Server will send alive messages to the client even though it has not received any message back from the client.