📚 Navigation

Overview 🔌 Ports Installation ⚙️ Configuration Game Modes Plugins 🔧 Troubleshooting

Team Fortress 2 Dedicated Server Hosting Guide

Overview

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.

Quick Info

🔌 Ports Required

Port Protocol Purpose Required
27015 UDP / TCP Game + RCON port (UDP for game, TCP for RCON) ✓ Yes
27020 UDP / TCP SourceTV (spectator/streaming) Optional

Firewall Configuration Examples

UFW (Ubuntu/Debian)

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

FirewallD (CentOS/RHEL/Fedora)

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

Windows Firewall

# 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

iptables (Legacy Linux)

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

Installation & Setup

System Requirements

Installing via SteamCMD

# 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

Startup Scripts

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

Server Configuration

server.cfg Example

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

Game Modes & Maps

Official Game Modes

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

Map Rotation

Create tf/cfg/mapcycle.txt:

ctf_2fort
ctf_turbine
cp_dustbowl
cp_gorge
pl_badwater
pl_upward
koth_harvest
koth_viaduct

Popular Community Maps

Installing Custom Maps

# 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

Plugins & Extensions

SourceMod & MetaMod Installation

1. Install MetaMod:Source

# 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

2. Install SourceMod

# 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

Essential Plugins

Popular TF2-Specific Plugins

Installing Plugins

# 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

🔧 Troubleshooting

Server Not in Browser

# 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

Players Can't Connect

MetaMod/SourceMod Not Loading

# 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

Performance Issues / Low FPS

# 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

Custom Content Not Downloading

# 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

Pro Tips

Popular server modifications compatible with Team Fortress 2:

Resources

Port Forwarding

# Required ports:
UDP 27015 - Game server
TCP 27015 - RCON
TCP/UDP 27020 - SourceTV

# Linux:
sudo ufw allow 27015
sudo ufw allow 27020

Plugins & Extensions

SourceMod Installation

Most TF2 servers use SourceMod for admin commands and plugins. Install Metamod:Source first, then SourceMod.

Popular Plugins

Troubleshooting

Server Won't Start

Not in Server Browser

Additional Resources

Important Notes