You can do it on client side or server side.
Edit /etc/ssh/ssh_config
, and add the following line to the end of the file:
ClientAliveInterval 60
Edit /etc/ssh/sshd_config
,and add the following line to the end of the file:
ServerAliveInterval 60
after edit the file, restart sshd service:
systemctl restart ssh