大网数据广告活动
服务器运维问答

SSH connection - after some time I can't type anything

· 52CE 我爱测

This keeps hapenning on which ever server I am connected to. I type: ssh user@server I log in, everything works for a couple of minutes. But after some time, possibly when I switch to other programmes (browser, ftp client etc) wh…

问题原文

原帖链接 · Томица Кораћ · CC BY-SA 3.0

This keeps hapenning on which ever server I am connected to. I type:

ssh user@server

I log in, everything works for a couple of minutes. But after some time, possibly when I switch to other programmes (browser, ftp client etc) when I try to type anything back in the terminal, the cursor stops blinking while I type, but nothing actually gets typed. I can't execute any command, and all I can do is close the terminal window, reopen it and reconnect.

If it's of any importance, I'm running Ubuntu 12.04 on my local machine.

已采纳解答

原帖链接 · Kenster · CC BY-SA 3.0

You have a NAT router or a similar stateful firewall between your client and the server. When you opened the TCP session, the firewall remembered that a TCP connection was created between your client port and the server port. As long as the firewall remembers the connection, it will continue passing packets between the client and the server.

The session "breaks" because the firewall forgets about the connection and stops passing packets through. The firewall may forget about the connection because it has a timeout on idle connections. Or it could forget because it has a limited amount of memory and too many new connections were being created for it to remember all of them.

ssh has some options to work around this by sending periodic "keep-alive" packets when the connection is idle. Look at the TCPKeepAlive, ServerAliveInterval, and ServerAliveCountMax options.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。