Call of Duty 4: Servers

From COD Modding & Mapping Wiki
Jump to: navigation, search

PC server admin guide for Call of Duty 4: Modern Warfare


  • Ports in use
UDP 20800
UDP 20810
UDP 28960-28970
  • Hardware/Bandwidth Requirements

Bandwidth and server resource usage should be lower than that of COD2 in most situations, but it is not guaranteed. There are some situations where bandwidth usage may spike, and the server will get hit harder resume writing service than usual. Generally, if you're capable of hosting a COD2 dedicated server you should be just fine for COD4.

Server Messages via PB Console

Punkbuster Console Message Generator v1.4

Running Mods

Running mods on Server

IWD Packaging For Custom Maps



Windows Server Setup



Linux Server Setup

Server Administration



Server commands

say "my message"
tell [clientnum] "my message to you"

Server Settings (Stock)

map rotation

sv_mapRotation gametype <gametype> map <mapname> gametype <gametype> map <mapname> ...

<gametype> is one of:

  • "dm" - free for all deathmatch
  • "dom" - domination
  • "koth" - headquarters
  • "sab" - sabotage
  • "sd" - search & destroy
  • "war" - team deathmatch

Parameter Value
sv_hostname "my server"
g_gametype <gametype>
sv_maxclients [1-32]
g_password "my password"
sv_voice [0-1]
g_allowvote [0-1]
sv_punkbuster [0-1]
sv_minping [0-n] (milliseconds)
sv_maxping [0-n] (milliseconds)
sv_connectTimeout [0-n] (seconds)
sv_timeout [0-n] (seconds)

Using TCAdmin Panel



Gameplay Options



Rcon Commands

Rcon Commands for COD

DDos Attack

From Icculus:

So we're getting reports of DDoS attacks, where botnets will send infostring queries to COD4 dedicated servers as fast as possible with spoofed addresses. They send a small UDP packet, and the server replies with a larger packet to the faked address. Multiply this by however fast you can stuff UDP packets into the server's incoming packet buffer per frame, times 7500+ public COD4 servers, and you can really bring a victim to its knees with a serious flood of unwanted packets.

I've got a patch for COD4 for this, and I need admins to test it before I make an official release.

You'll need a server updated to 1.7 before applying this, because this is only a replacement cod4_lnxded file. The defaults for the new cvars are probably fine, but you can tweak them as you like.

If you want to see it in action, find your patched server in the in-game server browser, click "Server Info" and keep hitting refresh. If you're doing it faster than the limit, you'll see you don't get a response right away.

All this info is in README.linux in that tarball, but I'll post it here, too:


About query limits:

There is a class of DDoS attack that can utilize COD4 servers to flood a third party, by spoofing UDP packets so that the game server sends its reply for information to an unsuspecting party, over and over, as fast as it can. Unlike most packets sent by the server, this reply packet does not require a player with a legitimate connection before sending.

This patch sets up some reasonable defaults to limit the rate at which the server will send these reply packets to a given IP address. It does not throttle legitimate connections in the process.

The gist is this: If someone sends a query packet, we note their IP address and ignore any further queries for X seconds. If they send a port-unreachable packet (person being spoofed isn't playing the game), we ignore their IP address for Y seconds. This will let normal people play, it prevents people that don't have a legitimate player connection from flooding the server with queries, and it'll stop DDoS attacks against third parties.

If millions of computers try to wail on a single server, this patch should handle it gracefully (we don't allocate memory when adding IP addresses to the ignore list, we use a hashtable so we don't have to check millions of IP addresses for every query, and we clean out old addresses a little each frame).

People that are connected to the server don't have their packets ignored; this only limits server responses to packets that don't need a valid player connection (like the infostring, etc). LAN addresses are never limited.

Admins can tune it (and turn it off completely) with cvars.

Note that a single IP address using different ports all get lumped into the same ignore list entry. This is to make life difficult for attackers and keep things efficient on the server. If 16 players are all behind the same NAT, they might notice it takes longer for the server to respond to each of them individually at the start. They should run a LAN server anyhow, but gameplay will still perform normally here.

Server admins have 4 cvars to control this:

sv_queryIgnoreDebug: set to 1 to log information about attacks. This will write out a lot of logging. Defaults to 0.

sv_queryIgnoreMegs: Number of megabytes we should use to store the ignore list. Set to 0 to turn off the ignore list (basically disables this patch). 1 megabyte handles about 65000 IP addresses, each megabyte after the first adds about 87000 more. 1 is probably fine unless you're under serious attack, but maybe a server wants to spare 12 megs to block a million IP addresses simultaneously. Defaults to 1.

sv_queryIgnoreTime: Number of milliseconds to ignore an IP address's info requests after responding to one of them. Set to 0 to not ignore at all. Defaults to 2000 (2 seconds).

sv_queryBounceIgnoreTime: Number of milliseconds to ignore an IP address's info requests after a server packet bounced with an ICMP Port Unreachable notice. Set to 0 to not ignore at all. Defaults to 12000 (2 _minutes_).


Please note that I haven't touched this code since 2008, so even though the changes are relatively localized, don't blast this out to all your servers until you feel it's stable.

Please give me feedback!


Firewall solution

$IPT -A INPUT -p UDP -m length --length 42 -m recent --set --name getstatus_cod
$IPT -A INPUT -p UDP -m string --algo bm --string "getstatus" -m recent --update --seconds 1 --hitcount 20 --name getstatus_cod -j DROP

Would you like to support this Wiki? Click on the PayPal button to donate any amount through PayPal.
Your donation will support this Wiki development and help with keeping this site online.