Team Fortress 2 Dedicated Server: How to Make a TF2 Server (Setup, Ports, server.cfg, Bots)

A Team Fortress 2 dedicated server is the free TF2 server program (Steam app 232250) running on its own machine, so your community has a server that stays up whether or not anyone is playing. To make a TF2 server you download it with SteamCMD, write a server.cfg, register a free Game Server Login Token so it shows in the server browser, open port 27015, and start it with a map. Plan on 2–4 GB of RAM for a real community server with plugins. This guide covers every step on Windows and Linux, then bots, Workshop maps, SourceMod, the popular community server types and the problems people hit.

Listen server vs. dedicated server

TF2 gives you two ways to host. The Create Server button on the main menu starts a listen server inside your own game client: quick, fine for a LAN or a few friends, but the server dies when you quit and your PC runs the game and the server at once. A dedicated server is a separate program with no graphics that runs around the clock, and it is what every community server in the browser is.

Listen server (Create Server) Dedicated server
Runs without you in game No Yes, 24/7
Plugins (SourceMod) Limited Yes, the standard way communities run them
Players A handful before your PC struggles Up to 32 on a normal setup
Best for Testing a map, LAN night A private server for friends or a public community

Team Fortress 2 dedicated server requirements

TF2’s server is light by modern standards, and the numbers below cover most setups. Valve’s own baseline for a Source server is 512 MB of RAM, with 1 GB enough for 60 slots, but it recommends 4 GB or more on current Windows. In practice a 24-slot server with SourceMod and a few custom maps sits at 2–4 GB.

  • RAM: 2–4 GB for the server. More plugins and bigger custom maps push you toward the top.
  • CPU: fast single-core speed matters more than core count. Each server instance is one busy game thread.
  • Disk: about 8 GB free for the server files, more if you collect custom maps.
  • OS: Windows, or Linux with glibc 2.3.6 or newer and the 32-bit compatibility libraries.
  • Network: a solid upload. The server sends far more than it receives, and a home line behind CGNAT can’t host at all.

How to make a TF2 server on Windows

On Windows the whole install is one SteamCMD command and one shortcut. SteamCMD logs in anonymously, so you don’t need to sign in with your own Steam account to download the files. Keep the server folder separate from the SteamCMD folder, or updates get messy.

  1. Download SteamCMD from Valve and unzip it to C:\steamcmd.
  2. Open a Command Prompt in that folder and download the server (the same line updates it later):
    steamcmd +force_install_dir C:\tf2_server +login anonymous +app_update 232250 validate +quit

    The first download is large and can take a while. Run it again until it reports Success! App '232250' fully installed. Save the line as update.bat so updating is a double-click.

  3. Create C:\tf2_server\tf\cfg\server.cfg (see the server.cfg section). Make sure Windows didn’t save it as server.cfg.txt.
  4. Create a shortcut to C:\tf2_server\srcds.exe with this target:
    "C:\tf2_server\srcds.exe" -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24 +sv_setsteamaccount YOURTOKEN

    Set Start in to C:\tf2_server, run it, and allow it through the Windows firewall when asked.

That starts a 24-slot pure server on 2Fort. Swap +map ctf_2fort for +randommap to start on a random map from your rotation.

TF2 Linux dedicated server setup

A TF2 Linux dedicated server is the usual choice for a server that runs for months. The server binary still needs 32-bit libraries, which is the cause of most failed first starts. Run it as its own user, never as root.

  1. Install the 32-bit libraries. On Debian or Ubuntu:
    sudo dpkg --add-architecture i386
    sudo apt update
    sudo apt install lib32z1 libncurses5:i386 libbz2-1.0:i386 lib32gcc-s1 lib32stdc++6 libtinfo5:i386 libcurl3-gnutls:i386 libsdl2-2.0-0:i386

    Package names vary on newer releases and other distros; install the equivalents.

  2. Create a user and install SteamCMD:
    sudo useradd --create-home gameserver
    sudo -iu gameserver
    mkdir ~/hlserver && cd ~/hlserver
    wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
    tar zxf steamcmd_linux.tar.gz
  3. Download the server:
    ./steamcmd.sh +force_install_dir ~/hlserver/tf2 +login anonymous +app_update 232250 +quit
  4. Write ~/hlserver/tf2/tf/cfg/server.cfg, then a launch script ~/hlserver/tf2/tf2.sh:
    #!/bin/sh
    cd ~/hlserver/tf2 || exit 1
    exec ./srcds_run -console -game tf +map ctf_2fort +sv_pure 1 +maxplayers 24 +sv_setsteamaccount YOURTOKEN

    chmod +x tf2.sh and start it inside screen -S tf2 ./tf2.sh so it survives your SSH session, or make it a systemd service so it starts on boot.

Prefer containers? The TF2 wiki points to the community cm2network/tf2 Docker image, which takes the token as SRCDS_TOKEN and updates itself on restart. LinuxGSM also manages TF2 servers with one script for install, start, stop and update. If you don’t want a Linux box at all, Team Fortress 2 server hosting gives you the same server with the install already done.

The Steam token: why your TF2 server isn’t in the browser

A TF2 server needs a Game Server Login Token (GSLT) to show up in the server browser; without one, friends can still type your IP, but nobody finds you by searching. The token is free and takes a minute to create, and it also lets the server download Workshop maps. Put it on the launch line with +sv_setsteamaccount.

  1. Go to Steam Game Server Account Management and sign in.
  2. Enter app ID 440 (Team Fortress 2, not the server’s 232250) and a memo such as “tf2 main”.
  3. Copy the token into your launch line. One token per running server.

Valve’s rules for the account: it must have TF2 in its library, a registered phone, and must not be limited or community banned. A token that sits unused for a long time expires, and resetting your Steam password regenerates all of them. If the console says Could not establish connection to Steam servers with result 18 or 106, regenerate the token.

TF2 dedicated server ports

Forward UDP 27015 for players and TCP 27015 if you use remote RCON; that’s all most servers need. Add UDP 27020 only if you run SourceTV for spectators. The other two ports are traffic the server starts itself, so a normal router lets them out.

Port Protocol Used for Change with
27015 UDP Game traffic and server browser queries -port
27015 TCP RCON (remote console) -port
27020 UDP SourceTV +tv_port (or turn it off with -nohltv)
27005 UDP Client port -clientport
26900 UDP, outgoing Steam -sport

Running a second server on the same machine? Give it -port 27016 and add -strictportbind, so it quits instead of silently grabbing the next free port. On Linux, open the ports with ufw allow 27015/udp and ufw allow 27020/udp.

TF2 server.cfg: the settings that matter

Your TF2 server config lives in tf/cfg/server.cfg, and the server runs it on every map change. Set the name, the passwords and the round rules there; anything you’d type into the server console can go in the file. Here is a working starting point with the settings you’ll actually touch:

// tf/cfg/server.cfg
hostname "Payload Night | 24 slots"
sv_password ""                 // set one to make it a private server
rcon_password "long-random-string"
sv_contact "[email protected]"
sv_region 3                    // 0 US east, 1 US west, 2 S. America, 3 Europe, 4 Asia, 5 Australia, 6 Middle East, 7 Africa, -1 world

mp_timelimit 30                // minutes per map, 0 = never rotate on a timer
mp_maxrounds 10
mp_autoteambalance 1
mp_teams_unbalance_limit 1
mp_idlemaxtime 5               // minutes before an idle player is dealt with
mp_idledealmethod 2            // 1 = move to spectator, 2 = kick

sv_allowupload 1               // sprays
sv_allowdownload 1             // custom maps and content
net_maxfilesize 15
sv_alltalk 0
sv_cheats 0
tf_birthday 0                  // party mode

Three more files sit next to it in tf/cfg: mapcycle.txt (one map name per line, no .bsp), motd.txt (the welcome screen, plain text or a URL, 2 KB max) and pure_server_whitelist.txt. Copy the _default versions as a start.

sv_pure and cheating

VAC is on unless you launch with -insecure, so leave that flag off. sv_pure decides which custom files players may load: 0 applies a minimal rule list, 1 applies the full list plus your whitelist (the usual community choice), and 2 forces official content only, which also blocks custom sprays. Tickrate is fixed on TF2, so ignore any guide that tells you to add -tickrate.

How to join your TF2 server (and invite friends to a private server)

Friends join by address: open the developer console and type connect with your IP and port. Your public IP is what people outside your home use; the server prints its own address in the console on start, in a line that begins Network: IP. For a private server with friends, set sv_password and share it with the IP.

connect 203.0.113.25:27015
password friends-only

Once they’ve joined once, the server is in their History tab, and right-click > Add server to favorites keeps it one click away. If you leave sv_password empty and have a token, anyone can search for your hostname in the community server browser. Players on your own network find it under the LAN tab.

Add bots to a TF2 server

TF2’s AI bots (TFBots) work on a dedicated server without cheats, and achievements stay on while they play. Add them from the server console or through RCON with tf_bot_add, or set a quota so the server tops itself up. Bots need a navigation mesh, which several official maps ship with; on other maps you generate one first.

Command What it does
tf_bot_add 3 heavyweapons red easy Adds three easy Heavy bots to RED. Every argument is optional: count, class, team, difficulty, name.
tf_bot_difficulty 2 Skill for bots added from now on: 0 easy, 1 normal (default), 2 hard, 3 expert.
tf_bot_quota 12 + tf_bot_quota_mode fill Keeps 12 players in the game, removing a bot each time a human joins.
tf_bot_quota_mode match Keeps a ratio instead: with quota 2, two bots per human.
tf_bot_join_after_player 0 Lets quota bots play on an empty server (default 1: they wait for a human).
tf_bot_kick all Removes every bot.

To use bots on a map without a nav mesh: set sv_cheats 1, run nav_generate, wait for the map to reload, then set sv_cheats 0 and restart so achievements come back on. The mesh is saved, so it’s a one-time job per map. Don’t edit the mesh with bots in the game; it tends to crash.

A note for Strange farming: kills on bots don’t raise a Strange weapon’s counter. Only a Strange Part: Robots Destroyed counts them. A bot server is great for practice and for a private server with bots when friends are offline, not for leveling Strange stats.

Custom maps and Workshop maps

A custom map is a .bsp file in tf/maps plus a line in mapcycle.txt. Workshop maps are easier: a server with a token fetches them itself when you change to them. The catch on custom maps is downloads. Players who don’t have the map must get it from your server, and the slow in-game download is where most people give up.

  • Workshop maps: use the map’s Workshop ID. changelevel workshop/123456789 loads it, and the same workshop/123456789 line works in mapcycle.txt. tf_workshop_map_sync 123456789 downloads it ahead of time so the first switch isn’t slow.
  • Fast download: for maps you host yourself, upload the map files to a web server and point sv_downloadurl at it, with sv_allowdownload 1. Clients then download at web speed instead of through the game connection.

Most community maps carry a prefix that tells players the mode: cp_, ctf_, pl_, plr_, koth_, arena_, mvm_.

SourceMod and plugins: how community servers get their modes

Almost every TF2 community server runs MetaMod:Source and SourceMod. They add admin tools (kick, ban, map votes) and load plugins that change the game. Install MetaMod first, then SourceMod, by extracting both into the tf folder so you end up with tf/addons/metamod and tf/addons/sourcemod.

  1. Restart the server completely and type meta list in the server console. SourceMod should be listed.
  2. Add yourself as admin: put "STEAM_0:1:12345" "99:z" (your Steam ID from the status command) on a new line in addons/sourcemod/configs/admins_simple.ini, then run sm_reloadadmins.
  3. In game, type sm_admin in the console (or !admin in chat) for the admin menu.
  4. Plugins are .smx files in addons/sourcemod/plugins. sm plugins list shows what loaded.

Valve updates sometimes break SourceMod until it catches up. A plugin built for a different SourceMod version can load without an error and then quietly stop working, so check addons/sourcemod/logs first when one feature dies after an update.

Look at the community server browser and most of what you see is a mode built from plugins and custom maps, not stock TF2. If you want to run one, this is roughly what each needs.

Server type What it is What you’d set up
Trade / trading server A hangout for TF2 trading: players swap hats, unusual effects and refined metal through Steam’s trade window while they chat, and traded items land in the in-game backpack and Steam inventory Trade maps, long or no time limit, chat plugins
MGE 1v1 duel arenas for Soldier and Demo practice An MGE plugin and an MGE map
DM / deathmatch Instant respawn, no objective, just fights Respawn and deathmatch plugins
Jump / rocket jump Jump maps where you practice rocket jumping and sticky jumping courses Jump maps, regen and checkpoint plugins
x10, x100, x1000, x10000 Silly servers where weapon stats are multiplied A multiplier plugin; expect balance to go out the window
Randomizer Random class and random weapons from any class’s loadout A randomizer plugin
Custom weapons Weapons that don’t exist in the stock game A custom weapon plugin with its config
Rebalance Stock weapons with changed stats, often older “pre-nerf” versions A weapon rebalance plugin
Achievement / idle Maps built to unlock achievements or to sit on Specific maps; raise mp_idlemaxtime or turn idle kicking off
Friendly A no-fighting hangout where players taunt, spray and chat Plugins that stop damage or mark players as friendly
Jailbreak, zombie, Saxton Hale, prop hunt, dodgeball, surf Whole game modes built by the community The mode’s plugin plus its own maps
Mann vs. Machine Valve’s co-op mode against robot waves, up to six players mvm_ maps and +maxplayers 32: the dedicated server exits on an MvM map with fewer
Map-specific (24/7 Hightower, 2Fort) One map, all day. Hightower is a Payload Race map A one-line mapcycle.txt

Want a server that plays like the old days? Medieval Mode is a cvar (tf_medieval 1) on a Medieval map. And TF2 Classified (formerly TF2 Classic) is a separate mod with its own server, not a TF2 plugin; see TF2 Classic server hosting for that one.

Useful TF2 server commands

These work in the server console, or from your game through RCON after rcon_password yourpassword. Start every RCON command with rcon, for example rcon changelevel pl_upward.

Command Use
status Players, their Steam IDs and the server’s address
changelevel <map> Switch map without kicking anyone
kickid <userid> / banid Kick a player, or add their ID to the ban list; writeid saves permanent bans to banned_user.cfg
mp_restartgame 5 Restart the round in 5 seconds
exec server.cfg Reload your config after editing it
sv_password "" Remove the password on the fly
quit Stop the server cleanly

Keep your TF2 server updated

When Valve patches TF2, players on the new version can’t join an old server. Stop the server, run your SteamCMD line again (app_update 232250), and start it. Then check that MetaMod and SourceMod still load with meta list, because game updates are when plugins break. To try upcoming changes, add -beta prerelease to the app_update line on a test server.

TF2 server problems and fixes

Problem Likely cause Fix
Server not in the browser No token, or it expired Create or regenerate a GSLT and set +sv_setsteamaccount
“Server is not responding” UDP 27015 blocked, a CGNAT connection, or the server is still loading its first map (it answers no queries until a map is up) Wait for the map, check the port forward and firewall, then test from outside your network
Server only visible on LAN sv_lan 1, or the Linux server is in LAN-only mode Set sv_lan 0; on Linux, add a steam_appid.txt containing 232250
Linux: segmentation fault on start Missing 32-bit libraries Install the i386 packages above
Linux: missing steamclient.so Steam SDK file not where the server looks Copy steamclient.so to ~/.steam/sdk32/
RCON won’t connect Server bound to the wrong address Add +ip 0.0.0.0 to the launch line and set rcon_address 0.0.0.0
Crashes when joining one server only Its custom content (maps, sounds, sprays) Players can filter custom downloads in Options > Multiplayer; as owner, re-upload the map files
Bots stand still or don’t spawn No nav mesh, or quota bots waiting for a human Run nav_generate, or set tf_bot_join_after_player 0
MvM map shuts the server down maxplayers under 32 Launch with +maxplayers 32
A plugin stopped working after a patch SourceMod or the plugin is out of date Update MetaMod, SourceMod and the plugin; read addons/sourcemod/logs

Is it TF2 that’s down, or my server?

When people search “tf2 server down,” they often mean Valve’s side, such as Casual matchmaking or the item server, rather than one community server. If only your server can’t be reached, work through the table above.

Skip the setup: rent a TF2 server

Self-hosting a TF2 server means a machine that stays on, forwarded ports, a token that expires, a fast download host for custom maps, and SourceMod to re-check after every patch. If you’d rather spend that time playing, Team Fortress 2 server hosting on GameTeam is live in minutes. You pay per GB of RAM, from $0.49/GB a week (or $1.99/GB billed monthly), with unlimited slots; TF2 itself caps a normal server at 32. DDoS protection is included, and the first 72 hours are money-back. The built-in AI copilot takes the tedious server admin off your hands. Tell it “set a 30-minute timelimit, put Hightower and Upward in the map cycle and password the server” and it edits server.cfg and mapcycle.txt, then restarts. Ask “why did my map vote plugin stop working?” and it reads the SourceMod log and names the plugin that failed.

FAQ

Is a TF2 dedicated server free?

Yes. The server software is a free anonymous download through SteamCMD, and the token is free too. What costs money is the machine and connection it runs on, or a host.

How many players can a TF2 server hold?

Up to 32 with +maxplayers 32. 24 is the default, and it was the size Valve’s old Quickplay system expected from community servers. Mann vs. Machine needs maxplayers set to 32 even though only six humans play.

How do I make a private TF2 server with friends?

Set sv_password in server.cfg, start the server, and give your friends the IP and password. They type connect ip:27015 in the console and enter the password when asked. For a quick private game on one PC, the Create Server button works too, but it closes when you leave.

How do I add bots to a TF2 private server?

Type tf_bot_add 6 in the server console, or set tf_bot_quota with tf_bot_quota_mode fill to keep the teams topped up. No cheats needed on maps that ship with a nav mesh.

How do I make bots move in TF2?

Bots that stand still are missing a navigation mesh for that map. Enable cheats, run nav_generate, let the map reload, then turn cheats off and restart the server.

Can I play achievements and earn drops with bots on my server?

AI bots don’t need cheats, so achievements stay enabled. Kills on bots don’t count toward Strange weapon stats, except on a Strange Part: Robots Destroyed.

Do I need Linux to run a TF2 dedicated server?

No. The same server runs on Windows and Linux. Linux is popular for servers that stay up for months, but if you’re on Windows already, the Windows steps above work fine.

Are TF2 community servers still active?

Yes. The community server browser still lists servers of every kind, from stock 24-slot payload to trade, jump and x10. Quickplay is gone (Valve replaced it with Casual matchmaking), so new players find community servers through the browser, Favorites and the community’s own Discord server.

Running Source games for more than one crowd? Our Left 4 Dead 2 dedicated server guide and Counter-Strike: Source dedicated server guide cover what’s different in each.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *