2hours.gg/

Game servers by the hour. Pay only when you play.

How to set up a private, near-vanilla Left 4 Dead 2 server

You want a Left 4 Dead 2 dedicated server running around the clock, locked to you and your friends, with little or no mods on top of vanilla. This is the whole config. It is short on purpose: vanilla L4D2 already does most of what you need, so the trick is knowing which handful of cvars actually matter.

Where the config lives

A dedicated server installed with SteamCMD (app 222860) keeps its config here:

<install>/left4dead2/cfg/server.cfg

Create that file if it is not there. It runs automatically every map change once you exec it from the launch line (below).

A near-vanilla server.cfg

Paste this, change the four values marked CHANGE ME, and you are done. No plugins, no addons.

// --- Identity ---
hostname "My Private L4D2 Server"      // CHANGE ME
sv_tags "private"
rcon_password "pick-a-long-secret"     // CHANGE ME - admin console over RCON

// --- Lock it down ---
sv_password "friends-only"             // CHANGE ME - join password
sv_search_key "my-private-key"         // CHANGE ME - see "Private lobbies" below

// --- Vanilla behaviour ---
sv_pure 1                              // reject client-side file overrides
sv_consistency 1
sv_cheats 0
z_difficulty Normal                    // Easy / Normal / Hard / Impossible
sv_region 255                          // 255 = world; set your region for lower ping

// --- 24/7 housekeeping ---
sv_alltalk 0
sv_allow_lobby_connect_only 0          // keep direct IP connects open
mp_disable_autokick 1

That is genuinely all a private co-op server needs. The game mode and starting map are set on the launch line, not here, because L4D2 ignores mp_gamemode when it is placed in server.cfg.

The launch line

Start the server with srcds_run from the install folder:

./srcds_run -game left4dead2 -console -port 27015 \
  +exec server.cfg \
  +mp_gamemode coop \
  +map c1m1_hotel
  • exec server.cfg runs first so your cvars are in place before the map loads.
  • mp_gamemode is one of coop, realism, versus, survival, scavenge. It MUST be on the command line.
  • c1m1_hotel is Dead Center map 1. Swap it for any campaign start map you like.
  • Port 27015 is both the game port and the A2S query port. Open it in your firewall (UDP + TCP).

Two ways to keep it private

  • Password (simplest): with sv_password set, only people who type the password can connect. Share the IP and password with your group. Note: a password stops the server from showing a public join, which is what you want.
  • Private lobby (sv_search_key): if you want to invite through the normal Steam lobby instead of sharing an IP, put a search key on the server, and have each friend type sv_search_key my-private-key in their own game console before hosting a "Best Available" lobby. Only servers with the matching key show up, so it stays yours.
  • Steam group (optional): set sv_steamgroup to your group ID and sv_steamgroup_exclusive 1 to restrict connections to members.

The one catch: four players

Vanilla L4D2 seats exactly four survivors in co-op, and joining through a Steam lobby hard-caps humans at four no matter what. There is no cvar that changes this. If four is enough for your group, you are done and you have zero mods. If you want five or more people, you need one small mod (L4DToolZ) plus everyone connecting by direct IP rather than through a lobby.

See also

← Back to all guides