Bored with playing Minecraft alone? Do you want to play it with your friends on your own server? You have a Raspberry Pi? Because that's all you need to make a low-cost and reliable Minecraft server, one that you can keep powered on all the time.

Compared to connecting to a distant server, you get ultra-low latency for yourselves. Other players also have much lower latencies, which is a boon for co-op gameplay thanks to excellent response times.

Getting Your Minecraft Server Ready for Online Multiplayer

The first step is to get the Minecraft server set up to work on your local network. With a series of commands, the process is quite easy to do from the terminal. Whether to use a Raspberry Pi 3 or a Pi 4 depends upon the number of simultaneous players. Servers usually need some headroom to accommodate additional players in the future. For this purpose, a good starting point is a Raspberry Pi 4 2GB model. Any model of Pi under 2GB RAM would require you to set up the swap (virtual memory) properly on your Raspberry Pi for stability, to prevent an out of memory (OOM) condition.

Raspberry Pi3 and Raspberry Pi4 single board computers

Port Forwarding at the Router

When the Minecraft server is set up and working well on your local network, you need to provide access to other players over the internet. If you connected your Pi to the internet directly without a router, it will work right away, but most networks require the use of a router. Both wired and wireless routers have a standard built-in security feature called port blocking. This feature prevents outsiders from accessing devices inside your network. When a player outside your network tries to access your Minecraft server, the connection will be blocked at the router.

But you need other players to connect to the Minecraft server which is inside your network. This is done via a network feature called port forwarding. Your public IP address receives the connection request from players. Once received, your router must forward the request to the Pi. Instead of forwarding all the ports, you must forward only the necessary ports, which is good for security. In case of a Minecraft server on the Pi, the port is either 19132 or 25565. Which one to use depends upon the installation.

Minecraft Java Edition

Minecraft Bedrock Edition

Source

Any

Any

Source port ranges

*

*

Destination

Any

Any

Destination port ranges

25565

19132

Protocol

TCP

UDP

Action

Allow

Allow

Priority

100

100

Name

MinecraftJava_Port

MinecraftBedrock_Port

To port-forward, log in to your router, and find the page to manage the ports. Create a port forwarding rule. The external port and the internal port will be that of your Minecraft server on the Pi. The IP address will again be that of your Pi. Since you want this to be a one-time setup, setting a static IP address for your Raspberry Pi is the best option.

port forwarding settings for minecraft java edition in the router

Once done, all the requests to that port get forwarded to the Pi. Some routers may need a restart for port forwarding to work. Port forwarding is not possible on tethered cellular internet connections.

03 port forwarding settings for different types of minecraft servers in the router

There is another feature in routers called Demilitarized Zone (DMZ). This allows you to forward all incoming ports to a chosen IP address, that of your Pi. Although easy to set up, this poses a lot of security challenges. If you still want to do it this way, you should protect your Minecraft server with a rate limiter like Fail2ban. You should also set up a firewall such as Uncomplicated Firewall (UFW). Then, open only the necessary ports with:

        sudo ufw allow 19132
    

Check if Port Forwarding Is Working Alright

You have set up port forwarding, but you need to check if it is working correctly. Since players are outside your network and connect via the internet, you need to check this from outside your network. Fortunately, there are many open port check tools available on the internet, such as CanYouSeeMe.org.

Input the port number and run a check, it will show you a success message if it can see the service on the port.

Cheking a custom open port using canyouseeme.org-1

Give the Access Credentials to Other Online Players

You need to give the IP address and port number to the other players; that's the public IP address, not the private IP address of the Pi on your network. You can find the public IP address by visiting WhatsMyIP.org. You can also run a command in the terminal of the Pi to find it:

        curl http://ifconfig.me
    

Public Static IP vs. Dynamic IP

For this setup, public static IP is highly recommended to simplify things. Since a public static IP address remains the same, players need not change the connection credentials. However, most home connections have a dynamic public IP; this means it gets reissued when the network equipment restarts, either at your end or at the ISP's end. In this case, you need to communicate the new public IP address to all the players again. This is usually done in group messaging.

The Better Way to Run the Minecraft Server on Dynamic IP

While there are many available, a few dynamic DNS services are excellent. You can use DDNS services like DynDNS or NoIP for the purpose. Most routers have a built-in feature to update the new IP address to these services at every IP change. Since the URL configured at the DDNS service does not change, the players will always connect using the same URL. This is in spite of the IP address changing dynamically.

Setting up dynamic dns service using DynDNS.com in the router

How About a URL for the Static IP Too?

If you own a domain name, simply create an "A record" under domain settings and point it to your public IP address. You would want to point it to a subdomain if you use the main domain for a different purpose already. Here's an example setup:

  • Type: A record
  • Subdomain Name: minecraft.example.com
  • Public IP Address: 100.100.100.100
Create A record at GoDaddy for custom sub domain for Minecraft server

What’s Better for a Minecraft Server? Wired or Wireless Connection?

The Pi 4 has faster 802.11ac wireless. Yet it is better to use wired Ethernet for efficient functioning as a Minecraft server. The reason for this is that wireless latencies increase significantly as the bandwidth usage goes up. More players will mean more bandwidth, and higher latency will negatively affect gameplay. So, use a wired connection; the closer the Pi is to the router, the better.

Latency is an important factor in public networks too. If all the players use the same ISP (same city too), the latencies are as little as single-digit milliseconds. Across different ISPs, the latency is significantly higher, around 30ms to 50ms.

Run Your Own Minecraft Multiplayer Server: Success

Setting up a Raspberry Pi for Minecraft online play is a breeze. Running it is cost-efficient too, even if you run it all the time. Raspberry Pi's low power consumption will keep the power bills negligible. Just back up the data once in a while so that you do not lose the game progress due to any disk issues.