or how to Keep SSH Connections Alive…
Login to your server and open the /etc/ssh/ssh_config file.
sudo vim /etc/ssh/ssh_config
and add the following line to the end of the file:
This sends a null packet to the server every 60 seconds during periods of inactivity to keep the SSH connection alive.