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