我一直在阅读如何反转隧道,并且正在使用以下命令:
ssh -f -N -T -R25565:localhost:25565 dns.mindfulhacker.tk
转发我的 Minecraft 服务器。我的其他服务器可以连接到我的 Minecraft 服务器,但客户端无法使用 IP 连接到它:dns.mindfulhacker.tk:255565
我怎样才能转发我的隧道,使其像这样工作?
两台服务器都运行 Ubuntu Server 12.04 LTS,客户端将运行 Windows。 (如果客户端使用 Linux,我将允许他们通过 SSH 隧道将其返回。)
答案1
您需要在sshd_config
文件中启用 GatewayPorts 功能。
摘自sshd_config 手册页:
GatewayPorts
Specifies whether remote hosts are allowed to connect to ports
forwarded for the client. By default, sshd(8) binds remote port
forwardings to the loopback address. This prevents other remote
hosts from connecting to forwarded ports. GatewayPorts can be used to
specify that sshd should allow remote port forwardings to bind to
non-loopback addresses, thus allowing other hosts to connect. The
argument may be “no” to force remote port forwardings to be
available to the local host only, “yes” to force remote port
forwardings to bind to the wildcard address, or “clientspecified”
to allow the client to select the address to which the forwarding
is bound. The default is “no”.
需要添加类似这样的内容:
GatewayPorts yes
笔记:sshd
进行此更改后请务必重新启动。
有关更多详细信息和示例,请参阅上一篇文章: