Minecraft
Introduction
We are to have some Minecraft servers on the Home Lab'. The general setup will be to have a Velocity server in front several Minecraft host Virtual Machines. Velocity works in a similar way to a Nginx reverse proxy whereby Pfsense forwards all Minecraft traffic to the Velocity server including the SNI and Velocity redirects traffic to the required hostname based on the DNS name. Cloudflare does not reverse proxy Minecraft traffic on the free tier and as we do not want to have to deal with random bots from the east so we will not leave the port open on the edge or Pfsense to random bots with port scanners. So we will use grey cloud at Cloudflare but DNS will point to a service like TCPShield and our firewalls only accept Minecraft traffic from their IP addresses and Velocity will only accept named servers and drop any unknown DNS names.
Installation
The installation will be in some distinct stages to enable each step to be proved to be working before proceeding to the next stage. First we setup a simple vanilla Minecraft server and set the firewall to port forward to it directly. Once that is proven to be working we will setup a Velocity server that will receive all 25565 traffic and forward it to the working Minecraft host. The next phase after the first host is getting traffic forwarded is to setup a second host and make sure velocity can forward to each, included in this step will be hardening the Velocity server with whatever security measures that it has available. When we are sure that Velocity is working properly we can work on the remote access stage, where we use TCPShield to proxy the service and have Cloudflare DNS only names setup with cherry.seaoffate.net and apple.seaoffate.net etc. From this point forward any new Minecraft servers will simply follow the same setup procedure.
The First Minecraft Host
| Item | Value | Notes |
|---|---|---|
| CPU | 2 | |
| RAM | 4GB | |
| Swap | 16gb | Additional disk allocated from Lexar SSD |
| Storage | 96GB | Initially set at 32gb |
| Base OS | Debian 13.3 | Server version |
| Hostname | Cherry | |
| IP Address | 192.168.100.30 |
The Cherry host was created as a clone of the Debian template and then the basic specifications were improved so we will need to configure these extra items in the OS. First we need to identify the harddrive to use as the swap file
lsblk
The result is likely to show that the disk is likely to be /dev/sdb so we can set the swap space and enable it with
sudo mkswap /dev/sdb sudo swapon /dev/sdb
To make the swap file persistent we edit the fstab
sudo nano /etc/fstab
Add the line:
/dev/sdb none swap sw 0 0
and remove or comment out the line that refers to
/dev/sda3
Before the storage sda main partition can be expanded to the full 96GB we have to remove the swap that is in the way so disable the existing swap with
sudo swapoff /dev/sda3
Open the disk utility to modify sda
sudo fdisk /dev/sda
Delete the swap partition with the option d, then type 3 to delete partition 3, then w to save and exit. The next thing to do is expand the Primary Root Partition so open fdisk again:
sudo fdisk /dev/sda
Delete the root partition:
- Type d (Delete)
- Type 2 (this only deletes the table entry, not the data).
- Type n (Create a new partition)
- Type p (Primary Partition)
- Type 2 (For Partition number 2)
- Type enter (Use default values for start sector)
- Type enter (Use default values for end sectors to fill the 96GB)
- CRITICAL: When asked if you want to remove the signature, type N.
- Type w (Save and exit)
To finalize Storage reboot to refresh the kernel partition table:
sudo systemctl reboot
When the VM reboots expand the filesystem into the new space:
sudo resize2fs /dev/sda2
We can verify the new swap and new sda size with
df -h