Turn Synology NAS into a game server



Greetings!

So, for all known reasons, you have to spend more time at home in front of the monitor.
In this situation, it is necessary to recall the affairs of bygone days.

As already clear from the title of this article, we will talk about setting up your Synology NAS as a game server.

Achtung - there are a lot of screenshots in the article (screenshots are clickable)!

Before we begin, here is a list of tools that we need:

Synology NAS - I don’t see any restrictions here, I think anyone will do, if there are no plans to keep a server for 10k players.

Docker - no special skills are required, figuratively enough to understand the principle of work.

LinuxGSM - about what a LinuxGSMcan be read off. Online https://linuxgsm.com .

Currently (April 2020), 105 game servers are available on LinuxGSM.
The entire list can be found here https://linuxgsm.com/servers .

Steam is a market with games.

The LinuxGSM game server has integration with SteamCMD , that is, the LinuxGSM game server can only be used for games from Steam.

Install Docker on Synology NAS


At this stage, everything is simple, go to the Synology admin panel, then in the "Package center", find and install Docker.

Package center

We start and see something like this (I already have this container installed)

Container management

Next, go to the “Registry” tab, drive into the “gameservermanagers” search, select the “gameservermanagers / linuxgsm-docker” image and click on the “Download” button.

gameservermanagers / linuxgsm-docker

After that, go to the “Image” tab, wait for the image to finish loading, and click on the “Launch” button.

Download image

In the window that opens, go to “Advanced Settings”, then go to the “Network” tab and check the box “Use the same network as Docker Host”.

Other settings, for example, such as "Container Name", are changed at our discretion.
Container Name - as you might guess, this is the name of the container, it will come in handy later. I recommend calling it somehow succinctly, for example let it be “test”.

Next, click the “Apply” or “Next” button several times until the configuration is complete.

Advanced settings

Go to the “Container” tab and see the new container launched (if not, start).
Here you can stop, start, delete and carry out other actions.

Container launch

Configuring the LinuxGSM Docker Container


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

SSH connection

Next, you need to use the internal IP address of the Synology NAS server to connect via SSH.

Go to the terminal (or any other analog, for example, under Windows it is PuTTY ) and use the following command:

ssh user_name@IP

In my case it looks like this

ssh admin@192.168.0.166

Synology NAS Server IP Address

After authorization, you need to run the command to go to the "test" container itself (the "Container Name" field in the Docker settings) under the root user

sudo docker exec -u 0 -it test bash

Connect to Docker

Before installing LinuxGSM, you need to do some work.

Set a password for the root user

passwd

Next, update all packages

apt update && apt upgrade && apt autoremove

We are waiting for the end of the process ...

Package Updates

Next, install the necessary utilities

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

Since, under “root”, performing different actions is not a good idea, we add a new user, “test”.

adduser test

And let the new user use sudo

usermod -aG sudo test

Switch to the new user "test"

su test

Install Utilities

Install and configure LinuxGSM


Let's look at an example of LinuxGSM configuration using the example “Counter-Strike” aka “CS 1.6” https://linuxgsm.com/lgsm/csserver

Go to the page with the instruction “Counter-Strike” linuxgsm.com/lgsm/csserver .

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

At 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

Dependency Installation

During the installation process, you must agree to the “Steam License”:

Steam License

Go to the “Install” tab, copy the code from the 2nd step (skip the 1st step, the user “test” already exists):

Install

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

Waiting for download:

Download

And start the installation:

./csserver install

If everything went as usual, we will see the cherished “Install Complete!”

Install Complete!

We start ... and we see the error "Multiple IP addresses found."

./csserver start

Multiple IP addresses found

Next, you need to explicitly tell the server which IP to use.

In my case it is:

192.168.0.166

Go to the folder, the path to which was in the message as “location”:

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

And see what files are in this folder:

ls

List of files in csserver folder

Copy the contents of the file "_default.cfg" to the file "csserver.cfg":

cat _default.cfg >> csserver.cfg

And go to the editing mode of the file "csserver.cfg":

nano csserver.cfg

Editing the csserver.cfg File

Find the line:

ip="0.0.0.0"

And replace the IP address that was proposed, in my case it is "192.168.0.166".

It will turn out something like this:

ip="192.168.0.166"

Clamp the keyboard shortcut:

Ctr + X

And after the offer save click:

Y

We return to the user folder “test”:

cd ~

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

./csserver start

Server start

To view more detailed information, use the command:

./csserver details

Detailed server information

Of the important parameters it is worth noting:

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

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

Setting IP Forwarding


Playing on the local network is good, but playing with friends over the Internet is better!

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

It will also be appropriate to note that most providers use dynamic IP addresses for their clients.

For convenience and stability, it is advisable to get a static IP address.

Since I have a TP-Link Archer C60 router, I give an example of setting up call forwarding, as it is implemented in my router.

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

Everything is simple here - you need to specify the forwarding from the external IP address to the internal IP address of the server for two ports:

  • 27015
  • 27005


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

Admin Router Panel

That's all, after saving the router settings, the game server will be available on the network at an external IP address for the specified ports!

Additional settings on the example of CS 1.6


For example, CS 1.6 would like to give some useful tips.

There are two files for server configuration.

The first one is here:

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

The second is here:

~/serverfiles/cstrike/csserver.cfg

The first file contains general settings, such as IP address, map for the first boot of the server, etc.

The second file contains the settings for commands 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 through CVar “sv_password” and setting a password for management from the console of the server itself through CVar “rcon_password”.

A list of all CVar variables can be found here http://txdv.imtqy.com/cstrike-cvarlist

Also, it will most likely be necessary to install additional cards, for example, “fy_pool_day”.

All maps for CS 1.6 are here:

~/serverfiles/cstrike/maps

We find the desired map, upload it directly to the server (if in the archive, unzip it), move the file with the extension ".bsp" to the folder with the files "~ / serverfiles / cstrike / maps" and reboot the server.

~./csserver restart

By the way, all available server commands can be viewed like this

~./csserver

Total


I am pleased with the result. Everything works quickly and does not lag.

LinuxGSM has many additional settings, for example, integration with Telegram and Slack for notifications, but some functionality still needs improvements.

In general, I recommend to use!

Sources


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.imtqy.com/cstrike-cvarlist

UPD


As noticed centralhardwarenot all Synology NAS can in Docker, here is a list of devices that can https://www.synology.com/ru-ru/dsm/packages/Docker .

All Articles