“连接被拒绝”在ssh反向隧道上

我有一个单独的远程服务器与两个(服务器)客户端使用autossh -nNT -R ...连接autossh -nNT -R ...每个客户端都有一个单独的入站端口到远程服务器。 如果我重新启动客户端,尝试从本地PC重新连接时,会收到connection refused消息。

当我发出netstat | grep ssh netstat | grep ssh在远程服务器上,我看到多个“ESTABLISHED”ssh连接。 如果我然后在服务器上发出sudo pkill --signal HUP sshd ,然后尝试访问configuration为通过服务器(从本地PC)运行sudo pkill --signal HUP sshd的客户端,则连接成功。 我相信,当通过autosshbuild立的客户端连接中断时,无法重新build立连接。 起初我以为是sshd_config中的TCPKeepAlive / ClientAliveInterval设置可能会影响资源,所以我将它们评论和重启服务器,但我仍然在观察这种行为。

客户端上的/var/log/messages似乎被ssh exited with error status 255; restarting ssh connection refused条件存在时ssh exited with error status 255; restarting ssh

我能做些什么来确保客户端连接不再处于活动状态时,服务器会及时释放资源,以便客户端重新build立连接?

你有没有尝试改变Server / etc / ssh / sshd_config这些参数?

  • ClientAliveCountMax
  • ClientAliveInterval

http://man.openbsd.org/sshd_config

在这里输入图像说明