连接中断问题修改 /etc/ssh/sshd_config
ClientAliveInterval 60
ClientAliveCountMax 3
service sshd restart
另外有时候会遇到连接缓慢的问题查找资料可能需要修改
GSSAPIAuthentication
UseDNS
另外关于 tcpkeepAlive 直接摘录如下。
TCPKeepAlive
operates on the TCP layer. It sends an empty TCP ACK packet. Firewalls can be configured to ignore these packets, so if you go through a firewall that drops idle connections, these may not keep the connection alive.ServerAliveInterval
operates on the ssh layer. It will actually send data through ssh, so the TCP packet has encrypted data in and a firewall cant tell if its a keepalive, or a legitimate packet, so these work better.