Router QoS for Source games running on Steam

I recently upgraded the firmware on my home wireless router to Tomato, which has very configurable network quality-of-service settings so that the router knows that some traffic is more time-sensitive than others and that it should take priority when my Internet connection starts to fill up. This is so that I can download a Steam game and browse the web on my laptop while my girlfriend plays Team Fortress 2 on her PC without my causing her game to become laggy and unresponsive.

Surprisingly, when I looked around the ‘net for the appropriate settings to use, I didn’t find very much useful information. The first thing I tried was to simply prioritize all TCP and UDP traffic on every port Source uses (27000-27050), but this meant that Steam game downloads were prioritized at the same level as TF2 game client traffic, which turned out to be bad because it meant that her gameplay bogged down whenever I downloaded an update from Steam (or even if she had a download running in the background on her own computer. )

Fortunately it’s possible to differentiate traffic a little more finely than that: the present generation of Source games all use UDP to communicate with the server, while the Steam client uses TCP for downloads. This page on the Steam support website describes which ports get used for what purpose, and after a little experimentation (and maybe a trip or two into the L4D source code) I finally determined that these settings seem to work best for me:

If you’re having trouble with TF2 or Left4Dead behaving poorly on your network, you might want to try checking your own router’s QoS settings and maybe setting them similarly.

One more thing to remember about home router QoS is that you’re only prioritizing the traffic that you uplink to the internet; it can’t prioritize the traffic that you’ve already received from your ISP (but since downlink speeds are usually so much bigger than uplink speeds this usually isn’t an issue).

Also, for QoS to work properly you need to have an accurate estimate of your total upload speed. This is because all your traffic priorities are expressed as percentages of total bandwidth (eg “Low” priority traffic is guaranteed only 3% of your link while “High” gets, say, 50%), so a low upload speed estimate would cap all your connections too low, and a too-high one would allocate too much bandwidth to low priorities. High end routers such as the D-Link DGL-4300 measure your upload bandwidth automatically, but some firmwares (such as Tomato and DD-WRT) require you to measure your upload speed manually and then enter it into the control panel. You can measure your upload speed at speedtest or Speakeasy (and it’s best to enter a speed that’s 90% of your measured speed, to leave room for packet overhead).

Some routers also support Level 7 filtering, which prioritizes IP connections based on the application-level data inside them rather than simply their source and destination ports. It looks like there are filters for many games, including TF2, but looking at their implementation I suspect simple port-based QoS may work better.

One Comment

  1. Felipe says:

    Nice arcticle.
    But actually, you can shape income traffic on tcp connections because of tcp’s congestion control. I find it useful to prioritize voip (udp) over www (tcp).
    Check this post: http://forum.openwrt.org/viewtopic.php?id=4112&p=1.

Leave a Reply