Euro Truck Simulator 2

Euro Truck Simulator 2

Not enough ratings
Euro Truck Simulator 2 - Dedicated Server Setup
By MaDmaX
Setup a ETS 2 Dedicated Server on Windows.
   
Award
Favorite
Favorited
Unfavorite
Get SteamCMD
Download SteamCMD and extract it wherever you want preferably in a folder.

Open it and wait!
Install the Server
Create a .bat file eg "updater.bat" where SteamCMD is located and paste following:

steamcmd.exe +force_install_dir "C:\GameServer\" +login anonymous +app_update 1948160 +quit pause

Edit force install dir as necessary.

And run it. Meanwhile go to next step.
Enable Console & Export Server Packages
Go to "C:\Users\%username%\Documents\Euro Truck Simulator 2" and open up the config.cfg and edit following:

uset g_developer "0"
to
uset g_developer "1"


uset g_console "0"
to
uset g_console "1"

Save file!



Now run ETS 2 and hit the console key "~" and enter following:

export_server_packages
or
export_server_packages destination file

Wait until its finished!


2 new files has been created in \Documents\Euro Truck Simulator 2:

server_packages.dat
- contains internal map data
server_packages.sii
- contains map details, dlc and mods configuration
Generate & Configure the Server Config
First launch will create server home folder and default server_config.sii.

By default server home directory is configured to point at the Game User Path. C:\Users\<your_user_name>\Documents\<game_name>

This location can be changed with -homedir start up parameter, however it must be changed for both game and server.

Next you will receive following error: "<ERROR> [MP] Error: Server packages file not found. This is required to load proper map, DLCs and mods". This means, you have to provide additional server configuration according to following steps.


Optional:
You can create a .bat file and set your home directory which you will find the following file.

eurotrucks2_server.exe -homedir "C:\GameServer\ETS2Docs"


By default in your \Documents\Euro Truck Simulator 2 following file should be created:

server_config.sii
- contains session description and configuration, connections ports info, logon token and list of moderators
- ports and logon token must be different for each session instance running at the same time
- default configuration is generated automatically


Open it up and start editing as you wishes.

Note:
If you have set a homedir, you must put following files in there:
server_packages.dat
server_packages.sii
Required files to run dedicated server
In the server/game home folder the following files are used to set up a dedicated server session:

server_config.sii

contains session description and configuration, connections ports info, logon token and list of moderators
ports and logon token must be different for each session instance running at the same time
default configuration, which is generated automatically on first launch
server_packages.sii

contains map details, dlc and mods configuration
server_packages.dat

contains internal map data
server_packages.sii and server_packages.dat must be generated manually via calling the `export_server_packages` command while normal game is running. Generated configuration will mirror your game configuration. These files are necessary for a dedicated server to start. If you are running a server without the base game installed on it, you have to manually copy these files to the server home directory.

These files are NOT linked to your account in any way.
Adding Moderators
Please note that the following entry already exists:

moderator_list: 0


Add following to "server_config.sii":

moderator_list: 2
moderator_list[0]: 123456789
moderator_list[1]: 234567891
(steamID64)


like:

moderator_list: 2
moderator_list[0]: 76561198001220177
moderator_list[1]: 76561198001245683


