友情提示:欢迎光临!本地已启用二维码api网关,地址是https://api.slogra.com

控制ssh连接时间(转)

post by rocdk890 / 2011-8-13 15:30 Saturday linux技术

公司刚换了成电信的网络,啥也不没有改过,连上服务器后,如果超过30s左右没有动,就自动断开
我想就此问题和大家探讨一下。
原因分析:a packet filter or NAT device timing out your TCP connection due to inactivity
一般由于我们的tcp连接没有活动而被firewall认为超时中断了会话。
Many NAT firewalls time out idle sessions after a certain period of time to keep their trunks clean. Sometimes the interval between session drops is 24 hours, but on many commodity firewalls, connections are killed after as little as 300 seconds.
解决方法:
#vi /etc/ssh/ssh_config
添加以下两行:
ServerAliveInterval 300
ServerAliveCountMax 2
不过在官方FAQ中看到ServerAliveInterval 只能在OpenSSH 3.8 and newer才能使用。

阅读全文>>

标签: ssh 断开 超时

评论(1) 引用(0) 浏览(8526)