![如何在没有端口转发的情况下托管 minecraft 服务器](https://linux22.com/image/1377336/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%B2%A1%E6%9C%89%E7%AB%AF%E5%8F%A3%E8%BD%AC%E5%8F%91%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E6%89%98%E7%AE%A1%20minecraft%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
我有一个不使用的 VPS,但它没有太多内存。我在 PC 上设置了一个 minecraft 服务器,但我不想进行端口转发。有没有办法使用 SSH 隧道让我的服务器正常工作?
答案1
如果您确实想通过 ssh 尝试使用 -L 选项
-L [bind_address:]port:host:hostport
Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. This works by allocating a
socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection
is forwarded over the secure channel, and a connection is made to host port hostport from the remote machine. Port forwardings can also be specified in
the configuration file. IPv6 addresses can be specified by enclosing the address in square brackets. Only the superuser can forward privileged ports.
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.
您需要通过 ssh 连接到服务器(使用此选项),然后保持该 ssh 连接运行,以便使用端口转发。然后您的服务器应该可以在 127.0.0.1:port 上使用
答案2
我使用 Logmein 的 hamachi 程序在大学里托管了一个服务器,取得了很大成功。您的客户需要安装该软件,但您可以创建一个自定义的可执行文件,客户无需手动输入任何设置即可进行设置。
如果 minecraft 支持的话,IPv6 隧道可能是另一个选择。