Watch the video:
Why the process is different
The process is only a little different from CS:GO’s dedicated server. Instead of downloading a seperate branch made specifically for hosting servers, at the time of CS2’s release: We need to use the same branch as the main release. There isn’t a dedicated server branch (740) like there was for CS:GO.
Downloading CS2 Dedicated Server
Currently there isn’t a “Dedicated Server” branch for CS2 like there was for CS:GO (App ID 740 instead of 730 [The game’s ID]).
There are 2 ways to get the game’s files:
- Download CS2 on Steam. Then Right-Click the game, and under the
Manage
seubmenu selectBrowse local files
. This should take you to where the game is installed. You should findcs2.exe
in<game install dir>\game\bin\win64\cs2.exe
. - Alternatively use SteamCMD to get the game’s files. Again this isn’t the dedicated server, it’s the game’s files so there’s no need to do this unless you need the files disconnected from your game (for modifications) or because you’re on a VPS or another device.
- Download SteamCMD for Windows here.
- Extract into a folder where you’ll install the server to in a folder called
steamcmd
. You don’t need to, but I’ll have this seperated from the game files to keep everything clean. For example:<server dir>\steamcmd\
. - Open a Command Prompt in the folder with
steamcmd.exe
by clicking the path at the top of your Windows Explorer and typingcmd
. Otherwise open a command prompt/terminal and usecd <server dir>\steamcmd\
. - Download CS2 into a folder called
server
, located at<server dir>\server\
by running the following command:steamcmd.exe +force_install_dir ../server/ +login <USERNAME> <PASSWORD> +app_update 730 validate +quit
- Remember to replace
<USERNAME>
and<PASSWORD>
with your Steam username and password. The game may be free, but currently you can’t just use+login anonymous
. - You may need to surround your password in quotes for it to work properly (
"
). - You may need to enter your Steam Guard Mobile Authenticator code if you have your account protected. You should need to do this as Steam Guard is a GOOD IDEA!
- Once complete you should see
CS2.exe
in<server dir>\server\game\bin\win64\cs2.exe
Make note of the path to CS2 for either installation method and create a server.bat
file to launch our server. In here we can set up a name and more.
Server ID
Now we need to get a server ID to allow our server to appear on the public server list (once everything is set up by Valve. I don’t think this works just yet).
You don’t technically need a “sv_setsteamaccount” but this should make sure complete compatability with friends over the internet, and even adding it to the server browser when that’s working.
Not to mention currently it seems server IDs invalidate themselves shortly after creation. Maybe Valve is planning something different for CS2?
- Head to the Manage Game Servers section on Steam.
- Enter
730
in theApp ID
section at the bottom - Enter a name like
CS2 server
to theMemo
section. - Click
Create
. - Copy the new ID on the list and make note of this. We will use this to replace
<SERVER_ID>
in the next step.
You should use another account regardless as launching the server may kick you offline on Steam. If this happens, create another <SERVER_ID>
with another acount. This account will need a registered phone number. In the future when we can use app id 740
this won’t be a requirement.
Creating server config & launch files
- Create a
server.bat
file by creating a new Text Document, renaming it toserver.bat
and removing.txt
. If you don’t see.txt
then make sure you enable File Extensions in Windows Explorer under theView
tab.- If you downloaded using SteamCMD, place this file in
<server dir>\server.bat
.
- If you downloaded using SteamCMD, place this file in
- Enter the following and save the bat file:
- If you used SteamCMD:server.batOnce again enter your username and password. Same as above. If you get an error about your password, consider surrounding it in quotes (
1 2 3
steamcmd\\steamcmd.exe +force_install_dir ../server/ +login <USERNAME> <PASSWORD> +app_update 730 validate +quit cd server\\game\\bin\\win64 start /wait cs2.exe -dedicated -usercon -console -secure -dev +game_type 0 +game_mode 1 +sv_logfile 1 -serverlogging +sv_setsteamaccount <SERVER_ID> +map de_inferno +exec server.cfg
"
) - If you are using your existing CS2 files in SteamApps:server.bat
1 2
cd "<CS2_PATH>" start /wait cs2.exe -dedicated -usercon -console -secure -dev +game_type 0 +game_mode 1 +sv_logfile 1 -serverlogging +sv_setsteamaccount <SERVER_ID> +map de_inferno +exec server.cfg
- Replace
<CS2_PATH>
with the full path, such asC:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\game\bin\win64
. If this contains spaces then make sure to surround the path with quotes as I have in the example above.
- Replace
- If you used SteamCMD:
Don’t forget to replace <SERVER_ID>
with the string from the previous section.
Again: You don’t technically need a “sv_setsteamaccount” but this should make sure complete compatability with friends over the internet, and even adding it to the server browser when that’s working.
Some other options to consider:
- Consider including
-ip <server IP>:<port>
if you want to change the port, or have mulitple network cards. - You can also change
-secure
to-insecure
to disable anti-cheat (Already added above). +sv_autobunnyhopping 1
to enable BHopping by holding jump+exec server.cfg
- (Already added above) Assuming you created a server.cfg file with options you’d like your server to use.
Steam CMD note:
When launching the server.bat
file for Steam CMD it should update the server making sure it will work online with the most up-to-date clients. You may be asked for your Steam Guard code. If so, you may want to create another account until the official CS2 Dedicated Server is released.
Creating a server.cfg
You can enter a TON of commands such as air strafe speed and more inside a server.cfg
file that executes when your server starts.
If you’ve made an autoexec.cfg
before, then it’s the same method.
- For Steam: Create a
server.cfg
file by renaming an empty.txt
file in<game install dir>\game\csgo\cfg\server.cfg
. - For SteamCMD: Create a
server.cfg
file by renaming an empty.txt
file in<server dir>\server\game\csgo\cfg\server.cfg
.
If you find some options aren’t setting once the server opens: Simply run exec server
in your server’s console window once it’s running.
|
|
The echo commands at the start and end make it easy to see if your config was run sucessfully.
Joining your new CS2 server
Simply open the console in-game and run connect 127.0.0.1:27015
or you should see your server on te LAN
tab of the server browser.
Letting others join your new CS2 server
This is simpler said than done. There are 2 sections and both need to be done to let friends over the internet play.
Open the server to LAN (Others on your local network)
To let someone on the same local network (router) as you play: You need to allow the CS2 server through your firewall.
We need to open ports 27015
and 27016
. If you set a custom port above, then forward that.
If you’re using a third-party antivirus with a firewall; you’ll need to look into how to open the ports.
If you’re using Windows Firewall (by default) then run the following commands in an Administrator Powershell
window.
|
|
If you ever wish to remove your Firewall rules for this, run the command: Remove-NetFirewallRule -DisplayName "CS2 Server"
This will open both of the ports and allow people on the same local network as you to connect to your server while it’s running.
All you need is your local IP address (Other devices on your network may be able to see you in the LAN
tab of the server browser as well).
To get your local IP:
- Run the following in a terminal/CMD/powershell window:
ipconfig
- Find the way you’re connected to the internet, for example
Ethernet adapter Ethernet
- Find the
IPv4
address and copy it - For example, your local IP is
192.168.1.10
Other devices can use this local IP address to connect to your server. Note: This is a LOCAL IP, and your server is not yet accessible over the internet or even routers outside of your own… That’s where we need to
Port Forward
Using your Local IP address we found above (and allowed ports through to) - We need to send traffic from these two ports to our computer.
If you’re using multiple routers in a chain before your computer reaches your fiber box/access box: You’ll need to port forward each router to the next until you finally port forward to your computer.
Port forwarding varies wildly from router to router, and you can look up guides specifically for your router. Essentially you’ll need to forward ports 27015
and 27016
on both TCP
and UDP
to your computer (or the next router on the way to your computer).
On most routers you can enter a range such as 27015-27016
, or enter them comma-seperated such as 27015,27016
, and even select TCP/UDP
instead of needing to create a rule for each type.
Let’s say you have just ONE router between you and the internet (Example: You’re connected directly to the fiber box), you’ll port forward as follows:
- Ports:
27015,27016
- Type:
TCP/UDP
- Destination:
192.168.1.10
Now you’re done port forwarding.
Letting others join
At this point you’ve allowed local traffic and over the internet to reach your CS2 server. All you need to do is let others join by checking the Server Browser in-game, or by getting your external IP address by Google searching “What is my IP”.
Others can then use the console to connect using connect xxx.xxx.xxx.xxx:27015
.
Have fun!