How To: Share Your LAN Minecraft World with Your Linux-Savvy Friends

Share Your LAN Minecraft World with Your Linux-Savvy Friends

First off, I would like to say two things. One, this is not for beginners; if you don't feel that you understand this how-to at all, do not try it. Second, never ever install random software or change settings if you do not trust the source.

If I haven't scared you yet, here is a trick you can use to let someone who isn't on the same local network access a world you have "Open to LAN". Since local addresses aren't routed onto the Internet, you need some trick to be able to allow others to connect.

For this, you need a friend who has a computer running Linux (or any other Unix-like system... I did this on FreeBSD), an account on that machine, and PuTTY, which is a program that lets you log in on remote computers.

Step 1: Setting Up SSHD on the Linux Server

SSHD is running by default on most Linux-distributions. But you need to change some settings to allow the tunnel you are about to create to accept connections from the outside. So, open /etc/ssh/sshd_config and set (or add) "GatewayPorts yes", and then restart sshd._

Step 2: Download and Install PuTTY

Back on your computer, download and install "a Windows installer for everything except PuTTYtel" from here.

Step 3: Create a Small .Bat Script

Open Notepad and save it to a file with the suffix ".bat". I called mine mctunnel.bat:

@echo off

set /P MCREMOTEHOST="Remote host: "
set /P REMOTEUSER="Username: "

set /p MCMYPORT="LAN address to share: "

set SSHPORT=22
set MCREMOTEPORT=12345

"c:\Program Files (x86)\PuTTY\plink.exe" -v -x -a -T -C -noagent -ssh -P %SSHPORT% -R %MCREMOTEPORT%:%MCMYPORT% %REMOTEUSER%@%MCREMOTEHOST%

Note: That last line is supposed to be a very long line without any breaks.

You might want to change some settings. For example, I have my ssh-server running on another port that the standard port 22 and port 12345 can be changed to anything between 1025 and 65535. Check with the person who owns the Linux-computer which port he/she thinks is best. Also, your installation might have put plink.exe somewhere else, check that.

And you can change all of the "set /p" to something static, like "set REMOTEUSER=yownas" since it won't change..

Step 4: Start Minecraft

Mmm, yea. Think most of you know how to do this.

Step 5: Open to LAN

Press ESC and click on "Open to LAN". The chat window should say something like: "Local game hosted on 192.168.1.67:50664".

Step 6: Start the Tunnel

Double-click your bat-script. It should ask you for "Remote host:" which is your friends Linux-computer, "Username:" which is the username you use to log in on that computer, and "LAN address to share:", just copy the string, in my case 192.168.1.67:50664, Minecraft told you.

You should now see a lot of text flashing by, and at the bottom it asks for your password to the Linux-machine. Enter it and you are done. :)

Step 7: People Can Connect

SSH has now set up a tunnel between your machine and the Linux-computer. The local LAN-port for Minecraft has been mirrored to port 12345 on the other side.

So, instead of the disappointing "Connection refused: connect" when people try to connect to your local LAN-address, they can connect to your.friends.linux.computer:12345 and join you in killing creepers and walk into your redstone traps. :)

6 Comments

So this is for when the person trying to connect isn't useing the same network as you? When you click "Open to lan" It gives you an ip. Just write that down and give it to who ever you want to join.

Yes, but the problem is that many people don't have their computer connected direct onto the Internet. Instead they share one IP-address through a router that creates a private LAN-network for all the computers. This would also work if you are behind a firewall that blocks all incomming traffic but allows traffic going out.

On most routers and adsl-modems you can do "port forwarding", which would allow people to connect through your router but this is easier if you do not want or can't change the settings on it. :)

I'm going to use this to let the kids share their Minecraft-worlds with me even if they are at their moms house.

I cannot even use this on LAN because minecraft picks a wrong ip(127.x.x.x while my ip is 192.x.x.x)I don't know why.

It would actually work even if your Minecraft world is shared on 127.0.0.1. :)

Why it does bind to your localhost address, I don't know. :( Minecraft is supposed to try to find the correct ip to bind to. Do you have any local firewalls that would block it?

If it is bound to your local host (127.0.0.1), you just need to find out what your local IP from your router is, and give that to your friend, as it'll hit the same endpoint. In a command promt, type "ifconfig -a" to find out what IP your NIC is assigned.

I've seen that Minecraft sometimes tries to share with 0.0.0.0 as the IP. Not sure why but if you change the bat-file like this:

set /p MCMYPORT="LAN adress: "
set MCMYPORT=!MCMYPORT:0.0.0.0%=127.0.0.1!

It will replace 0.0.0.0 with 127.0.0.1 (which is the localhost) and you can share your world even if Minecraft opens up with 0.0.0.0.

Share Your Thoughts

  • Hot
  • Latest