I was recently tasked with setting up QoS on a gentoo box. I didn't really know much about it but after several days of reading I feel that I have a basic grasp on it. I decided to document it and share my QoS script..
There's apparently several QoS types such as HTB, HFSC, and SFQ? I read that HTB allows you to set min/max bandwidth for packets and set how much a queue can borrow from another. Sounds cool. Then I read about HFSC and how it lets you focus more on latency of packets. This won me over immediately because latency is very important to me and my VoIP users.
You will need who knows what enabled in your kernel.. (yeah, helpful, right?) I just compiled all the QoS stuff as modules and let the kernel autoload stuff as needed. Probably not your bag of chips but it works.
You need to emerge/get/install iproute2
This script has 5 categories or priorities or queues or whatever you care to call them. They are listed below.
* Queue 1: VOIP - This queue gives the lowest possible latency and allows unlimited use of bandwidth at the expense of everything else.
* Queue 2: INTERACTIVE - This gives very low latency (just below VOIP) and minimal amounts of bandwidth. It's for SSH sessions, DNS requests, TCP sync/ack packets for setting up connections. This is all very low bandwidth stuff but high latency here is very noticable to the user. This would be an ideal location for online games such as counter strike, warcraft, etc.
* Queue 3: Web - This queue gives moderate bandwidth and reasonable latency ideal for web surfing.
* Queue 4: Standard - Everything unclassified goes into this queue.
* Queue 5: Bulk - This is for bulk/background traffic like ftp sessions, p2p traffic, streaming, etc. It's allowed to consume any available bandwidth but will immediately be put on hold if any other queue needs more bandwidth. It's also pretty high latency but that's generally unimportant for this type of traffic.
Hey, I didn't know what the heck this stuff is. So here's a few terms used and what the heck they are. I like understanding how and why something works - not just running somebody's script and hoping for gold.
* HFSC HFSC has the major advantage compared to HTB that it also allows a proportional distribution of bandwidth as well as control and allocation of latencies. This enables you to better and more efficiently use connections for situations in which both bandwidth intensive data services and interactive services share a single network link. It is particularly interesting for Voice over IP and other real-time connections.
* Qdiscs Qdisc is short for Queue Discipline, meaning a specific strategy used to manage a queue. The queue in the post-office and the queue at an emergency room are both queues in the sense they are both lines of “items”, but the strategy (or qdisc) used to manage them is very different.
* Classes The qdisc organizes packets into classes, using filters. Filtering can be done using marks. Each class is a queue in its own right, and therefore uses yet another qdisc. You can think of classes as the doors from where the bandwidth pass. You must classify the traffic in the correct door that limits that kind of traffic.
* Rates – probably not for hfsc.. A rate is the amount of bandwidth a qdisc is guaranteed. For example, in an ideal world, an upload rate of 128 kbit/s would mean that the ISP will always give us at least that amount of bandwidth, or more if available.
I obviously got help from the web! Since I didn't know what I was doing. Here's the web sites that helped the most. * http://automatthias.wordpress.com/2006/06/30/hfsc-and-voip/ * http://linux-ip.net/articles/hfsc.en/ * http://www.howtoforge.com/voip_qos_traffic_shaping_iproute2_asterisk