Windows users, skip down a bit to the 'under windows' heading.
#! /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