Team Fortress 2 (TF2) is Valve's class-based multiplayer FPS game. This guide covers hosting a TF2 dedicated server using Source Dedicated Server (srcds) on VPS or dedicated servers.
27015 (UDP)27015 (TCP)27020 (TCP/UDP)sudo ufw allow 27015/udp comment 'TF2 game port'
sudo ufw allow 27015/tcp comment 'TF2 RCON'
sudo ufw allow 27020 comment 'TF2 SourceTV'
sudo ufw reload
sudo firewall-cmd --permanent --add-port=27015/udp
sudo firewall-cmd --permanent --add-port=27015/tcp
sudo firewall-cmd --permanent --add-port=27020/tcp
sudo firewall-cmd --permanent --add-port=27020/udp
sudo firewall-cmd --reload
# Run in PowerShell as Administrator
New-NetFirewallRule -DisplayName "TF2 Game/RCON" -Direction Inbound -Protocol UDP -LocalPort 27015 -Action Allow
New-NetFirewallRule -DisplayName "TF2 RCON TCP" -Direction Inbound -Protocol TCP -LocalPort 27015 -Action Allow
New-NetFirewallRule -DisplayName "TF2 SourceTV" -Direction Inbound -LocalPort 27020 -Action Allow
sudo iptables -A INPUT -p udp --dport 27015 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 27015 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 27020 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 27020 -j ACCEPT
sudo service iptables save
# Install SteamCMD
# Linux:
sudo add-apt-repository multiverse
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install lib32gcc1 steamcmd
# Create server directory
mkdir -p ~/tf2server
cd ~/tf2server
# Download TF2 server files (App ID 232250)
steamcmd +login anonymous +force_install_dir ~/tf2server +app_update 232250 validate +quit
Windows (start_tf2.bat):
srcds.exe -console -game tf +map ctf_2fort +maxplayers 24 -port 27015 +exec server.cfg
Linux (start_tf2.sh):
#!/bin/bash
./srcds_run -console -game tf +map ctf_2fort +maxplayers 24 -port 27015 +exec server.cfg
Create tf/cfg/server.cfg:
// Server Information
hostname "My TF2 Server"
sv_region 1 // 0=US East, 1=US West, 2=South America, 3=Europe, etc.
rcon_password "your_secure_password"
sv_password "" // Leave empty for public, or set server password
// Server Settings
sv_lan 0
sv_pure 2 // 0=off, 1=loose, 2=strict file checking
mp_autoteambalance 1
sv_visiblemaxplayers 24
mp_timelimit 30
mp_maxrounds 5
mp_winlimit 0
// Class Limits (competitive servers)
// tf_tournament_classlimit_scout 2
// tf_tournament_classlimit_soldier 2
// tf_tournament_classlimit_demoman 2
// tf_tournament_classlimit_medic 1
// Communication
sv_alltalk 0 // 0=team only, 1=all players
sv_voiceenable 1
sv_allow_voice_from_file 0
// Logging
log on
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 0
// Network Settings
sv_minrate 20000
sv_maxrate 100000
sv_mincmdrate 66
sv_maxcmdrate 66
sv_minupdaterate 66
sv_maxupdaterate 66
// Anti-Cheat
sv_cheats 0
sv_consistency 1
sv_pure 2
| Mode | Description | Example Maps |
|---|---|---|
| Capture the Flag | Capture enemy intelligence briefcase | ctf_2fort, ctf_turbine |
| Control Point | Capture all control points | cp_dustbowl, cp_gorge |
| Payload | Push/stop cart to destination | pl_badwater, pl_upward |
| Payload Race | Both teams push carts | plr_hightower, plr_pipeline |
| King of the Hill | Control single point for timer | koth_harvest, koth_viaduct |
| Arena | No respawns, last team standing | arena_lumberyard, arena_well |
| Mann vs Machine | Co-op vs AI robot waves | mvm_decoy, mvm_coaltown |
| Pass Time | Sports-like mode with JACK | pass_brickyard, pass_district |
Create tf/cfg/mapcycle.txt:
ctf_2fort
ctf_turbine
cp_dustbowl
cp_gorge
pl_badwater
pl_upward
koth_harvest
koth_viaduct
# Download map .bsp file
# Place in: tf/maps/
# Download .nav file (for bots) if available
# Place in: tf/maps/
# Add to mapcycle.txt
echo "custom_map_name" >> tf/cfg/mapcycle.txt
# Change map via RCON
rcon changelevel custom_map_name
# Download from https://www.sourcemm.net/downloads.php?branch=stable
# Extract to tf/ directory
# Verify - should see:
tf/addons/metamod/
# Test in server console:
meta version
# Download from https://www.sourcemod.net/downloads.php?branch=stable
# Extract to tf/ directory
# Should see:
tf/addons/sourcemod/
# Add admin in: tf/addons/sourcemod/configs/admins_simple.ini
"STEAM_0:1:12345678" "99:z" // Replace with your SteamID
# Test in server:
sm version
# Download .smx plugin file
# Place in: tf/addons/sourcemod/plugins/
# Restart server or reload plugins:
sm plugins reload pluginname
# List loaded plugins:
sm plugins list
# Disable plugin:
sm plugins unload pluginname
# Verify sv_lan setting
sv_lan 0 // Must be 0
# Check region
sv_region 1
# Test connectivity
netstat -an | grep 27015
# Wait 5-10 minutes for Steam master server registration
sv_password is empty or known to playerssv_pure settings aren't too strict# Check file structure
tf/
addons/
metamod/
bin/
sourcemod/
plugins/
configs/
# Verify in server console
meta version
sm version
# Check logs
tf/addons/sourcemod/logs/errors_*.log
# Optimize rates
sv_maxrate 100000
sv_maxcmdrate 66
sv_maxupdaterate 66
# Set tickrate (requires startup parameter)
-tickrate 66 // Add to startup command
# Check server FPS
stats // In server console
# Reduce max players if needed
maxplayers 16 // Instead of 24
# Enable downloads in server.cfg
sv_allowdownload 1
sv_allowupload 1
net_maxfilesize 64 // MB
# Use FastDL for faster downloads
sv_downloadurl "http://yourdomain.com/tf/"
// Upload maps/materials/sounds to web server
-tickrate 66 for consistencytf_weapon_criticals 0tf_use_fixed_weaponspreads 1Popular server modifications compatible with Team Fortress 2:
# Required ports:
UDP 27015 - Game server
TCP 27015 - RCON
TCP/UDP 27020 - SourceTV
# Linux:
sudo ufw allow 27015
sudo ufw allow 27020
Most TF2 servers use SourceMod for admin commands and plugins. Install Metamod:Source first, then SourceMod.
steamcmd +app_update 232250 validatesv_lan 0