使用 PuTTY 的反向 SSH 隧道不起作用

使用 PuTTY 的反向 SSH 隧道不起作用

在我的本地机器上(NAT 后面),如果我访问,192.168.154.129:80我会看到我的网络服务器。

我的远程机器有 IP 151.xx.xxx.xxx

我希望所有到的网络流量都可以看到我在本地网络服务器上151.xx.xxx.xxx:1025看到的内容。192.168.154.129:80

因此,我设置了一个反向 SSH 隧道,如下所述:https://serverfault.com/questions/321132/how-to-start-a-reverse-tunnel-with-putty

...然后登录并连接。

但是,如果我浏览,151.xx.xxx.xxx:1025连接将返回ERR_CONNECTION_TIMED_OUT。为什么?

151.xx.xxx.xxx:80正确托管远程 Web 服务器,并且我在端口上还有另一个8112,无需任何设置。我怀疑端口1025是否已关闭:我记得使用 CLI 很容易完成此操作(无需打开端口或防火墙)。

我认为我的 PuTTY 配置有问题,但不知道是什么。

2019-04-10 13:52:08 Connecting to 151.----- port 22
2019-04-10 13:52:08 We claim version: SSH-2.0-PuTTY_Release_0.70
2019-04-10 13:52:08 Server version: SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.12
2019-04-10 13:52:08 We believe remote version has SSH-2 channel request bug
2019-04-10 13:52:08 Using SSH protocol version 2
2019-04-10 13:52:08 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2019-04-10 13:52:08 Server also has ssh-ed25519/ecdsa-sha2-nistp256/ssh-dss host keys, but we don't know any of them
2019-04-10 13:52:08 Host key fingerprint is:
2019-04-10 13:52:08 ssh-rsa 2048 -----
2019-04-10 13:52:08 Initialised AES-256 SDCTR client->server encryption
2019-04-10 13:52:08 Initialised HMAC-SHA-256 client->server MAC algorithm
2019-04-10 13:52:08 Initialised AES-256 SDCTR server->client encryption
2019-04-10 13:52:08 Initialised HMAC-SHA-256 server->client MAC algorithm
2019-04-10 13:52:12 Sent password
2019-04-10 13:52:12 Access granted
2019-04-10 13:52:12 Opening session as main channel
2019-04-10 13:52:13 Opened main channel
2019-04-10 13:52:13 Requesting remote port 1025 forward to 192.168.154.129:80
2019-04-10 13:52:13 Remote port forwarding from 1025 enabled
2019-04-10 13:52:13 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2019-04-10 13:52:13 Started a shell/command

在此处输入图片描述

编辑:也尝试过这个

ssh -R 151.xxx.xxx.xxx:1025:127.0.0.1:80 [email protected]

没有 PuTTY,直接从本地 VM 开始。仍然无法工作。

编辑:已尝试使用不同的端口,8113

这有效,因为它将我重定向到192.168.154.129。然而,这是一个实际的重定向,这意味着它无法在我的网络之外工作。

2019-04-10 14:30:51 Received remote port :8113 open request from 37.xxx:34502
2019-04-10 14:30:51 Attempting to forward remote port to 192.168.154.129:80
2019-04-10 14:30:51 Forwarded port opened successfully
2019-04-10 14:30:53 Forwarded port closed

答案1

我认为您远程服务器上的防火墙阻止了您访问端口 1025 上的 Web 服务器的尝试。

反向隧道正在建立,但浏览器被防火墙拒绝。

建立隧道后解除端口阻塞,看看是否可以从远程服务器访问本地网络服务器。

相关内容