Turning a Synology NAS into a gaming server

Turning a Synology NAS into a gaming server

Hello!

So, for all the well-known reasons, I have to spend more time at home in front of the monitor.
Given this situation, I have to reminisce about the days long gone.

As is clear from the title of this article, we will discuss setting up Synology NAS as a game server.

Attention — the article contains many screenshots (screenshots are clickable)!

Before we get started, here’s a list of tools we’ll need:

Synology NAS — I don’t see any limitations here; I think any will do, as long as there are no plans to host a server for 10k players.

Docker — no special skills are required; it's enough to have a basic understanding of how it works.

LinuxGSM — you can read about what LinuxGSM is on the official website. https://linuxgsm.com.

As of now (April 2020), LinuxGSM supports 105 game servers.
You can view the entire list here https://linuxgsm.com/servers.

Steam — a marketplace for games.

Game Server LinuxGSM is integrated with SteamCMD, meaning that the LinuxGSM game server can only be used for games from Steam.

Installing Docker on Synology NAS

At this stage, it’s simple; we go to the Synology admin panel, then to the ‘Package center,’ find and install Docker.

Package centerTurning a Synology NAS into a gaming server
We launch it and see something like this (I already have this container installed)

Managing ContainerTurning a Synology NAS into a gaming server
Next, we go to the ‘Registry’ tab, search for ‘gameservermanagers,’ select the image ‘gameservermanagers/linuxgsm-docker’ and click the ‘Download’ button.

gameservermanagers/linuxgsm-dockerTurning a Synology NAS into a gaming server
After that, we go to the ‘Image’ tab, wait for the image download to finish, and click the ‘Launch’ button.

Image downloadTurning a Synology NAS into a gaming server
In the window that opens, we need to go to ‘Advanced Settings,’ then to the ‘Network’ tab, and check the box ‘Use the same network as Docker Host.’

The other settings, such as ‘Container Name,’ can be adjusted as you wish.
Container Name — as you might guess, this is the name of the container, and it will be useful later. I recommend naming it something concise; for example, let’s call it ‘test.’

Next, click the ‘Apply’ or ‘Next’ button a few times until the configuration is complete.

Advanced SettingsTurning a Synology NAS into a gaming server
Go to the ‘Container’ tab and see the new running container (if not, start it).
Here you can stop, start, delete, and perform other actions.

Starting the containerTurning a Synology NAS into a gaming server

Configuring the LinuxGSM Docker Container

Before connecting to Synology NAS via SSH, you need to enable SSH access in the admin panel.

Connecting via SSHTurning a Synology NAS into a gaming server
Next, you need to use the internal IP address Synology NAS server for connecting via SSH.

