If you would like to support multiple servers/configs running on the same host, there are a few things you need to do:
- Launch each server on a separate port, this should be done 20 ports higher than the previous server.
So if we have server 1 on port 27015, the next one should use port 27035. - Have our server use separate configuration files (This includes server config and mapcycle/motd files, if desired).
We are going to create in this example two servers. Server one will be called 'Example #1 - Dust Only' which will only run the popular Dust map, and server 2, 'Example #2 - All Maps', which will run every map in our rotation.
Each of these two servers will have a different map rotation and configuration file, and both will be running CS: Source.
To have this guide work for hl2 deathmatch servers, simply replace references to 'cstrike' with 'hl2mp'.
Important: You must either DELETE cstrike/cfg/server.cfg from your servers game directory in order for this setup to work correctly, OR, have the files contents only contain:
Code:
exec banned_ip.fg
exec_banned_user.cfg
This is because server.cfg is executed on every map change by srcds, and you cannot tell srcds NOT to execute the file, so to prevent settings in this file overwriting our multiple server config files, we either delete the file itself, or just leave the banned commands in (so the banlists are executed on map change).
It is best to just erase the file and leave:
Code:
exec banned_user.cfg
exec banned_ip.cfg
It is also safe to simply delete this file, but you will not have the benefit of the banned list files being re-read on each map change.
Step 1
If not already done, delete cstrike/cfg/server.cfg
Step 2
Now we create server 1's configuration file. Create a new file called server1.cfg in cstrike/cfg (So its accessable in cstrike/cfg/server1.cfg).
Heres what it looks like in our example:
Items in bold you should take note of, as you should change these values in each config file you make for multiple servers.
Code:
// server name
hostname "Example #1 - Dust Only"
// server admin (rcon) passsword
rcon_password "adminpass"
// server join password
sv_password ""
// Advanced RCON
sv_rcon_banpenalty 15
sv_rcon_maxfailures 5
sv_rcon_minfailures 5
sv_rcon_minfailuretime 30
// server cvars
mp_footsteps 1
// only allow 1 player difference between teams
mp_limitteams 1
mp_autoteambalance 1
mp_autokick 0
mp_flashlight 1
mp_tkpunish 1
mp_forcecamera 0
sv_alltalk 0
sv_pausable 0
sv_cheats 0
sv_consistency 1
sv_allowupload 1
sv_allowdownload 1
sv_maxspeed 320
mp_limitteams 2
mp_hostagepenalty 5
sv_voiceenable 1
mp_allowspectators 1
mp_chattime 10
sv_timeout 65
// round specific cvars
mp_freezetime 4
mp_timelimit "25"
mp_roundtime "3"
mp_maxrounds "20"
mp_startmoney "800"
mp_c4timer "45"
mp_fraglimit 0
mp_maxrounds 20
mp_winlimit "10"
mp_playerid 0
mp_spawnprotectiontime 5
mp_friendlyfire "0"
// bandwidth rates/settings
sv_minrate 3000
sv_maxrate 20000
decalfrequency 60
sv_maxupdaterate 100
sv_minupdaterate 30
// server logging
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 0
//Specify that we want this specific servers logs placed in a folder called logs/server1
//to separate them from another servers logs
sv_logsdir "logs/server1"
log 1
// operation
sv_lan 0
// region the server should appear in under the steam browser
sv_region 0
sv_contact "www.example.com"
// map cycle for this server
mapcyclefile "mapcycleserver1.cfg"
// motd file for this server
// Note: You could simply have this as motd.txt in all config files, so that all servers share the same config file
// This is just an example so you know how to specify individual ones if necessary
motdfile "motdserver1.txt"
// execute our banned suer files
exec banned_user.cfg
exec banned_ip.cfg
// launch our starting map, in this case, de_dust
map de_dust
- A hostname of "Example #1 - Dust Only"
- Place all log files for this server in the folder logs/server1 (If this directory does not exist at runtime, it will be created by srcds)
- Use the map cycle listed in cstrike/mapcycleserver1.cfg
Note: Its cstrike/ not cstrike/cfg/ for map cycles and motd files)[/b] - Use a MOTD (Message of the Day, the welcome screen you get when joining your server) in cstrike/motdserver1.txt (Once again, cstrike/ not cstrike/cfg/ for this file)
- And launch our starting map, cs_office
Create cstrike/mapcycleserver1.cfg (As per our config file we just made) and in it we would have:
Code:
de_dust
Next, create our MOTD file in cstrike/motdserver1.txt
Code:
Welcome to my 24/7 Dust only server!
Code:
<html>
<b>Welcome to my 24/7 Dust only server!</b>
</html>
Alternativly, you can specify a URL in the MOTD file on its own line as follows:
Code:
http://www.mydomain.com/motd.html
Step 3
Time to launch our newly created server.
To confirm the directory and file structure, you should have:
~/srcds_l/srcds_run
~/srcds_l/steam
~/srcds_l/cstrike/motdserver1.txt
~/srcds_l/cstrike/mapcycleserver1.cfg
~/srcds_l/cstrike/cfg/server1.cfg
Notice how only the server configuration file is in the /cfg folder, the other two files reside in the /cstrike folder.
To launch our server, now type from ~/srcds_l:
Code:
./srcds_run -console -game cstrike -port 27015 +ip 123.123.123.123 +map de_dust +maxplayers 14 +exec server1.cfg
Code:
-console
--> Enable console mode/view
-game cstrike
--> Which game we are making a server for (cstrike or hl2mp)
-port 27015
--> Which port this server should be accessable on. We are using the default of 27015 for our first server.
+ip 123.123.123.123
--> Bind IP Address of this server. This should be your external IP Address, not LAN address.
--> Having this set incorrectly could cause people not being able to join your server, or have 'RCON Not working' via HLSW or ingame console (Connection refused errors).
+map de_dust
--> Which map to start the server on, we already have this defined in our config file, but we do it again in the command line for good measure.
+maxplayers 14
--> How many players may join this server.
+exec server1.cfg
--> The almighty configuration file for this server, we tell srcds to execute this file on startup and load the servers settings.
To create our second server, we would repeat the above steps, but instead of creating motdserver1.txt, mapcycleserver1.cfg and server1.cfg, we would call the files motdserver2.txt, mapcycleserver2.cfg and server2.cfg
Then, we would launch the server like so:
Code:
./srcds_run -console -game cstrike -port 27035 +ip 123.123.123.123 +map de_dust +maxplayers 14 +exec server2.cfg
The -port command now has a parameter of 27035 (thats 20 ports higher than our first server, 27015).
You cannot simply have the next server one port higher, as srcds uses several ports higher for other services than its game port. 20 ports is a safe number to use.
Secondly, we now have +exec server2.cfg, telling the server to execute server2's configuration file, loading a different set of preferences and settings, map rotation and motd file.
To setup the second server, our configuration file would be the same as server1's except we would change thehostname, sv_logsdir, mapcyclefile and motdfile variables to accomodate a different set of settings.
In our mapcycle file for server 2, instead of listing just de_dust (which was our mapcycle for server #1's 'Dust only' server), we would list all of the maps on a new line such as:
Code:
de_dust
de_port
cs_office
...etc
Thats all!
I hope this guide has been helpful.