Open sshd configuration file
sudo vim /etc/ssh/sshd_config
Find the following two lines
#ClientAliveInterval 0
#ClientAliveCountMax 3
Uncomment
ClientAliveInterval 30
ClientAliveCountMax 86400
centos7 restart sshd
sudo systemctl restart sshd.service
Start sshd
sudo systemctl start sshd.service
Set boot from boot
sudo systemctl enable sshd.service