DD-WRT Tutorial 4: Defining Priorities with QoS
December 15, 2006
Learn how to play favorites with your network traffic so the important stuff like voice, video, and games gets high priority.
Parents arent supposed to have a favorite child, but if you grew up with any brothers or sisters, you know that usually isnt true. (Yes, their favorite was you. Of course it was.) While it might be unfair to give one kid preferential treatment over another, its completely legit in the world of networking. (Also legit: bad segues.) In fact, discriminating for and against different kinds of network traffic can be a very good idea indeed.
Todays broadband pipes are more crowded than ever. Stuffed full with file downloads, VoIP traffic, fast-twitch games, and IM sessions, theres a lot of data squeezing its way through your Internetting. Quality of Service, or QoS, generally refers to strategies for creating priority queues, so that some data is given preference over other data.
The obvious and most common use for QoS is to give high priority to real-time traffic, like VoIP services such as Skype, and games which require the lowest latency so you have a chance to return fire. Less time-sensitive traffic, like large downloads and P2P transfers, can afford to slow down when urgent data is coming through.
You can setup relatively sophisticated, or very simple, QoS rules on a sub-$60 router like the Linksys WRT54G and similar compatible routers using the open-source firmware DD-WRT. Using the latest V23 firmware for DD-WRT, establishing QoS priorities is relatively straightforward, albeit with some quirks.
As well soon see, DD-WRT lets you define QoS priorities for up to four general sources of traffic:
- Network services. This is the most common category for defining QoS rules. Priorities defined here apply to traffic originating from specific network applications, like Skype and Bittorrent.
- Netmask/IP address. In this category, you can promote or demote traffic originating from a particular machine or networked block of machines, regardless of which network application is creating the traffic.
- MAC address. Similar to Netmask/IP, except that you assign priority based on a machines unique MAC address rather than its IP address. This lets you target specific physical machines even if they receive dynamic IP addresses.
- Ethernet port. This special category lets you prioritize traffic originating from a particular switched router port. The special caveat is that Ethernet port priority only works on DD-WRT compatible routers using the ADM6996L chipset this includes the Linksys WRT54G versions 1.0, 1.1, 2.0, and WRT54GS version 1.0.
Within any category, DD-WRT offers five priority classifications:
- Exempt. QoS rules do not apply to this classification.
- Premium. The elite class. Only traffic that requires the utmost priority should receive this classification, like VoIP traffic ideally, only if the next lowest class proves insufficient.
- Express. Like business-class in air travel, express priority is a cut above the cattle class, but not quite the comfy seats with leg room to spare. Services which benefit from real-time activity should first try express classification before being bumped to premium.
- Standard. The default any service without a QoS rule is assigned to standard class. Traffic in this class is treated normally except where traffic in higher classes requires bandwidth.
- Bulk. Low priority traffic, like P2P, can be classified as bulk. Only receives bandwidth when other classifications are idle.
Know Your Bandwidth
Before getting our hands dirty, you should be prepared with information about your broadband bandwidth. DD-WRT QoS requires that you set global values for your maximum upload and download speeds. It is strongly recommended that you set these values at between 85-90% of your true speeds, which leaves room for network overhead and minimizes your network latency by not saturating your connection.
Most broadband services are rated in Megabits per second (Mbps). You can multiply this value by 1024 to convert to Kilobits per second (Kbps). Suppose your cable modem service is rated at 3Mbps download/768Kbps upload:
Example download speed:
3Mbps * 1024 = 3072Kbps * 0.85 = 2611Kbps
Example upload speed:
768Kbps * 0.85 = 653Kbps
We multiply by 0.85 to calculate 85% of the total. You can also determine your real-world bandwidth by visiting a speed test site such as testmy.net or Speedtest.net, which may indicate a lower speed than the advertised value that youre paying good money for. Who are we kidding? Of course it will be lower.
Setting up QoS
Step 1. Open a browser on your PC and connect to the DD-WRT router its default address is http://192.168.1.1 unless youve set it otherwise. The default login is root and password is admin. Of course, you should change these. If you dont, youll have terrible dreams at night.
Step 2. Click to the Applications & Gaming/QoS menu. On this page you set most of the QoS settings. To start the QoS engine, check Enable beside Start QoS.
Assuming you want the QoS settings to apply to your Internet usage (you do), select WAN for Port.
The Packet Scheduler item is the source of some confusion among the DD-WRT community. Short answer: stick with HTB. The alternative, HFSC, is alleged to not yet work reliably. Both describe algorithms for implementing QoS, but word on the street is that more people have more success with HTB so, like every good parent says, do it because we said so.
For the Uplink speed, enter the number you calculated earlier. Remember to enter the value in Kbps (not Mbps), and be sure to enter your upload speed here not your download speed. Otherwise youll see some slow results indeed.
Of course, enter your calculated Downlink speed in the next box.
The Optimize for Gaming checkbox is basically a pre-configured setting only for use with a predefined set of games. You can find the reported list of games on the Internet, but really, youre better off configuring QoS settings explicitly rather than rely on a checkbox that may or may not include the particular version of a particular game. In other words, were leaving this unchecked.