Any player who is a moderator can now change the game time. This can be done via chat message box by sending message `/set_time HH:MM'


Hint:

Find your SteamID64 here: https://www.steamidfinder.com/
Server Commands
Any player who is a moderator can now change the game time or disable rain. This can be done via chat message box by sending a message containing an admin command. Available admin commands are

/set_time <HH:MM>
/set_rain_factor <value from 0 to 1>
/help
Server Logon Token - Steam Gameserver Token
By default whenever a dedicated server is launched it is using an anonymous account. For such an account non-persistent server id is generated (used for direct search). To avoid this you can acquire a logon token on https://steamproxy.net/dev/managegameservers (game ownership is required).


Enter the token in following value in "server_config.sii":

server_logon_token: "TOKEN HERE"
How to launch a dedicated server
You can launch the dedicated server by directly starting its executable. Game ownership is not required. If you want to launch a server with different configuration, use following startup parameters:

-homedir "set a home directory"
-server "server packages file name"
-server_cfg "server config file name"
-nosingle (enables multiple instances of server, will be default in next patch)


Exemple for a Single Server and homedir:
eurotrucks2_server.exe -homedir "C:\GameServer\ETS2Docs\"

Exemple for a none Single Server and homedir:
eurotrucks2_server.exe -nosingle -homedir "C:\GameServer\ETS2Docs2\"

Exemple for a none Single Server, different server files and no homedir:
eurotrucks2_server.exe -nosingle -server "server_packages_en.sii" -server_cfg "server_config_en.sii"

No homedir means, the gameserver will use the default location, Documents Euro Truck Simulator 2.

You do not need to rename the server files if you set a -homedir if you want to setup multible instances.
Port Forwarding & Firewall Whitelist
Dedicated server does not handle NAT punching and public IP or port forwarding is required to show server in session browser.
However, session direct search works even for server that is behind NAT and it is possible to connect to such server.

Search id is listed when starting dedicated server or in convoy info screen for hosted sessions.


You need to open following ports:

TCP Port: 27015-27016
UDP Port: 27015-27016


If you run it on a Root or VPS you only must add it to your Firewall. If local pc then both.
Hint for Root or VPS users
You do not have the ETS 2 folder in your documents at your Root or VPS. If you installed the Server, just start it once to generate the ETS 2 documents folder.

And yeah its clear to understand i mean, that you need to copy the server packages to the Root or VPS ETS 2 documents folder.

Or if you have set a homedir then there.
Useful: Auto Restarter on Server Crash
Create a .bat file where "eurotrucks2_server.exe" is located and paste following:

::Made by eRazeri @echo off C:\Windows\System32\mode con cols=50 lines=3 >nul set /a var=0 :start echo Running ETS 2 Server start "" /wait /HIGH "eurotrucks2_server.exe" set /a var+=1 cls echo Server has crashed %var% times, restarting goto start
6 Comments
ASH 18 May @ 1:26am 
if anyone know how can i change game version for servers plz help me
MaDmaX  [author] 13 Dec, 2023 @ 9:04am 
Also ich aktualisiere mein Server immer mit SteamCMD manuell. Hieße ich Stop den Server und update ihn und danach starte ich ihn wieder.

Müsstest dich an Google wenden um in Erfahrung zu bringen wie du mit Cronjob ein Update für Dedicated Server über Steam oder SteamCMD einrichtest. Hab leider damit keine Erfahrung bisher. Sorry.
DIMA™ 10 Dec, 2023 @ 4:37pm 
Wie kann ich einen Cronjob einrichten, der mein Server automatisch aktualisiert und neu startet, wenn es Server Updates gibt? Oder wie habt ihr das bei euch gelöst?
DIMA™ 10 Dec, 2023 @ 4:34pm 
Alex hier ist mein Code für Ubuntu:

#!/bin/bash

var=0

while true; do
echo "Running ETS 2 Server"
cd "/home/kazap196/.steam/SteamApps/common/EuroTruckSimulator2DedicatedServer/bin/linux_x64/" && sh server_launch.sh # Hier solltest du den tatsächlichen Befehl zum Starten des Servers einfügen
var=$((var + 1))
echo "Der Server ist $var Mal abgestürzt und wird neu gestartet."
sleep 60 # Du kannst die Schlafdauer anpassen, je nach Bedarf
done
Alex 10 Dec, 2023 @ 4:16pm 
can be written for linux Auto Restarter on Server Crash
🅾️rder💲 13 Feb, 2023 @ 3:38am 
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⡶⢶⣦⡀
⠀⠀⠀⣴⡿⠟⠷⠆⣠⠋⠀⠀⠀⢸⣿
⠀⠀⠀⣿⡄⠀⠀⠀⠈⠀⠀⠀⠀⣾⡿
⠀⠀⠀⠹⣿⣦⡀⠀⠀⠀⠀⢀⣾⣿ㅤㅤThe message was sent using the extension.
⠀⠀⠀⠀⠈⠻⣿⣷⣦⣀⣠⣾⡿ ㅤㅤ Rated :heart_me:
⠀⠀⠀⠀⠀⠀⠀⠉⠻⢿⡿⠟ㅤㅤㅤㅤ Group