SSH 动态端口转发,“连接被拒绝”

cro*_*jer 8 ssh port-forwarding

我正在尝试按照以下命令通过远程计算机使用 openssh 进行动态端口转发:

ssh -D 6789 rohan@<remote_ip> -p <remote_port>
Run Code Online (Sandbox Code Playgroud)

正如我假设的那样,这应该在我的comp上设置一个socks服务器。

我可以使用它进行正常浏览,但无法连接到 IRC 或远程 ssh(通过代理链)。

我收到此错误:

channel 3: open failed: connect failed: Connection refused
Run Code Online (Sandbox Code Playgroud)

错误的高详细级别输出:

$ debug1: Connection to port 6789 forwarding to socks port 0 requested.
debug2: fd 9 setting TCP_NODELAY
debug2: fd 9 setting O_NONBLOCK
debug3: fd 9 is O_NONBLOCK
debug1: channel 3: new [dynamic-tcpip]
debug2: channel 3: pre_dynamic: have 0
debug2: channel 3: pre_dynamic: have 4
debug2: channel 3: decode socks5
debug2: channel 3: socks5 auth done
debug2: channel 3: pre_dynamic: need more
debug2: channel 3: pre_dynamic: have 0
debug2: channel 3: pre_dynamic: have 10
debug2: channel 3: decode socks5
debug2: channel 3: socks5 post auth
debug2: channel 3: dynamic request: socks5 host 4.2.2.2 port 53 command 1
debug3: Wrote 96 bytes for a total of 3335
channel 3: open failed: connect failed: Connection refused
debug2: channel 3: zombie
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 6789 for 4.2.2.2 port 53, connect from 127.0.0.1 port 33694, nchannels 4
debug3: channel 3: status: The following connections are open:
  #2 client-session (t4 r0 i0/0 o0/0 fd 6/7 cfd -1)

debug3: channel 3: close_fds r 9 w 9 e -1 c -1
Run Code Online (Sandbox Code Playgroud)

我也用谷歌搜索了这个,但找不到任何解决方案。

use*_*686 4

就这么简单:目标计算机(在本例中4.2.2.2)拒绝连接。

debug2: channel 3: dynamic request: socks5 host 4.2.2.2 port 53 command 1
channel 3: open failed: connect failed: Connection refused
debug1: channel 3: free: direct-tcpip: listening port 6789 for 4.2.2.2 port 53, connect from 127.0.0.1 port 33694, nchannels 4
Run Code Online (Sandbox Code Playgroud)

(我必须说,以这种方式通过 SOCKS 建立 DNS 隧道是非常不寻常的,尽管与您的问题无关。)

您是否能够使用交互式命令从服务器连接到(例如)IRC?(nc chat.freenode.net 6667irssi -c chat.freenode.net, 等等)。如果与多个不同服务器的连接失败,则可能是远程服务器上的防火墙问题。