Bandwidth Management for Home Networks
Sharing Your Internet Connection
If you are sharing your internet connection or plan to, you will probably run into some problems. There's always this annoying roommate who uses up all bandwidth to download stuff via torrents, or a neighbor who browses streaming video sites like Youtube, causing you to lag out in your favorite game or making you unable to video-chat in Skype.
The best solution to these kinds of problems is to use a router which is capable of QoS (Quality of Service). Basically, this kind of router controls your traffic (it's called "traffic shaping"), prioritizing certain types of it, and making sure everyone gets a fair share of bandwidth. Of course if you are the administrator, you can always make your share a bigger one! Find out how you can set up a home network without blowing your budget.
Picking the Best Router For Your Network
The first step is picking a router with some good QoS capabilities. I highly recommend WRT54GL from Linksys. You can install third party Linux-based firmware on it, which provides features and flexibility that only expensive, commercial devices normally offer. Some ASUS products are good as well. Regardless of which router you get, for the best QoS capabilities you should use custom firmware (read on below).
Great little device with wireless data links and a 4-port 100mbps Ethernet switch. Perfect for your home networking needs, although its CPU is too weak for high-speed internet connections (25mbps and higher).
Choosing Best Firmware for a WRT54GL Router
While QoS on default Linksys firmware works pretty well, it lacks important features and flexibility. What's more, according to my personal experience using P2P programs (such as BitTorrent clients) will make your web pages time out because default firmware sets a very low connection limit. Installing any third party firmware from this list fixes the problem.
Highly recommended firmware which takes QoS configuration to the next level. When it comes to setting up traffic priorities, Tomato can do almost anything. Great and easy-to-use web interface. Has a built-in bandwidth monitor.
Popular firmware that is based on OpenWRT kernel rather than Linksys software. Has many features, especially useful for wireless users. From my experience, it's QoS doesn't work that well though. DD-WRT also runs on many other routers besides WRT54G
A firmware meant for advanced users, it is said to have one of the best QoS scripts around. It used to have only a command shell, but now some people created X-WRT, a web interface project for OpenWRT.
Configuring the QoS Ruleset of Your Router
Once you have everything you need for your home network, there's only the configuration left to do. Creating and perfecting your QoS ruleset can take you a few minutes to several days, depending on your experience, needs, and the firmware you chose. However a good setup will save you lots of time and trouble in the future.
For starters you'll want to give higher priority to programs that suffer from insufficient bandwidth: be it games, voice communication or simple web browsing. Give the lowest priority to file downloads and P2P programs. Most custom firmware (such as Tomato) has L7 filters which allow you to simply choose applications to prioritize from a drop-down list. Alternatively, you can prioritize traffic coming from a specific port or IP address. For example, to prioritize web browsing you will want to give higher priority to port 80 (http).
The exact process of setting up the QoS rules depends on the router and firmware you're using. You should be able to find this information on your router's manual (if you're using the default firmware) or on the homepage of the firmware maker (if you're using a custom one). My favorite one - Tomato - comes with some pre-configured rules for web browsing (high priority) and a catch-all rule for everything else (low priority). You just have to add custom rules for Skype, games, etc.
One important tip to remember is to always set the upload speed in your QoS settings to 80% - 90% of the maximum your line is capable of. This is so your router can prioritize outgoing traffic properly. Never set it to 100% of your actual upload speed.
Tomato QoS Example
This is a very basic example of Tomato QoS configuration. My actual ruleset is a lot larger, but I'm using this one for the sake of simplicity. The following rules are the most important here:
- DNS lookups (port 53) need the highest priority. Tomato adds this one by default, so leave it there.
- Regular web browsing (port 80 for HTTP, 443 for HTTPS) should get medium priority: below crucial VoIP and gaming, but above file downloads and torrenting.
- The "catch-all" rule gives all other types of traffic a low priority. This is not necessary if you use the "Default class" setting and set it to Low. However, you can use similar catch-all rules to give other users on your network a lower priority than your own traffic.
The other rules are just examples that you might not need at all. In the screenshot above, I've added Skype (a VoIP app) and Counter Strike: Source (a multiplayer FPS game) and given them a High priority. I am the only one playing this game on my network, so I also added my MAC address to the latter rule.
I've also made uTorrent use a static 41234 port so my router would be able to classify this traffic as low priority. The uTorrent rule is at the top because I noticed that putting it at the bottom caused some torrent traffic to be erroneously classified as belonging to web browsing or CS:S. Tomato goes from top to bottom until it finds a rule that matches.
Dealing with Inbound Traffic
As you probably realize, your router will only prioritize outbound (upload) packets. Incoming traffic is tougher issue - it depends on what remote servers are sending you, so you can't control it directly. The best you can do is setup a hard download cap. For example, if your maximum download speed is 10 mbps, you could cap certain traffic types (P2P, streaming video) at 8 mbps or so. Your router will simply drop all the extra packets, but from my experience it's still a lot better than allowing big file downloads to hog all the bandwidth.
That's it - enjoy! If you still get lag, tweak your settings by further reducing priority of bandwidth-hungry applications until you don't have to worry about slow internet . It's all about how you divide and prioritize the web traffic! Your regular web browsing, for example, doesn't need much bandwidth but requires a high priority; and it's the vice versa for big file downloads.
You can check the homepages of the according firmware for more information, or visit the Linksys forums for helpful tips and discussions.
A More Modern Bandwidth Management Solution
Many things have changed since this article was written back in 2007. Home networks are now faster, and most people are using the new Wireless N standard which offers higher maximum speed. Considering the Linksys WRT54GL only supports Wireless G and has a weaker CPU (resulting in lower throughput, especially if QoS is used) it is no longer the #1 choice for bandwidth management. Of course, if your connection isn't faster than 20 mbps and you're perfectly happy with the older 802.11g protocol, you have no reason to update.
If you are building a new home network, however, it's better to make it more future proof. The Asus RT-N16 router (see to your right) has a more powerful processor and supports Wireless N and USB. And the best part is, you can still flash it with custom Linux firmware. I recommend Tomato USB, a new and improved version of the original Tomato.
Comments from happy people whom I saved from bandwidth clogging evil roommates go below.