Mat*_*att 5 ssh openssh tunnel ssh-tunnel
我想玩一个托管在端口 25565(我的世界!)上的游戏,但我的大学防火墙不允许这个端口。
我有一台运行 linux 的专用服务器离 uni 不远,所以我认为有一种方法可以通过它进行隧道传输(但我以前从未这样做过,并且没有隧道传输的知识/经验)
这可能会很慢,但总比不能玩要好。是否可以仅使用 SSH,还是需要其他客户端/服务器软件?我的服务器安装了 OpenSSH。此外,我用来玩游戏的计算机正在运行 Ubuntu。
我试过搜索,但似乎对不同类型的问题有很多不同的解决方案=/
小智 8
很简单,运行命令
ssh -L 25565:minecraftserverIp:25565 user@remotelinuxbox
Run Code Online (Sandbox Code Playgroud)
然后将服务器添加到您的 minecraft 客户端 localhost:25565
这将允许您通过 ssh 隧道连接到远程 minecraft 服务器。
为了更容易理解隧道机制,请观看这些草图。键入 ssh 隧道命令的机器称为“您的主机”。


当地的: -L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.
ssh -L sourcePort:forwardToHost:onPort connectToHost意思是:用 ssh 连接到connectToHost,并将所有连接尝试转发到机器上称为的本地 sourcePort端口onPort,该端口forwardToHost可以从connectToHost机器访问。
偏僻的: -R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.
ssh -R sourcePort:forwardToHost:onPort connectToHost表示:使用 ssh 连接到connectToHost,并将所有连接尝试转发到名为 的机器上的远程 sourcePort端口onPort,该端口forwardToHost可以从您的本地机器访问。
第二张图片代表您的场景。这remotehost是您运行 linux的专用服务器,离 uni 不远。这farawayhost是您想在其粉红色端口上连接到的被阻止的 minecraft 服务器25565。
ssh -L 12345:minecraftServerIP:25565 dedicatedServer
Run Code Online (Sandbox Code Playgroud)
绿色端口的端口号是12345。您现在可以通过连接到我的世界服务器
localhost:12345
Run Code Online (Sandbox Code Playgroud)
当然,您可以将绿色端口号更改为12345您想要的任何值。
最简单的方法是使用putty(客户端APP)。除了允许传出连接的防火墙规则之外,您不需要在远程端进行任何操作
设置:
这将在本地端口 25565 上创建一条通往远程站点上任何目标的隧道。这还假设您可以通过隧道建立 Minecraft 连接(您可能需要将 IE 设置设置为使用 SSH 隧道,因为游戏有时在无法获得连接时会使用此隧道)
如果默认情况下您无法为我的世界建立隧道,请使用代理上限之类的应用程序强制所有出站连接通过隧道。
| 归档时间: |
|
| 查看次数: |
18971 次 |
| 最近记录: |