We go to the terminal (or any other equivalent, for example, on Windows it's PuTTY) and use the following command:

ssh user_name@IP

In my case, it looks like this

ssh admin@192.168.0.166

The IP address of the Synology NAS serverTurning a Synology NAS into a gaming server
After authorization, you need to run a command to enter the container "test" (the "Container Name" field in Docker settings) as the user "root"

sudo docker exec -u 0 -it test bash

Connecting to DockerTurning a Synology NAS into a gaming server
Before installing "LinuxGSM", some actions need to be taken.

Let's set a password for the user "root"

passwd

Next, we will update all packages

apt update && apt upgrade && apt autoremove

Waiting for the process to finish…

Updating packagesTurning a Synology NAS into a gaming server
Next, we will install the necessary utilities

apt-get install sudo iproute2 netcat nano mc p7zip-rar p7zip-full

Since doing various tasks as "root" is not the best idea, let's add a new user "test".

adduser test

And allow the new user to use "sudo"

usermod -aG sudo test

Switching to the new user "test"

su test

Installing utilitiesTurning a Synology NAS into a gaming server

Installing and configuring LinuxGSM

Let's consider an example of setting up LinuxGSM using "Counter-Strike", also known as "CS 1.6" https://linuxgsm.com/lgsm/csserver

Go to the instructions page for "Counter-Strike" linuxgsm.com/lgsm/csserver.

In the "Dependencies" tab, copy the code under "Ubuntu 64-bit".

As of the time of writing, this code looks like this:

sudo dpkg --add-architecture i386; sudo apt update; sudo apt install mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux lib32gcc1 libstdc++6 lib32stdc++6 steamcmd

Installing dependenciesTurning a Synology NAS into a gaming server
During the installation, you need to agree to the "Steam License":

Steam LicenseTurning a Synology NAS into a gaming server
Go to the "Install" tab and copy the code from step 2 (we skip step 1, user "test" already exists):

InstallTurning a Synology NAS into a gaming server

wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh csserver

Waiting for the download:

DownloadingTurning a Synology NAS into a gaming server
And we start the installation:

./csserver install

If everything went smoothly, we will see the cherished "Install Complete!"

Install Complete!Turning a Synology NAS into a gaming server
Starting… and we see the error "Multiple IP addresses found."

./csserver start

Multiple IP addresses foundTurning a Synology NAS into a gaming server
Next, we need to explicitly specify to the server which IP to use.

In my case, it is:

192.168.0.166

We go to the folder whose path was in the message as "location":

cd /home/test/lgsm/config-lgsm/csserver

And check what files are in this folder:

ls

List of files in the csserver folderTurning a Synology NAS into a gaming server
Copy the contents of the file "_default.cfg" into the file "csserver.cfg":

cat _default.cfg >> csserver.cfg

And open the file "csserver.cfg" for editing:

nano csserver.cfg

Editing the csserver.cfg fileTurning a Synology NAS into a gaming server
Find the line:

ip="0.0.0.0"

And replace the IP address with the one suggested, in my case it's "192.168.0.166".

It will look something like this:

ip="192.168.0.166"

Press the key combination:

Ctr + X

And after the prompt to save, click:

Y

Return to the user's folder "test":

cd ~

And try to start the server again. Now the server should start without issues:

./csserver start

Server LaunchTurning a Synology NAS into a gaming server
To view more detailed information, use the command:

.\/csserver details

Detailed information about serverTurning a Synology NAS into a gaming server
It is worth noting some important parameters:

  • Server IP: 192.168.0.166:27015
  • Internet IP: xxx.xx.xxx.xx:27015
  • Config file: \/home\/test\/serverfiles\/cstrike\/csserver.cfg

At this stage, the game server is already available on the local network.

IP Address Forwarding Setup

Playing on a local network is good, but playing with friends online is better!

To forward the IP address received by the router from the provider, we use the NAT mechanism.

It is also worth noting that most providers use dynamic IP addresses for their clients.

For convenience and stable operation, it is advisable to obtain a static IP address.

Since I have a "TP-Link Archer C60" router, I provide an example of how to set up forwarding, as it is implemented in my router.

For other routers, I assume the forwarding setup is similar.

It's simple here — you need to specify forwarding from the external IP address to the internal server IP address for two ports:

  • 27015
  • 27005

In the admin panel of my router, it looks like this

Router Admin PanelTurning a Synology NAS into a gaming server
That's it, after saving the router settings, the game server will be available on the network via the external IP address for the specified ports!

Additional settings using CS 1.6 as an example

Using CS 1.6 as an example, I would like to give a few useful tips.

There are two files for server configuration

The first is located here:

~\/lgsm\/config-lgsm\/csserver\/csserver.cfg

The second is located here:

~\/serverfiles\/cstrike\/csserver.cfg

The first file contains general settings, such as the IP address, the map for the server's first load, etc.

The second file contains command settings that can be executed through the "Counter-Strike" console, for example, "rcon_password" or "sv_password".

In the second file, I recommend setting a password for connecting to the server via the CVar "sv_password" and setting a password for managing the server console itself via the CVar "rcon_password".

A list of all CVar variables can be viewed here http://txdv.github.io/cstrike-cvarlist

It is also likely that there will be a need to install additional maps, such as "fy_pool_day".

All maps for CS 1.6 are here:

~\/serverfiles\/cstrike\/maps

Find the desired map, upload it directly to the server (if it's in an archive, extract it), move the file with the extension '.bsp' to the folder with files '~\/serverfiles\/cstrike\/maps', and restart the server.

~.\/csserver restart

By the way, you can view all available server commands like this

~.\/csserver

 

Summary

I'm satisfied with the result. Everything works quickly and smoothly.

LinuxGSM has many additional settings, such as integration with Telegram and Slack for notifications, but some functionality still requires improvements.

Overall, I recommend using it!

file — continuous reading of events from one or more local files;

https://linuxgsm.com
https://docs.linuxgsm.com
https://digitalboxweb.wordpress.com/2019/09/02/serveur-counter-strike-go-sur-nas-synology
https://medium.com/@konpat/how-to-host-a-counter-strike-1-6-game-on-linux-full-tutorial-a25f20ff1149
http://txdv.github.io/cstrike-cvarlist

UPD

As noted by centralhardware not all Synology NAS can run Docker, here is the list of devices that can https://www.synology.com/ru-ru/dsm/packages/Docker.

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster