27015/UDPGarry's Mod servers require specific ports for proper operation:
| Port | Protocol | Purpose | Required |
|---|---|---|---|
| 27015 (configurable) | UDP | Game port | Yes |
| 27015 (same as game port) | UDP | Query/RCON port | Yes |
| 27005 | UDP | Client port | No |
| 26900 | UDP | Steam master server updater | No |
| 27020 | UDP | SourceTV port (if enabled) | No |
UFW (Ubuntu/Debian):
sudo ufw allow 27015/udp comment 'GMod Game/Query Port'
sudo ufw allow 27020/udp comment 'GMod SourceTV'
sudo ufw allow 26900/udp comment 'Steam Master Server'
FirewallD (CentOS/RHEL):
sudo firewall-cmd --permanent --add-port=27015/udp
sudo firewall-cmd --permanent --add-port=27020/udp
sudo firewall-cmd --permanent --add-port=26900/udp
sudo firewall-cmd --reload
iptables:
iptables -A INPUT -p udp --dport 27015 -j ACCEPT
iptables -A INPUT -p udp --dport 27020 -j ACCEPT
iptables -A INPUT -p udp --dport 26900 -j ACCEPT
sudo apt update
sudo apt install lib32gcc1 steamcmd # Debian/Ubuntu
# OR for manual install:
mkdir ~/steamcmd && cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz./steamcmd.sh
login anonymous
force_install_dir ./gmod-server
app_update 4020 validate
quit./steamcmd.sh
login anonymous
force_install_dir ./css-content
app_update 232330 validate
quit
# Create symbolic link to CSS content
ln -s /path/to/css-content/cstrike /path/to/gmod-server/garrysmod/addons/cstrikeC:\steamcmd\steamcmd.exe and execute:
login anonymous
force_install_dir C:\gmod-server
app_update 4020 validate
quitCreate or edit garrysmod/cfg/server.cfg:
// Server Identity
hostname "My Awesome Garry's Mod Server"
sv_password "" // Leave blank for public server
sv_steamgroup "" // Steam Group ID (optional)
// Server Rates
sv_minrate 10000
sv_maxrate 30000
sv_minupdaterate 20
sv_maxupdaterate 66
sv_mincmdrate 20
sv_maxcmdrate 66
// Server Region
sv_region 1 // 1 = East Coast USA
// Server Visibility
sv_lan 0 // 0 for internet, 1 for LAN only
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 0
// RCON (Remote Console)
rcon_password "your_secure_password"
sv_rcon_banpenalty 0
sv_rcon_maxfailures 5
// Contact & Tags
sv_contact "admin@example.com"
sv_tags "sandbox,fun,friendly"
// Gameplay Settings
sbox_maxprops 300 // Max props per player
sbox_maxragdolls 10 // Max ragdolls per player
sbox_maxvehicles 6 // Max vehicles per player
sbox_maxeffects 200 // Max effects per player
sbox_maxballoons 50 // Max balloons per player
sbox_maxlamps 20 // Max lamps per player
sbox_maxthrusters 50 // Max thrusters per player
sbox_maxwheels 50 // Max wheels per player
sbox_maxhoverballs 50 // Max hoverballs per player
sbox_maxnpcs 20 // Max NPCs per player
sbox_maxsents 100 // Max SENTs per player
sbox_godmode 0 // God mode (0 = off)
sbox_noclip 1 // Allow noclip (1 = yes)
sbox_plpldamage 0 // Player vs player damage (0 = off)
// Voice Chat
sv_alltalk 1 // 1 = everyone can hear, 0 = team only
sv_voiceenable 1
// Download Settings
sv_allowdownload 1
sv_allowupload 1
sv_downloadurl "" // FastDL URL (highly recommended)
// Workshop Collection
host_workshop_collection "0" // Your Steam Workshop Collection ID
// Performance
sv_loadingurl "" // Loading screen URL (optional)
net_maxfilesize 64 // Max downloadable file size (MB)
// Server Protection
sv_pure 0 // File consistency (usually 0 for GMod)
lua_openscript_cl 0 // Client Lua scripts (security)
// Exec ban files
exec banned_user.cfg
exec banned_ip.cfg
Create garrysmod/cfg/mount.cfg to mount content from other Source games:
// Mount CS:S content (required for most servers)
"mountcfg"
{
"cstrike" "C:\css-content\cstrike"
"tf" "C:\tf2-content\tf"
"dod" "C:\dod-content\dod"
}
Set game mode in startup parameters:
// Sandbox (default)
+gamemode sandbox
// DarkRP
+gamemode darkrp
// Trouble in Terrorist Town (TTT)
+gamemode terrortown
// Prop Hunt
+gamemode prop_hunt
| Parameter | Description | Example |
|---|---|---|
| -game | Game directory name | -game garrysmod |
| -console | Enable console output | -console |
| -port | Server port | -port 27015 |
| -maxplayers | Maximum players | -maxplayers 32 |
| +map | Starting map | +map gm_flatgrass |
| +gamemode | Game mode to load | +gamemode sandbox |
| +exec | Execute config file | +exec server.cfg |
| -tickrate | Server tickrate | -tickrate 66 |
| -ip | Bind to specific IP | -ip 192.168.1.100 |
| +host_workshop_collection | Workshop collection ID | +host_workshop_collection 123456789 |
| +sv_setsteamaccount | Steam Game Server Login Token | +sv_setsteamaccount YOURTOKENHERE |
./srcds_run -game garrysmod -console -port 27015 -maxplayers 32 \
+map gm_flatgrass +gamemode sandbox +exec server.cfg \
+host_workshop_collection YOUR_COLLECTION_ID \
+sv_setsteamaccount YOUR_GSLT_TOKEN -tickrate 66
srcds.exe -game garrysmod -console -port 27015 -maxplayers 32 ^
+map gm_flatgrass +gamemode sandbox +exec server.cfg ^
+host_workshop_collection YOUR_COLLECTION_ID ^
+sv_setsteamaccount YOUR_GSLT_TOKEN -tickrate 66
+sv_setsteamaccount parameterIssue: Players see missing textures or error models.
Solutions:
mount.cfgIssue: Server shows Lua errors in console.
Solutions:
garrysmod/lua/autorun/server/ for conflicting scriptsIssue: Workshop addons not appearing on server.
Solutions:
host_workshop_collection is set in startupresource.AddWorkshop() in Lua for individual addonscache/workshop/ directory permissionsIssue: Players experiencing latency.
Solutions:
sv_maxrate based on bandwidthIssue: Server randomly crashes or restarts.
Solutions:
garrysmod/ directoryIssue: Cannot connect via RCON.
Solutions:
rcon_password is set in server.cfgThe default GMod experience. Build anything with physics props and tools.
Roleplay game mode where players take on jobs in a virtual city.
Social deduction game. Traitors vs Innocents.
Hide-and-seek with props. Hunters vs Props.
One murderer, one detective, bystanders. Survive or solve.
Runners navigate deadly obstacle courses while Deaths activate traps.
garrysmod/addons/ directoryGMod servers use Lua for custom functionality:
-- Example: garrysmod/lua/autorun/server/welcome.lua
hook.Add("PlayerInitialSpawn", "WelcomeMessage", function(ply)
ply:ChatPrint("Welcome to the server, " .. ply:Nick() .. "!")
end)
host_workshop_collection parameterIn garrysmod/lua/autorun/server/workshop.lua:
-- Add individual Workshop items
resource.AddWorkshop("123456789") -- Replace with Workshop ID
resource.AddWorkshop("987654321")
resource.AddWorkshop("555555555")
Recommended for faster downloads of custom content:
sv_downloadurl "http://your-fastdl-url/" in server.cfgstatus # Show players and server info
kick [name/userid] # Kick player
banid [minutes] [userid]# Ban player
addip [minutes] [ip] # Ban IP address
changelevel [map] # Change map immediately
map [map] # Load specific map
ulx ban [player] [time] # ULX ban command
ulx kick [player] # ULX kick command
ulx slay [player] # Kill player
sbox_maxprops [number] # Set prop limit
sbox_godmode [0/1] # Toggle god mode
sbox_noclip [0/1] # Toggle noclip
cleanup # Remove all props