28 May 2021

Hosting Game Servers on Unraid

Use extra system resources to host dedicated game servers for yourself, your friends, and your family.

Copy of Game Servers
This Guest Blog is by Stefano Partida of SPXLabs.

You probably have some extra system resources on your Unraid NAS that you don't even know about. Or, maybe you overbuilt your server and want to do more with it? Why not use those extra resources to host some dedicated game servers for yourself and your friends or family?

Heads Up on Security

First off, you should know that you should never port forward ports 80 and 443 to your Unraid host (the Unraid WebGUI). This will open up your server to attacks on the world wide web. It is relatively safe to port forward to specific containers and virtual machines hosted by Unraid, however, if you at all plan on sharing your game servers with strangers you should highly consider setting up a reverse proxy for extra protection and other features. Security is a deep rabbit hole with many caveats. If you feel the need to be as secure as possible then you will need to do more leg work to set things up right. Please read more about both with the two links below:

Unraid Security Best Practices

Let's Encrypt, Nginx & Reverse Proxy Starter Guide

One last note: generally, you should never “put all your eggs in one basket”; meaning, it probably is not the best idea in the world to back up all your data to your Unraid server and then expose more and more ports to the containers or virtual machines because these will broaden your vulnerability vectors. It's always a good idea to do regular backups and security audits!

Current Roles of My Server

At the time of writing, my server does the following things.

  • Network File/Video/Photo Storage
  • WireGuard VPN service
  • PiHole DNS (home network-wide ad blocking)
  • OBS NDI
  • Deluge-VPN and Firefox container
  • Plex

My System Specs

Everything listed above does not require the hardware I have but thankfully I have been fortunate enough to afford a pretty sweet and overkill system.

If you want to know why I selected these parts you should read the blog on the build:

Unraid Ryzen Server Build 2021

IMG 6475

Dedicated Game Servers

Because I have so many extra resources I’ve decided to really open up to my friends and host servers for us. I am currently hosting a few private servers in container form for games such as:

  • Minecraft Eternal
  • Rust
  • Valhiem
  • Terraria

Another Server I am hosting in a Windows VM is for Space Engineers.

What Servers Can you Host?

Honestly, pretty much all of them. The community has a very wide selection of servers available in container form and you can check out the entire repository here.

If you don’t see an existing container for a server you want to host, you can still download and use any container found in DockerHub. DockerHub can be used by Unraid to find and install containers that are not necessarily pre-configured to work with Unraid out of the box so a little more work will be needed by you to get them working.

Still don’t see the game server you want to host??? Well get this, because Unraid is so flexible you can host whatever server you want in a VM as I do with Space Engineers.

Gamesgamesgames

Docker Container and VM Differences

There are several things but the big things are, containers are smaller in byte size and can be extremely lightweight because they don’t require a guest operating system (like Windows 10 or Ubuntu) to run. Virtual Machines typically do have an entire operating system installed and thus require more hardware resources. VMs also usually require to lock in a minimum number of virtual CPU cores (vCores) and minimum amount of RAM. For instance, a Windows 10 VM may need a minimum of 2 vCores and 2GB of RAM just for the operating system itself, then additional resources will need to be added to run a game server like Space Engineers. A container can be allowed to use systems resources as needed, so you do not need to reserve cores/threads and RAM for the container, that way as the more and more people join the server, the more resources the container can use at will to compensate for the extra work. You can limit the number of vCores and RAM for your containers if you so choose.

When to use a Container

In my opinion, you should always seek to run a game server in a container whenever possible. This will maximize your system resources for other applications, processes, virtual machines, and containers.

When to use a Virtual Machine

When a container doesn’t exist or if you are just more comfortable setting up a VM with a nice easy desktop interface. Space Engineers can run as a container but it loses much of the functionality that the virtual machine counterpart has to offer. This is why I run Space Engineers in a Windows 10 virtual machine and it’s just incredibly easy to set up.

Val Connect 1

Maximizing Game Server Performance

Unraid gives us the ability to really fine-tune how well our game servers perform. Unraid 6.9 introduces something very cool called Multiple Pools.

Separate Storage for Caching, VMs, and Containers With a single pool, the same underlying storage for your VMs and containers is being used to provide a cache for your data written to shares. This means when a large copy to a share is taking place, performance in those other applications may suffer. While this may not be noticeable for the average home usage, with power users and multi-user environments, the cost of resource contention is more obvious and overt. With multiple pools, you can now create groups of storage devices to dedicate to specific functions.

In this link, you can learn all about multi-pools. This feature is important because we can very easily separate our game servers from our array and from our cache. We can literally dedicate hardware specifically for our gaming servers which will make everyone's gaming experience much more enjoyable.

Allocating Storage

My Space Engineers VM is stored on a dedicated NVME drive because it is running Windows 10 and the Space Engineers server software. This means that the virtual machine can read and write to the drive as much as needed without being hindered by any other VM, container, or application.

For now, all of my gaming containers run in my cache because they are extremely lightweight and there are at most 5 people in one game server at a time. One thing I could change in the future if I wanted, is to put all containers in their own pool or just specific ones, like Minecraft. My Minecraft server is heavily modded and if some of my friends were constantly playing on it while other friends were playing Rust, then there might be some performance loss there because both servers read and write to the cache very frequently.

Accessing Your Server Remotely

Game crash while you were away? Maybe the game froze? Don’t worry, the community has you covered. You can set up a VPN within your Unraid OS so you can access the WebUI from virtually any device from anywhere in the world.

You should start with Wireguard and maybe even use OpenVPN as a backup. There are plenty of guides and videos online to help you figure out how to set it up like this one:

Flexing with Unraid

Unraid is incredibly flexible and I’d bet that many of us have enough spare resources to self-host many services like game servers. Personally, I believe the biggest draw to Unraid is the ease of use: it’s great for novices and experts alike. I feel like most other Linux systems have you do much more than is necessary in the command line even when you just want to do something that should be simple.

Speaking of other distributions of Linux, you will never get the same quality of help from any other community as you would with the Unraid community. People on the forums, Reddit, YouTube, or where ever are extremely patient and helpful. I have never once seen anyone say Google it or turn away a question even for some of the most unique questions/problems. I seriously think that anyone looking to self-host will love Unraid for everything it has to offer.

Still here? Check out Unraid for yourself free!

What game servers do you host?

Let us know in the forums!