More and more of my life has been going digital, anywhere from pictures, to e-mail, music, etc. A large chunk of this content is stored on my PC, so there is a very real risk of losing it all in a serious crash. To mitigate this, I recently decided to go with an
on-line backup service. Besides convenience, this has the essential advantage that it's located in a different state, so if our house were to
fall in the ocean, the data has a better chance of surviving.
A downside of on-line backup services is that they want to suck-up all available bandwidth, so they slow down the entire home network. There are some settings for throttling bandwidth in the backup client itself, but they're primitive and plain don't work that well. It'd be a lot nicer if the router simply did the throttling for me, depending on what the other machines on the LAN are doing. This is what
QoS is all-about.
Some time ago I read an
excellent article on hacking open-source routers, so I decided to buy a
WRT54GL. It turns out that flashing this router with the
DD-WRT firmware gives it excellent QoS facilities, far better than what the native firmware can do. Installing the DD-WRT firmware requires
some care, but is not difficult. There's something very satisfying about rebooting the router and getting a detailed status page with CPU load averages, and being able to SSH into the router to poke around the file system.
Setting up QoS correctly turns out to be
trickier than it seems. First, you have to estimate the uplink and downlink
bandwidth that your ISP provides, and tell the router 85% of each. The underlying assumption is that your bandwidth is fairly constant, but the router has to be able to handle spikes, so the 85% gives it a cushion. Since I use DSL, my bandwidth is pretty stable, but for cable customers (where bandwidth is shared by all people in your neighborhood), I imagine that's less likely to be true, so your mileage may vary here.
After this, you have the option to boost the priority of certain traffic sources, and lower the priority of other sources. A traffic source can be:
- A particular application, communicating on a particular port
- One or more specific IPs (or IP masks) on the LAN
- One or more specific MACs on the LAN
- One or more specific ethernet ports on the router
I decided to go for the first option, which in my opinion is the most flexible given my network setup. My on-line backup client uses a well-known fixed port, so it was easy to tell the router to downgrade all traffic on that port to "Bulk" status. This means that if any other traffic source wants to use the network, the "Bulk" sources are throttled all the way down to zero. This by itself works pretty well, but we can do better by marking other traffic sources as "Standard" or "Express" in order to boost their priority. Natural candidates for boosting are HTTP, Skype, IMAP, etc.
At first sight, it might seem that HTTP traffic can be simply identified as all traffic on port 80. This isn't quite true, given that many websites decide to serve static content off other ports, and it also doesn't handle HTTPS traffic. Fortunately, DD-WRT supports the
L7 filter, which attempts to classify the type of traffic by inspecting the packets themselves (for example, this is the
L7 pattern that classifies HTTP traffic). This does take a performance penalty since
all packets have to be inspected, but is easy, reliable, and headache-free, so I gave it a shot.

Once everything was configured and running, I was pleased to see that it works well: when the network was quiet, my backup software was running at close to full-speed. As soon as I started to use the network (for example, watch an on-line video), the router magically throttled the backup traffic down to almost zero, and my browsing was unimpaired. When I stopped browsing, the backup traffic came back to using almost all the bandwidth.
The only downside is that, between estimating the maximum bandwidth above, and the performance toll of the L7 filter, this does exact around 15-20% penalty on the overall traffic coming in and out of the network. My DSL service currently has about 2.5 MB up, and 450 KB down. With QoS enabled, I'm seeing around 2.1 MB up and around 360 KB down. This is enough for my needs for now, but I will have to see how it holds up over time.