Using Unraid to Host Dedicated Game Servers

It turns out you have some extra resources than you expected from your Unraid NAS build. Or maybe you overbuilt your server and want to do more with it. Well, why not use those extra resources to host some dedicated game servers for yourself and your friends or family?

Heads Up

You should know, that you should never port forward the ports 80 and 443 to your Unraid host (the Unraid webUI). This will open up your server to attacks from folks 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 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 get things “done right”.

You can read more about both with the two links below:

Personally, I feel safe enough to port forward directly to containers and virtual machines and do not currently use reverse proxy, one day I might but for now I think it’s fine. 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 backup all your data to your Unraid server then expose more and more ports to the containers or virtual machines because these will broaden your vulnerability vectors.

How I use Unraid to Host Dedicated Game Servers

Current Roles my Server Fulfills

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 Spec’s

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 following blog post.

IMG_6475.jpg


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/them. I am currently hosting a few private servers in container form and they are:

  • Minecraft Eternal

  • Rust

  • Valhiem

  • Terraria

Another Server I am hosting in a Windows Virtual Machine is Space Engineers.

What servers can you host?

Honestly, 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: https://unraid.net/community/apps?q=ich777%27s+Repository&r=0#r

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 per-configured to work with Unraid out of the box. So a little more work will be needed by you to get them working.

You 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 Virtual Machine, like I do with Space Engineers.

gamesgamesgames.PNG

What is the difference between a Container and Virtual Machine?

There are several things but the highlights 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. Virtual Machines also usually require to lock in a minimum number of virtual CPU cores (vCores) and a minimum amount of RAM. For instance, a Windows 10 virtual machine 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 to compensate for the extra work load. You can limit the number of vCores and RAM for you 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 straight up more comfortable setting up a virtual machine with a nice easy “Desktop Experience”. Space Engineers can run as a container but it loses much of the functionality that it’s virtual machine counterpart has to offer, so this is why I run Space Engineers in a Windows 10 virtual machine, also it’s just incredibly easy to do.

Maximizing Game Server Performance

Unraid 6.9 gives us a new 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 every ones gaming experience much more enjoyable.

Allocating Storage

My Space Engineers virtual machine 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 virtual machine, container, or application.

For now, all of my gaming containers run in my cache because they are extremely lightweight and there is 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 setup a VPN within your Unraid OS so you can access the WebUI from virtually any device from any where in the world.

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

Server unreachable via VPN? Then you can easily check if your server is online with a free service from Unraid called My Servers. My Servers will also allow you to back up your USB Flash Drive for that moment when the device has an untimely death.

My-Servers-5.png

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 what is necessary in the command line all to frequently, especially 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 forumsRedditYouTube, 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!