ssh 隧道上的奇怪输出:输出失败;连接失败:连接超时;

ssh 隧道上的奇怪输出:输出失败;连接失败:连接超时;

我使用命令进行隧道传输,并将 Firefox Socks5 ip 设置为 127.0.0.1,将其端口设置为 9898。它运行成功,但在终端中输出有错误:ssh [email protected] -p 1234 -D 9898

channel 39: open failed: connect failed: Connection timed out
channel 41: open failed: connect failed: Connection timed out
channel 42: open failed: connect failed: Connection timed out
channel 43: open failed: connect failed: Connection timed out
channel 44: open failed: connect failed: Connection timed out

它会定期发生。这是什么?有问题吗?我该怎么办?

答案1

我遇到过类似的问题。如果您通过 ssh 与 Firefox 建立隧道,某些 http 连接可能会因服务器负载或配置不当而超时。当连接确实超时时,您会收到一条错误消息,如您所指出的。

您可以使用以下命令来隐藏这些消息

ssh [email protected] -p 1234 -D 9898 -q

来自手册页ssh(1)

 -q      Quiet mode.  Causes most warning and diagnostic messages to be sup-
         pressed.

抑制该消息将防止警告扰乱您的 ssh 或屏幕会话。

答案2

设置GatewayPortsyes并重试。

ssh -o 'GatewayPorts yes' [email protected] -p 1234 -D 9898

man ssh_config

 DynamicForward
         Specifies that a TCP port on the local machine be forwarded over the secure channel, and the application protocol
         is then used to determine where to connect to from the remote machine.

         The argument must be [bind_address:]port.  IPv6 addresses can be specified by enclosing addresses in square
         brackets.  By default, the local port is bound in accordance with the GatewayPorts setting.  However, an explicit
         bind_address may be used to bind the connection to a specific address.  The bind_address of “localhost” indicates
         that the listening port be bound for local use only, while an empty address or ‘*’ indicates that the port should
         be available from all interfaces.

         Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh(1) will act as a SOCKS server.  Multiple for‐
         wardings may be specified, and additional forwardings can be given on the command line.  Only the superuser can
         forward privileged ports.

 GatewayPorts
         Specifies whether remote hosts are allowed to connect to local forwarded ports.  By default, ssh(1) binds local
         port forwardings to the loopback address.  This prevents other remote hosts from connecting to forwarded ports.
         GatewayPorts can be used to specify that ssh should bind local port forwardings to the wildcard address, thus
         allowing remote hosts to connect to forwarded ports.  The argument must be “yes” or “no”.  The default is “no”.

相关内容