I have been reading on how to reverse tunnel and I am using this command:

ssh -f -N -T -R25565:localhost:25565 dns.mindfulhacker.tk

To forward my Minecraft server. My other server can connect to my Minecraft server but clients cannot connect to it by using the IP: dns.mindfulhacker.tk:255565

How can I forward my tunnel so it works like this?

Both servers run Ubuntu Server 12.04 LTS and clients will be running Windows. (If the clients used Linux I would allow them to SSH Tunnel it back.)

  • that second port number, 255565, is not valid (>65535) - I'm assuming that's a typo here. – ash Sep 16 '13 at 3:20
  • Ah yes, good spot – Kieran Cross Sep 17 '13 at 16:18

You need to enable the GatewayPorts feature in your sshd_config file.

excerpt from sshd_config man page:

        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”.

Something like this needs to be added:

GatewayPorts yes

NOTE: Be sure to restart sshd after making this change.

See this previous post for more details & examples:

  • should say "enable" GatewayPorts and not "disable", right? I tried to edit, but edits must be at least 6 chars. – ash Sep 16 '13 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.