Dedicated Server

From NS2 community wiki
Jump to: navigation, search

Hardware Requirements

There are no official hardware requirements for running an NS2 server. However, you can read this thread to see how popular decent servers perform under their hardware: NS2 Server Specs and Performance

The community recommends the following hardware (per server instance):

Maxplayers Min. Clock Speed Min. RAM Bandwidth (down/up)
12 3.0GHz 2GB [to be updated]
16 3.6GHz 2GB [to be updated]
20 4.0GHz 2GB [to be updated]
24 4.4GHz 2GB [to be updated]

The NS2 Server software is constantly being improved. However, it is currently not fully optimized to make use of multiple cores on your system. At best, it uses 2 threads, of which 1 will handle the main processing. As such, most decent NS2 Server providers commonly run their servers on overclocked consumer-grade systems as opposed to multi-core server-grade systems. e.g. NS2 Servers which handle 24 players are typically clocked at least 4.4GHz on an Intel i7/i5 core.

Vanilla NS2 servers take between 500-700MB of RAM upon starting the Server, as it caches the animations and models. 2GB of RAM per server instance is a good amount to have.

You can monitor the performance of your server through the Web Administration system, under the Performance graph.
(Note that the tickrate currently doesn't go above 30. Its a calculation error if it does go above 30)


To install a Natural Selection 2 server you must use Valve's Steam Console Client (SteamCMD). This wiki guide will help you through the process of using SteamCMD but if you would like more info about SteamCMD visit

Windows Setup Windows Setup


Depending on what version of Windows the server is hosted from it will automatically lower its tick rate depending upon the number of connected players. Weirdest tick rate issue on Windows Server 2012 R2 (05-02-2015, build 274)

Version Tick rate Note
Windows XP unknown XP is a security risk as it is not receiving updates. Use a more modern OS.
Windows Vista unknown
Windows 7 30
Windows Server 2008 unknown
Windows 8 and 8.1 unknown
Windows Server 2012 unknown
Windows Server 2012 R2 Starts at 12-15 Will go up to 30 once there is enough players.


In order to run a Natural Selection 2 dedicated server, you need to install following:

  * PhysX Redist
  * DirectX Redist
  * Microsoft Visual C++ 2005 Redistributable Package (x86)

Install via SteamCmd Installing SteamCMD on Windows

  • Download - SteamCMD for Windows
  • Extract the contents to the folder that you want to run SteamCMD from.
    • A folder called C://steamcmd is recommended.
    • Your SteamCMD folder should only contain SteamCMD and not the Natural Selection 2 server files.
  • Create a new Steam account just for your dedicated server.
    • You do not have to purchase the Natural Selection 2 Client on this account.
    • You can use this account for multiple servers.
    • DO NOT use use your personal steam account as passwords are kept in plain text on the server.
  • Open a Command Prompt, cd to the folder where steamcmd.exe is located.
  • Run >steamcmd.exe
    • On the first run, it will download the latest version of itself
    • If you are unable to download the files, try lowering your Internet Options Security Settings to Medium, and checking the "Automatically detect settings" in the proxy options.
  • Type the following replacing username and password with your steam server account
  login username password

If Steam Guard is enabled on this account, you will be prompted to enter your Steam Guard code. Which you will receive via email.

Installing NS2 Dedicated Server with SteamCMD

NS2 Dedicated Server App ID: 4940

Login to SteamCMD as stated above

Set the folder you want Natural Selection 2 to be installed.

force_install_dir C:\NS2Server\

Download the server files to the folder

app_update 4940 validate

Running NS2 Server

  • Browse to the Natural Selection 2 server folder.
  • Create a shortcut for Server.exe
  • Edit the shortcut like so.
Server.exe -name "Server Name" -limit 16

For advanced configuration see #Server Configuration.

Simplifying the Update Process

  • After having logged in to SteamCmd at least once,
  • In your SteamCmd directory, create a file with the following contents:
  # Replace username, password, and C:\NS2Server\ as appropriate
  SteamCmd.exe +login username password +force_install_dir C:\NS2Server\ +app_update 4940 validate +quit
  • Save this file as "updateserver.cmd". If you're using notepad, make sure you change the file type to 'All Files', and include the quotes around the file name.
  • Run this file whenever you need to update your server.

Running multiple servers per machine

  • As of build 220, each dedicated server can make use of its own config directory. This is defined by the -config_path option during launch.
  • For example
    • First Server:
    • Server.exe -name "NS2 Server 1" -config_path "C:\NS2Server-1\config" -file "C:\NS2Server-1\config\server1.txt"
    • Second Server:
    • Server.exe -name "NS2 Server 2" -config_path "C:\NS2Server-2\config" -file "C:\NS2Server-2\config\server2.txt"
  • By default, if config_path is not set, the Server.exe will look in "%APPDATA%\Natural Selection 2\" for your config files
    • (NOT "%APPDATA%\Natural Selection 2\config\" as it was prior to build 220)
  • It may be worthy to note that the servers can share a common mod directory (-modstorage) and load mods from this same directory.

Linux Setup Linux Setup

Since patch 253 Linux dedicated server has been available.


  • Ensure the correct dependencies are installed before installing the server.


Ubuntu 32-bit

apt-get install speex:i386 libgtk2.0-0:i386

Ubuntu 64-bit

apt-get install speex:i386 libgtk2.0-0:i386 lib32gcc1


Debian 32-bit

apt-get install speex:i386 libgtk2.0-0:i386

Debian 64-bit

dpkg --add-architecture i386
apt-get update
apt-get install speex:i386 libgtk2.0-0:i386 lib32gcc1


CentOS 32-bit

yum install speex.i686

CentOS 64-bit

yum install speex.i686 glibc.i686 libstdc++.i686

GLIBC_2.15 error

You might get the following error if you try to start your server.

./server_linux32: /lib/i386-linux-gnu/i686/cmov/ version `GLIBC_2.15' not found (required by /root/Steam/NS2/ns2/

To fix this download the following files to the main server directory.



Create a username for your server. Template:Warn

adduser ns2server

Chose a directory to install the server.

cd /home/ns2server

Create a directory for steamCMD.

mkdir steamcmd
cd steamcmd

Download SteamCMD.


Extract steamCMD.

tar -xvzf steamcmd_linux.tar.gz

Create a directory for the server files,

mkdir /home/ns2server/serverfiles

Run the following command to download the server. You will need a Steam username and password to authenticate with steamCMD. Template:Warn

./ +login username password +force_install_dir "/home/ns2server/serverfiles" +app_update 4940 validate +quit

NS2 Dedicated Server App ID: 4940
Login to SteamCMD as stated above

Set the folder you want Natural Selection 2 to be installed.

force_install_dir /home/ns2server/serverfiles

Download the server files to the folder

app_update 4940 validate

Running the server

Linux executable is ./server_linux32 in the main installation directory. Otherwise process should be same as under windows.

Some parameters for the server start have to be put in quotes like -name "NS2 server".

For Linux it is important to escape those quotation marks with a backslash, otherwise it will be ignored.

Here's an example of a basic working Linux server startup line:

./server_linux32 -name \"NS2 Server\" -port 27015 -webadmin -webdomain "" -webuser admin -webpassword password -webport 8080 -map ns2_summit -limit 24

Note: The -file option currently does not work with a Linux server.

ns2server Linux server management script

by Daniel Gibbs
ns2server is a command line tool for quick, simple deployment and management of a Natural Selection 2 Linux dedicated server.

Main features

  • Server installer (SteamCMD)
  • Start/Stop/Restart server
  • Server update (SteamCMD)
  • Server monitor (including email notification)
  • Server backup
  • Server console

Full instructions available there:
GitHub Repo:


  • You need to ensure that ports 27015 and 27016 are open on your firewall.
  • If your server is on a LAN you may need to setup port forwarding to the server. is a useful resource for this.

Server Console

You can access the server console by selecting the active server window, hitting tab (to bring up the console window) and then ~ (tilde) (to bring up the console command line).

Server Configuration

Basic Configuration

Note: From Build 222 onward, server.xml is no longer used and a text file containing command-line options is used instead.

When loading command line options from a file using the -file option, the format of the file is the same as you would normally specify on the command line. Newlines can be used to separate command line parameters and C++ style comments are also supported.

Most server options can be specified on either the command line, or in the configuration file. If they exist in both places, the values on the command line will take precedence, although the values in the configuration file must be valid as it will still be parsed.

Note that for relative paths, they will be taken relative to the current working directory.

Command Line Setting Configuration File Setting Values Description
-file N/A path Specifies a file to load command line options from
-ip IP Address Sets the IP that the server will listen on (omit if you do not know what this means)
-port integer Sets the port the server will run on. (Default: 27015)
NS2 also requires the next available port in order for master server communication to work
-limit integer Maximum number of players the server will allow (max is 24)
-password string Specifies a password for clients connecting to the server (omit to remove password protection)
-name string Specifies the server name to be shown in the server browser. Many server operators also include the core and clock speed in the name as it affects players' performance in-game.
(e.g.'i7 4.4GHz')
-modstorage path Specifies the directory where mods from the Steam Workshop will be downloaded and loaded from. If not set, defaults to "%APPDATA%\Natural Selection 2\Workshop".
(See Setting Up Mods)
-config_path path Specifies the directory that will be mapped to config://, i.e. where your JSON configuration files are found. If not set, defaults to "%APPDATA%\Natural Selection 2\".
-logdir path Specifies the directory for the server's log.txt file. If not set, defaults to "%APPDATA%\Natural Selection 2\".
-map map name (e.g: ns2_tram) Inital map that the server starts on. Will default to ns2_summit if not set.
-mods List of mod ids This should be a list of space separated mod ids that are active on this server.
There is a command-line interface for this option. Please see Dedicated_Server_Usage.txt in your server directory.
As of B222, the Steam Account used no longer requires access to the NS2 Steam Workshop
-webadmin N/A See Web Administration. If specified, runs the built-in web interface.
Omit this option to disable
-webdomain "string" This string must be covered in double-quotes. Defines a web address to allow remote connections to the web interface from. If you want to use an IP address you have to set this to you internal IP (e.g. If not set, the web server will only accept connections from localhost.
-webport integer Set the port the web administration system should listen on. (Default: 80)
-webuser string Specifies the user name for logging into the web server (Single-user mode)
-webpassword string Specifies the password for logging into the web server (Single-user mode)
-webusers path Loads username/password data from the specified .htpasswd file (Multi-user mode)
-record N/A Unknown
-play N/A Unknown
-console N/A Displays the interactive console on startup. Press tilde key (~) to display console after grey window appears.
This is the only way to reach the console if you are using Wine on Linux to run the server.

Command Line examples:

Server.exe -map ns2_tram -limit 16
Server.exe -file "c:\my servers\config.txt" -map ns2_tram -name "NS2 Server"
Server.exe -file "C:\NS2Server\server.txt"

See Console Commands for a list of available commands.

Map Rotation

As of Build 220, the mapcycle system has changed to make use of MapCycle.json. The old mapcycle.txt file is no longer used.

You can find more information in your Dedicated_Server_Usage.txt file:

  • The server can be configured to cycle through a list of maps by creating a file called MapCycle.json in your server config directory.
  • This file defines the amount of time (in minutes) to wait before switching maps.
  • It will only switch maps after a round completes.
  • It also defines a mode which can be either "order" or "random".
  • It then defines a list of maps to cycle.
  • This also allows for custom maps from the Steam Workshop to be loaded by the server.
    • In order for this to work, you need to include the mod ID in the map item.
    • An example of this is shown in the example map cycle file below.
  • Avoid listing the same map twice in "order" mode.
  • On the server, the cyclemap console command can be used to force the server to switch to the next map in the map cycle.
  • Here is an example map cycle file:
    "time": 30,
    "mode": "order",
        {"map": "ns2_tanith", "mods": ["4B430CC"]},
        {"map": "ns2_jambi", "mods": ["7B986F5"]}
  • In order for custom maps to work when loaded this way they must have been loaded at least once before through the start-up command line options. E.g. -mods "7B986F5".

Web Administration

The dedicated server includes a web server which can be used to configure the server.

To use the web admin interface, start the dedicated server with the -webadmin command line option and open http://localhost/index.html in your browser. This web administration is based on devicenull's ns2web.

If you're trying to reach the interface from a distant machine, open http://[webdomain]/index.html instead, [webdomain] being the name you set with the -webdomain option. If you are using a different webport than 80, don't forget to add it after the domain name : http://[webdomain]:[webport]/index.html.

Command line settings relevant for enabling web administration:

 -webadmin (specifies whether web administration is active - omit to disable)
 -webdomain "[name/IP]" (quotes required! - specifies the web server's domain name to allow remote connections. Most of the time, this is the server's IP adress)
 -webport [number] (default is 80)

If you are going to access the web server from an internet address, you will need to specify the address of the server using the -webdomain command line option.

If you have multiple IP addresses, this can also be used to select which one the web server will be bound to. You can also run multiple web servers on the same machine on different ports using -webport.

If you would like to access the web admin interface from a remote computer, you will need to set up web authentication using one of the two following methods.

Single-user Authentication

By using the -webuser and -webpassword options login information for a single user is set up.

This info needs to be entered when your web browser prompts you for log in information.

Multi-user Authentication

If you would like to set up multiple users or do not want the password to be stored in plaintext, you can specify a .htpasswd file using the -webusers command line option. A .htpasswd file can be generated using the same tools you would use for configuring an Apache web server. An online tool is available here:

When using this tool, you will want to set the encryption mode to digest and the realm or popup name to whatever you specify for the -webdomain parameter (or localhost if you don't specify webdomain).

(Note that there is an error in the documentation in B228 that instructs you to use the MD5 encryption mode. This is erroneous, as stated by the developers.)


The web server returns JSON-formatted content about the server when you are not requesting a static file. i.e. http://localhost/

You can also run RCON commands via standard GET requests. Example:


The response is only shown on the server console.

Server Admin System

Basic Overview

As of B211 an integrated server administration system allows server owners to grant users or groups the ability to execute commands in game (such as kicking players and changing maps)

Configuration File Locations

By default, Server.exe will use the following file structure:

  %APPDATA%/Natural Selection 2/
  \  ServerAdmin.json
  \  ServerConfig.json
  \  BannedPlayers.json
  \  MapCycle.json
  \  ConsistencyConfig.json

You can change the location of your Configuration Files by using the -config_path command line option

    • You can supply an absolute path to your config folder (WITHOUT trailing slash)
    • For example, -config_path "C:\NS2Server\config"

The *.json files will be created for you if they do not exist on first launch.


This file lets you define users and groups. Each group can either have a whitelist (only commands on this list can be executed) or blacklist (any commands except the ones on this list can be executed).


        "admin_group": { "type": "allowed", "commands": [ "sv_changemap", "sv_reset", "sv_say" ] },
        "mod_group": { "type": "disallowed", "commands": [ "sv_ban", "sv_reset" ] },
        "clan_group": { "type": "allowed", "commands": [ "sv_kick", "sv_say" ] }
        "Sr. Lance": { "id": 1838634, "groups": [ "admin_group" ] },
        "Murphy": { "id": 11641641, "groups": [ "mod_group" ] },
        "SabaHell": { "id": 3403402, "groups": [ "clan_group" ] }

This example would create the following groups:

  • admin_group: Able to execute sv_changemap, sv_reset, sv_say
  • mod_group: Able to execute any commands except for sv_ban and sv_reset
  • clan_group: Able to execute sv_kick and sv_say

It also defines the following users:

  • Sr. Lance, STEAM_0:0:919317, member of 'admin_group'
  • Murphy, STEAM_0:1:5820820, member of 'mod_group'
  • SabaHell, STEAM_0:0:1701701, member of 'clan_group'

SteamID Format

NS2 does not use the usual SteamID format. If you have your old SteamID (from the 'status' command in a game like TF2), you can convert it to a NS2 style SteamID using the following formulas:

  STEAM_0:0:XXXXX :(SteamID * 2)
  STEAM_0:1:XXXXX :(SteamID * 2 + 1)


  STEAM_0:0:919317: 919317 * 2 = 1838634 
  STEAM_0:1:919317: 919317 * 2 + 1 = 1838635

If you have difficulties,

just enter your SteamID, the 32-bit Steam Community ID of the output is your NS2 SteamID.
Click "upload with new input" and enter your old-style SteamIDs, one per line.


As of Build 220, this file is used to configure certain gameplay aspects of the server.

  • By default, the contents created by the NS2 Server is as follows:
  "settings": {
    "rookie_friendly": true,
    "end_round_on_team_unbalance": 0.4,
    "auto_team_balance": {
      "enabled_after_seconds": 10,
      "enabled_on_unbalance_amount": 2
  "tags": [ "rookie" ]
  • The explanation of each value is as follows:
    • "rookie_friendly"
      • Rookie Mode as announced on the Forums
      • There is the new “rookie mode” system in Build 220.
      • Servers indicate if they are “rookie friendly” or not by setting the value to true and adding the "rookie" tag
      • In order to remove your server from being tagged as Rookie-friendly, you have to remove the tag "rookie" in addition to changing "rookie_friendly" to false.
    • "auto_team_balance"
      • Auto Team Balance System
      • enabled_on_unbalance_amount is how many player(s) over perfect team balance there needs to be on one team for the system to kick in.
        • For example, with 2, there would have to be 10 players on one team and 8 on the other for the system to turn on.
      • enabled_after_seconds is how long to wait after the enabled_on_unbalance_amount condition is met before the system is turned on.
        • This allows there to be a little buffer in case another player joins the server soon or people are switching teams before the system is turned on.
        • You can set this to 0 if you don't want any delay.
      • Players will NOT automatically be switched teams with this system. Instead, the game will try to maintain the same number of players on the field when teams are unbalanced.
      • So if the Marines have 10 players and the Aliens have 8, when a Marine player dies, they will be in a special spectator mode until there are only 7 players alive.
        • At which point, the player who has waited the longest in this mode will be spawned like normal.
      • A player in this mode can also choose to switch teams without penalty.
      • There is also a server admin command that can be used to control this system: sv_autobalance <true/false> <num players> <seconds>
    • "end_round_on_team_unbalance"
      • Round End on Unbalance as announced on the Forums
      • By default, the server will end the round if the teams are too unbalanced.
      • The number defines how unbalanced the teams are before the round is ended.
      • With 0.4 (default), the round will end when the teams are 40% unbalanced.
      • For example, if the Marines have 16 players and the Aliens have 9, the round will end.
      • To disable this, either set the value to 0 or remove the line completely.
    • "tags"
      • This is to help your server be more easily searched for in the server browser.
      • Defaults to "ns2"


Important: Do not edit this file while the server is running. Your changes will be overwritten.


    { "name": "Murphy", "id": 11641641, "reason": "Recycled Base", "time": 1903827289 }

The format of each ban list entry should be pretty self-explanatory. The "time" field is a unix style timestamp at which the ban will expire. This will be 0 for permanent bans.

You can add and remove bans using sv_ban and sv_unban.


See Map Rotation


  • This file should automatically be created by the Server if it does not already exist.
  • By default, the checks in general are for a Vanilla NS2 installation:
  "restrict": [ "lua/entry/*.entry" ],
  "check": [ "game_setup.xml", "*.lua", "*.hlsl", "*.shader", "*.screenfx", "*.surface_shader", "*.fxh",
  "*.render_setup", "*.shader_template", "*.level", "*.dds", "*.jpg", "*.png", "*.cinematic",
  "*.material", "*.model", "*.animation_graph", "*.polygons", "*.fev", "*.fsb" ],
  "ignore": [ "ui/*.dds", "*_view*.dds", "*_view*.material", "*_view*.model", "models/marine/hands/*" ]
  • However, if you would like to allow for a modification such as the Minimal Alien Vision, which modifies the file "shaders/DarkVision.fx", you can add that particular file to the ignore list, like so:
  "restrict": [ "lua/entry/*.entry" ],
  "check": [ "game_setup.xml", "*.lua", "*.hlsl", "*.shader", "*.screenfx", "*.surface_shader", "*.fxh",
  "*.render_setup", "*.shader_template", "*.level", "*.dds", "*.jpg", "*.png", "*.cinematic",
  "*.material", "*.model", "*.animation_graph", "*.polygons", "*.fev", "*.fsb" ],
  "ignore": [ "ui/*.dds", "*_view*.dds", "*_view*.material", "*_view*.model", "models/marine/hands/*",
  "shaders/DarkVision.fx" ]
  • This will then allow all clients who installed that mod to connect to your server.
  • If you did not include that file in the ignore list, then the client who has that mod installed will get kicked, with the following message: "Client and server differ"

Server Admin Commands

Unless otherwise indicated, 'PLAYER' refers to a players in game id, SteamID, or name.

Command Parameters Description
sv_ban <PLAYER> <minutes> <reason> Bans a player from the server. Use 0 for minutes for a permanent ban
sv_kick OR kick <PLAYER> Kick a player from the server.
sv_switchteam <PLAYER> <1|2> Force a player onto the specified team (1=Marines, 2=Aliens)
sv_rrall Force all players to readyroom
sv_randomall Randomly pick teams for all players in the readyroom
sv_eject <PLAYER> Eject a player from the hive/command chair
sv_help Show all commands a user has access to
sv_status OR status Show in game name, in game id, SteamID, for all connected players
sv_statusip Show in game name, in game id, SteamID, IP address for all connected players
sv_say OR say <message> Broadcast a message to all connected players as an admin
sv_tsay <1|2> <message> Broadcast a message to all members of the specified team (1=Marines, 2=Aliens)
sv_psay <PLAYER> <message> Send a private message to the specified player
sv_slay <PLAYER> Kill a player
sv_password <password> Add a password to the server. Use sv_password on its own to remove the current password
sv_unban <STEAMID> Unban a player from the server
sv_reset OR reset Reset the current round
sv_listbans Lists banned players
cyclemap Forces server to switch to the next map in the map cycle.
sv_autobalance <true/false> <num players> <seconds> Controls the #Auto-Team Balance System implemented in Build 221.
sv_changemap or changemap <map name> Changes the map and reloads mods
sv_cheats 0/1 Enables or disables cheats

Setting Up Mods

As of Build 221, NS2 now utilizes the Steam Workshop to install and use mods. This brings about an advantage with the Consistency Checking also implemented in B221, as if a file that does not pass the Consistency Check belongs to a particular mod, the mod will automatically be disabled and the original files loaded instead, allowing the client to continue connecting to the server with only server-approved mods.

Do note that for client-side mods, you do NOT necessarily need to have a mod installed in order to allow players to use the mod. For example, if you are allowing players to use the Minimal Alien Vision mod, then you should be looking whitelisting the file(s) that that mod modifies on #ConsistencyConfig.json instead.

Using Mods

  1. To use a mod you must know its mod ID. This is the hexadecimal representation of the mod's Steam Workshop ID.
    • You can use one of the many, many decimal-to-hex conversion websites (or Windows Calculator's programmer mode) to get a mod ID.
    • gives mod ID 706d242.
    • If you have already used the mod you want in the NS2 client, you can also find its ID as part of the folder names within %APPDATA%\Natural Selection 2\Workshop. Copy the characters between the 'm' and the underscore.
  2. To load mods onto your server, use the -mods parameter. This takes a quoted list of mod IDs, separated from each other by a space. For example:
    Server.exe -mods "706d242 812F004"
  3. For the server to keep using the selected mods you will also have to add them to the MapCycle.json file. Like this:
  4. When the server starts it will download and install each mod. It will update mods when changing maps.

Note Note: Custom maps added in this way will be downloaded by the client no matter which map the server is changing to. See the Map Rotation section for an example on how to do it properly.

Known Issues

For a list of known issues and possible work arounds, please see Dedicated_Server_Issues

Additional Questions

If you have any further questions, please check the Server Discussion Forum.

See Also