Consider this a work in progress. The information here is gleaned from experimentation and guesswork, and could be wrong. Updates welcome.
Why QoS?
How often have you had a big download going on, but wanted to quickly check your mail, and found the download made everything way too slow? QoS is a way to solve this kind of problem by telling your router about the kind of traffic that's going through your network, and which is more important.
How does it work?
AR7 based routers use a proprietory traffic shaping algorithm called priowrr. What this does is divides all Internet traffic into three classes* called high, medium and low. High priority packets are always processed first, and then the remaining bandwidth is divided between medium and low packets. The default ratio is 60/40, but this can be changed. If you do not assign a priority to a particular type of traffic, it is treated as low priority.
*Actually there are four classes, but the second high priority queue doesn't seem to be used.
So what are we aiming for?
This will vary depending on your individual requirements. However, here's some suggestions.
High priority:
Use this queue for things that are being done which the users of the network will be waiting on. This is for interactive processes that require a fast response.
Use this for interactive logins (ssh), VoIP, and email (POP, IMAP, SMTP), Online gaming.
Warning: If this class gets full, packets from the lower classes may get lost. I would advise using it sparingly and not for high traffic applications like video streaming unless you have a lot of bandwidth.
Medium priority:
Use this queue for tasks that are important, but not hugely time critical. For example web, video streaming and ftp traffic.
Low priority:
Use this for background tasks that are non-interactive. File sharing applications are the most obvious candidate for the low queue, since this allows them to take up spare bandwidth when available without negatively impacting interactive tasks like web browsing.
How do we sort out which packets are which?
There are varying levels of sophistication with which this can be done. Here we'll opt for a simplistic approach that gets the job done, but could possibly be a lot more refined. Internet traffic is directed to and from ports, which are a way of telling the machine that is being communicated which program to pass the information to. These are standardised, so for example, web servers are almost always on port 80. Therefore we can say that almost all (unencryted) web traffic (including web downloads) will be either coming to or from port 80.
There are several types of packet that can be sent. The important ones for our purposes are TCP and UDP. Whether a packet is TCP or UDP depends on the kind of information being sent. In the case of web traffic the protocol is TCP.
Once we know the protocol and the ports it uses we have enough information to start setting up QoS.
Getting started
First we need to turn on QoS. We do this from the "IP QoS" submenu of the "Advanced" router configuration screen as follows:
1) Make sure the connection box indicates your Internet connection
2) Tick the box marked "Enable IPQoS".
3) (Optional) Adjust the weighting. The default is 60% medium, 40% low. Since we're proposing to have some interactive processes in the medium class, we might want to alter this to 70/30 or even 80/20. Change the value of either "medium priority weight" or "low priority weight" and the other will change automatically. Be aware that traffic that is not matched by our rules (such as traffic to webservers on non-standard ports) will go to the low queue.
4) Click Apply to turn QoS on.
Adding rules
Now we start to add our rules. As an example we'll look at the SSH protocol. This is a TCP protocol going to and from port 22. It's used for interactive logins to remote machines, and thus needs a good response, and will be added to the "High" queue. We need to create two rules as follows:
Rule Name: ssh-out
Destination Start Port: 22
Destination End Port: 22
Traffic Priority: High
Protocol: TCP
Rule Name: ssh-in
Source Start Port: 22
Source End Port: 22
Traffic Priority: High
Protocol: TCP
Add these by pressing the "Add button" towards the bottom of the web page, then setting the appropriate fields in the form. Leave the other settings empty or at their default values. Press apply to add the rule. When this is complete, you should have two rules added to the table on the main page.
Suggested rules
Feel free to add any of the rules below, which will work for the default setup.
Note that since "low" seems to be the default, you probably do not explicitly need to add rules for protocols you would like to be low priority. It doesn't hurt to be explicit however, and they're included here for completeness.
You can of course add all of these as rules, but it's probably easier just to pick the ones you use yourself.
There's a large list of ports for IM, multimedia etc. at http://www.practicallynetworked.com/sha ... t_list.htm. Pick the ones you need from here.
Code: Select all
High priority
Service Protocol Ports Description
ssh TCP 22 Interactive remote login via ssh
pop3 TCP 110 POP3 email (unencrypted)
pop3s TCP 995 POP3 email (encrypted)
imap TCP 143 IMAP email (unencrypted)
imaps TCP 993 IMAP email (encrypted)
smtp TCP 25 Outgoing SMTP email (unencrypted)
smtps TCP 465 STMP email (encrypted)
smtpsgmail TCP 587 Google's encrypted STMP email
dns ANY 53 Name server traffic
bbciplayer TCP 1947 BBC iPlayer
bbciplayer UDP 1948 BBC iPlayer
Medium / Normal Priority
Service Protocol Ports Description
http TCP 80 Web traffic (unencrypted)
https TCP 443 Web traffic (encrypted)
ftp TCP 20-21 FTP traffic (control and data)
nntp TCP 119 Usenet news (unencrypted)
nntps TCP 563 Usenet news (encrypted)
Low / Unimportant Priority
Service Protocol Ports Description
gnutella ANY 6346 Gnutella P2P file sharing (inc. Shareaza)
limewire ANY 6346-6347 Limewire P2P file sharing
azureus ANY 6881-6889 Azureus and bittorrent P2P file sharing
Alternative/advanced configuration
The fact that the router assigns traffic to the low priority queue by default is less than ideal. In general it would be preferable for traffic we don't classify to be treated as normal priority, and be able to say "these protocols are important" or "these protocols should get minimal bandwidth when we're busy" about several protocols. It is actually possible to do this with the RouterTech firmware, although it's a bit confusing to set up.
There's essentially no difference between the "medium" and "low" priority levels in terms of what happens to them inside the router. If we set the priority rate for "medium" to 20% and "low" to 80%, then the "low" priority class will actually get more bandwidth than the "medium" class. This will effectively swap the meaning of "low" and "medium". Think of "low" as "normal" instead, and "medium" as "unimportant".
Set the priority rate for "medium" class packets to 20% then assign rules for "high" priority protocols as above. Put filesharing protocols in the "unimportant" ("medium") class, and then leave the "normal" ("low") class for web traffic etc. In this setup, we don't need to assign rules for any protocols in the "normal" class, since this is the default class and packets for which no rule exists will be directed here automatically.