我有一台运行 Ubuntu 服务器和 Plex 的笔记本电脑(服务器运行在 WiFi(2.4 GHz)上)。当通过 ssh 进入服务器时,它通常可以正常工作,但随机地(例如 40 分钟后)它会显示主机关闭,尽管笔记本电脑仍在运行,我必须重新启动服务器才能再次使用 ssh。
*编辑-我注意到一种模式,这通常发生在我通过键入 exit 断开 ssh 连接时,10 分钟或更长时间后它显示主机关闭……等等,我能做的唯一解决方案是运行 htop 或任何其他命令来阻止它断开连接。
onlysaikihere@hub: $ client_loop: ssh_packet_write_poll: Connection to 192.168.0.145 port 22: Host is down
sahishnukumar@Sahishnu-kumar ~ % ssh onlysaikihere0192.168.0.145
ssh: connect to host 192.168.0.145 port 22: Host is down
sahishnukumar@Sahishnu-kumar ~ % ssh [email protected]
ssh: connect to host 192.168.0.145 port 22: Host is down
sahishnukumar@Sahishnu-kumar ~ % ssh onlysaikihere0192.168.0.145
ATTA
AC
sahishnukumar@Sahishnu-kumar
~ % ssh [email protected]
使用 mosh 给出以下输出
sahishnukumar@Sahishnu-kumar ~ % mosh [email protected]
/opt/homebrew/bin/mosh: Could not connect to 192.168.0.145, last tried 192.168.0.145: Host is down
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
/opt/homebrew/bin/mosh: Did not find remote IP address (is SSH ProxyCommand disabled?).
sahishnukumar@Sahishnu-kumar ~ %
plex 服务器也停止工作
格式化笔记本电脑并修复问题
答案1
尝试设置 SSH 以进行常规 ping:
Host *
ServerAliveInterval 60
将此添加到您的顶部~/.ssh/config
,会话就不会再丢失。默认的较大间隔不会阻止这种情况发生。