5

I want to play a game which is hosted on port 25565 (minecraft!), but my university firewall does not allow this port.

I have a dedicated server running linux not too far from uni, so I think there's a way to tunnel through it (but I've never done this before and have no knowledge/experience of tunnelling)

It would probably be slow, but it's better than not being able to play at all. Is it possible to do using only SSH, or do I need other client/server software? My server has OpenSSH installed. Also, the computer I'm using to play the game is running Ubuntu.

I've tried searching but there seem to be so many different solutions to different types of problem =/

6 Answers 6

2

The simplest way is to use putty (Client Side APP). You should not need anything on the remote side except firewall rules to allow out going connections

Setup:

  1. Within putty setup a new connection to your unix box.(Add the host details etc , don't connect yet)
  2. Once that is all setup go to Connection -> SSH -> Tunnels in the putty tree view.
  3. Next enter 25565 into the source port and leave the destination blank.
  4. Finally select dynamic on the first combo box.
  5. Make sure you save everything then finally click the open button

This will create a tunnel on port 25565 locally to any destination on the remote site. This also assumes that you can tunnel a minecraft connection (you might need to set your IE settings to use the the SSH tunnel as well since games sometimes use this if they cant get a connection)

If you cant tunnel minecraft by default use a app like proxy cap to force all out going connections through the tunnel.

4
  • 3
    Minecraft doesn't let me choose a proxy, it just connects directly. I found out how to set up a proxy and set it to apply systemwide and it works for firefox etc, but minecraft just ignores it. Do you mean Internet Explorer by IE? If so, I'm on linux :)
    – Matt
    Jan 11, 2011 at 12:31
  • Sorry I assumed that you were using windows , But linux has the same option (well at least ubuntu does). If you go to System -> Preferences -> Network Proxy , you should be able to route all or most of the traffic through the proxy. On linux you can also use proxytunnel to tunnel through http proxies (if thats what you have available)
    – RC1140
    Jan 11, 2011 at 12:40
  • What about on a mac?
    – Zero
    Mar 19, 2012 at 17:11
  • 1
    @Foxtrot You can do the exact same thing on the mac , instead of using putty , use the Terminal application and the following command ssh <username>@<servername> -D 25565 , once that is connected you can change you system proxy by going to <Apple Icon> -> Preferences -> Network and then click on advanced for you current active network connection. Finally click proxies and enter the details into the Socks Proxy option and make sure its ticked
    – RC1140
    Mar 26, 2012 at 7:10
11

I have drawn some sketches

For making it easier to understand the tunnel mechanisms, watch these sketches. The machine, where the ssh tunnel command is typed is called »your host«.

ssh tunnel starting from local


ssh tunnel starting from remote

Introduction

  1. local: -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 means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine.

  2. remote: -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 means: connect with ssh to connectToHost, and forward all connection attempts to the remote sourcePort to port onPort on the machine called forwardToHost, which can be reached from your local machine.

Your example

The second image represents your scenario. The remotehost is your dedicated server running linux not too far from uni. The farawayhost is the blocked minecraft server you want to connect to on its pink port 25565.

 ssh -L 12345:minecraftServerIP:25565 dedicatedServer

The port number of the green port is 12345. You can now access the minecraft server by connecting to

localhost:12345

Of course you can change the green port’s number 12345 to whatever you want.

1
  • 1
    Cool sketches, @erik! Apr 23, 2017 at 10:28
8

Simple, run the command

ssh -L 25565:minecraftserverIp:25565 user@remotelinuxbox

Then add a server to your minecraft client localhost:25565

This will allow you to connect to the remote minecraft server via the ssh tunnel.

2
  • I should add you can do this for as many servers as you want just change the first 25565 to any port number and then add a new server to the minecraft client using the new port.
    – K1thros
    Feb 25, 2013 at 18:44
  • Edi your answer to include additional relevant information.
    – Enigma
    Feb 25, 2013 at 19:09
1

Try http-tunnel. Just go to Settings>Add Ports/Applications and enter the server IP and application port (usually 25565) then press ok and try running minecraft.

0

You can change the port Minecraft runs on, so just set it to 22 (because they haven't blocked SSH) then you'll be able to play by specifying the port on each client.

1
  • 1
    Not possible if I don't run the server. In the end I asked the host to add a port map on his server from 1863 (MSN, unblocked) to 25565.
    – Matt
    Mar 19, 2012 at 7:49
0

Windows users, skip down a bit to the 'under windows' heading.

  • Linux (or UNIX) Users

    Install a SSH client of some kind (rather obvious)

    Make the following bash (or plain ol' sh) script:

#! /bin/bash

ssh -nfN -D 8080 "<your-ip-or-url-here>"

sleep 8

java -jar \

"/path/to/launcher-for-minecraft.jar"

You can change how long it 'sleeps' (to make sure that the ssh connection has been initialized) manually if you want. anything else can be changed too.

**follow the steps under the 'Steps to configure minecraft to use this tunnel' heading, and then run the script!

.

  • Windows Users

    Using PuTTY, I go under 'connection' and allow TCP keep-alives, also setting the number of seconds between keep-alives to 6.

    I then go down to 'SSH -> tunnels' and add a dynamic forwarded port for 8080. This is necessary as well as 25565. To accomplish this, do the following:

    Enter 8080 for the 'source port', and 8080 for the 'destination port'. do NOT prefix the destination port with `localhost:'.

    I also manually added port 25565. This one should be a 'local' forward, not a 'dynamic' forward.

    To accomplish this, do the following:

    enter 25565 as the source port, and localhost:25565 as the destination port. Select the local radio button (then hit add).

.

  • Steps to configure minecraft to use this tunnel

    In the new minecraft launcher, edit your profile (use the aptly named edit profile button) or make a new one for tunneling (new profile) and click the checkbox next to JVM Arguments. In the box that is no longer greyed out, add the following string to the argument already there (should be -Xmx1G):

    -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8080

    Now, the arguments will look like this:

    -Xmx1G -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8080

    Click Save Profile.

Save your pUTTY session settings.

  • With your pUTTY terminal active (just log in, and you don't need to do anything else) start Minecraft under the profile you created/edited. Assuming you are tunneling to a valid host (in my case, a linux PC i own that is not behind such a draconian firewall), you should now have minecraft multiplayer running! Congratulations!

I initially learned how to do this by determining what this shellscript (https://gist.github.com/EspadaV8/1088594) did, and copying that functionality into pUTTY's settings.

The other answers didn't completely solve the problem, because they failed to realize that java doesn't follow the global windows proxy settings. My answer makes use of the little-known -DsocksProxyHost and -DsocksProxyPort arguments provided at initialization. For a http proxy or SSL proxy, use -DhttpProxyHost and -DhttpProxyPort options, or -DhttpsProxyHost and -DhttpsProxyPort arguments, respectively. I can confirm personal success using this method behind a proxy and a firewall :D

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .