Home Page
23/11/2001 : This page is not valid. Plz go to docum.org
QOS ? ?
QOS (Quality Of Service) is a way to determine how you can manage the service you offer. I'm interested in the possibility of using linux to manage the available bandwidth on a network. This is called "QOS and/or fair queueing" in the linux kernel.
TOS bits
The TCP/IP protocol has almost no support for QOS. The only thing you can do is using the TOS (Type Of Service) bits. With these 4 bits, you can assign a network packet the following mark: "Minimum Delay", "Maximum Throughput", "Maximum Reliability" or "Minimum Cost".
Allmost no router respect these bits to route the network packets. So this mechanism is useless.
Example: use of TOS bits
- Telnet: "Minimum delay" bit
- FTP-control: "Minimum Delay" bit
- FTP-data: "Maximum Throughput" bit
Kernel 2.4.x:
# iptables -A OUTPUT -t mangle -p tcp --dport telnet -j TOS --set-tos Minimize-Delay
# iptables -A OUTPUT -t mangle -p tcp --dport ftp -j TOS --set-tos Minimize-Delay
# iptables -A OUTPUT -t mangle -p tcp --dport ftp-data -j TOS --set-tos Maximize-Throughput
Kernel 2.2.x:
# ipchains -A output -p tcp -d 0.0.0.0/0 telnet -t 0x01 0x10
# ipchains -A output -p tcp -d 0.0.0.0/0 ftp -t 0x01 0x10
# ipchains -A output -p tcp -s 0.0.0.0/0 ftp-data -t 0x01 0x08
Linux
The linux kernel has built-in QOS support that can do much more than setting/using these 4 bits. Of course you need a linux box and you need some software to control these QOS settings.
You can control the behaviour of the queue for the outgoing data of a NIC and so manage the available outgoing bandwidth. You can control the way traffic leaves the linux box, but you have no control on how other elements in the data path manage the available bandwidth.
When you want to contol the traffic in both directions, you can use a linux box with two NIC's in bridge mode. This gives you the possibility to control both ways of the traffic totally transparent for the other network components. It's also possible to use an ingress qdisc so you can control incoming data, but I never tried it (TODO).
The author of the network traffic control implementation in the linux kernel is Alexy Kuznetsov (kuznet@ms2.incr.ac.ru). A very busy man, but hey thanx.
What do I need ...
See link-page for external links or the download page for some mirrored stuff.
Kernel
Built a custom kernel with the following options (more info about building a kernel can be found in the Kernel-HOWTO):
- CONFIG_EXPERIMENTAL=Y (Prompt for development and/or incomplete code/drivers): Only needed for < 2.2.9 kernels.
- Enable (built-in or as module) all QOS options in last option in "Networking options"
After that: compile the kernel and boot from it.
IProute2+tc
Install a prebuild IProute2+tc package or get and compile the source.
IProute2+tc = 2 programs:
- ip: like ipconfig but much, much more powerful.
- tc: Traffic Control = controls the QOS mechanism in the linux kernel.
To enable DiffServ, you need to enable this in the file Config and recompile the tc program.
Patches
You can also patch the kernel to add extra features.
- Differentiated Services : with this patch you should be able to manage the incoming bandwidth, but I never could get it working (TODO). This is builtin in kernel 2.4.x.
- WRR scheduler : looks cool, but I still have to test it.
- HTB qdisc: like cbq, but much better.