ssh keepalive
From thelinuxwiki
server side
enable in sshd_config
TCPKeepAlive yes
client side
create config file (if it doesn't already exist) in the ssh user ~/.ssh/ directory with the following lines
Host * ServerAliveInterval 180 ServerAliveCountMax 2