Turn your Synology NAS into a game server

Turn your 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 state of affairs, one has to remember the affairs of bygone days.

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

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

Before we get started, here is a list of the tools we will 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, it is enough to figuratively understand the principle of work.

linux GSM - you can read about what LinuxGSM is on off. website https://linuxgsm.com.

At the moment (April 2020) there are 105 game servers available on LinuxGSM.
The entire list can be viewed here https://linuxgsm.com/servers.

Steam - 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.

Installing Docker on Synology NAS

At this stage, everything is simple, go to the Synology admin panel, then to the “Package centre”, find and install Docker.

package centerTurn your Synology NAS into a game server
We launch and see something like this (I already have this container installed)

Container managementTurn your Synology NAS into a game server
Next, go to the “Registry” tab, type “gameservermanagers” into the search, select the “gameservermanagers/linuxgsm-docker” image and click on the “Download” button.

gameservermanagers/linuxgsm-dockerTurn your Synology NAS into a game server
After that, go to the "Image" tab, wait for the image to finish loading and click on the "Launch" button.

Image downloadTurn your Synology NAS into a game server
In the window that opens, go to "Advanced Settings", then to the "Network" tab and check the box "Use the same network as Docker Host".

The rest of the settings, for example, such as "Container Name", we change 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 something succinctly, for example, let it be “test”.

Next, click the "Apply" or "Next" button several times until the settings are completed.

Advanced SettingsTurn your Synology NAS into a game server
Go to the “Container” tab and see a new running (if not, start) container.
Here you can stop, start, delete and carry out other actions.

Running a containerTurn your Synology NAS into a game server

Configuring a LinuxGSM Docker Container

Before you can connect to your Synology NAS via SSH, you need to enable SSH access itself in the admin panel.

Connecting via SSHTurn your Synology NAS into a game server
Next, you need to use the internal IP address of the Synology NAS server to connect via SSH.

We go to the terminal (or any other analogue, for example, under Windows this PuTTY) and use the following command:

ssh user_name@IP

In my case it looks like this

ssh [email protected]

Synology NAS server IP addressTurn your Synology NAS into a game server
After authorization, you need to execute 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

Connecting to DockerTurn your Synology NAS into a game server
Before installing "LinuxGSM" you need to take some steps.

Set a password for the "root" user

passwd

Next, update all packages

apt update && apt upgrade && apt autoremove

Waiting for the end of the process...

Updating packagesTurn your Synology NAS into a game server
Next, install the necessary utilities

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

Since it is not the best idea to perform different actions under "root", we will 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 UtilitiesTurn your Synology NAS into a game server

Installing and configuring LinuxGSM

Consider an example of setting up LinuxGSM using the example of "Counter-Strike" aka "CS 1.6" https://linuxgsm.com/lgsm/csserver

We 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

Installing dependenciesTurn your Synology NAS into a game server
During the installation process, you must agree to the "Steam License":

Steam LicenseTurn your Synology NAS into a game server
Go to the "Install" tab, copy the code from the 2nd step (we skip the 1st step, the "test" user already exists):

installTurn your Synology NAS into a game server

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

Waiting for download:

DownloadTurn your Synology NAS into a game server
And we start the installation:

./csserver install

If everything went in the normal mode, we will see the coveted “Install Complete!”

InstallComplete!Turn your Synology NAS into a game server
We start ... and we see the error "Multiple IP addresses found."

./csserver start

Multiple IP addresses foundTurn your Synology NAS into a game server
Next, you must explicitly tell the server which IP to use.

In my case it is:

192.168.0.166

We 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 folderTurn your Synology NAS into a game server
Copy the contents of the "_default.cfg" file to the "csserver.cfg" file:

cat _default.cfg >> csserver.cfg

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

nano csserver.cfg

Editing the csserver.cfg fileTurn your Synology NAS into a game server
Find the string:

ip="0.0.0.0"

And we 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"

We press the key combination:

Ctr + X

And after the offer to save, click:

Y

We return to the folder of the user "test":

cd ~

And try to start the server again. The server should now start without problems:

./csserver start

Server startTurn your Synology NAS into a game server
To view more detailed information, use the command:

./csserver details

Detailed information about the serverTurn your Synology NAS into a game server
Of the important parameters 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 stage, the game server is already available on the local network.

Configuring IP Address Forwarding

Playing on a 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 is also pertinent to note that most ISPs use dynamic IP addresses for their clients.

For convenience and stability of work, it is desirable to get a static IP address.

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

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

Everything is simple here - you need to specify 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

Router admin panelTurn your Synology NAS into a game server
That's all, after saving the router settings, the game server will be available on the network at the external IP address for the specified ports!

Additional settings on the example of CS 1.6

Using CS 1.6 as an example, I 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 one 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 command settings that can be executed through the Counter-Strike console, such as "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 from the server's console via the CVar "rcon_password".

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

Also, most likely there will be a need to install additional cards, for example "fy_pool_day".

All maps for CS 1.6 are here:

~/serverfiles/cstrike/maps

We find the necessary map, upload it directly to the server (if it is in the archive, unzip it), move the file with the ".bsp" extension 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

Сonclusion

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

LinuxGSM has many advanced settings, such as integration with Telegram and Slack for notifications, but some functionality still needs to be improved.

In general, I recommend to use!

Sources of

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 noticed central hardware not all Synology NAS can docker, here is a list of devices that can https://www.synology.com/ru-ru/dsm/packages/Docker.

Source: habr.com

Add a comment