Quality of Service (qos-scripts) configuration

This is a documentation for the UCI configuration file /etc/config/qos. It is used by the package qos-scripts only.

So far (2010) there are at least two other packages in the OpenWrt repositories regarding QoS/ToS: dsl-qos-queue and wshaper. They do not use this file.
Please do not install multiple QoS-packages simultaneously! Simply de-install the old one, before installing a new one.
dsl-qos-queue does factor in the ATM (Asynchronous Transfer Mode) overhead, which can be significant.
You can browse the scripts here: qos-scripts
There is direct LuCI-support for qos-scripts called: luci-app-qos.
For help writing your own script please see Packet Scheduler.
As of r25641 qos-scripts dropped the use of IMQ (package iptables-mod-imq – Intermediate Queueing Device). Its successor is IFB (Intermediate Functional Block device), (requires package: kmod-ifb and the scheduler action act_connmark included).

Sections

A minimal QoS configuration usually consists of one interface section, of some rules allocating packets to at least two buckets and of the configuration of the buckets.

Interface

Each Interface can have its own buffer. The interface section declares global characteristics of the connection on which the specified interface is communicating. The following options are defined within this section:

config interface dsl
        option enabled      1
        option classgroup  "Default"
        option overhead     1
        option upload       512
        option download     4096

Name Type Required Default Description
enabled boolean yes 1 Enable/Disable QoS
classgroup string yes? (none) no idea
overhead boolean yes 1 decrease upload and download ratio to prevent link saturation
download integer yes 4096 in kilobits/second (only possible for tcp)
upload integer yes 512 in kilobits/second

Rules

Each classify section defines one group of packets and which target (i.e. bucket) this group belongs to. All the packets share the bucket specified.

Name Type Required Default Description
target bucket yes (none) The four defaults are: Priority, Express, Normal and Bulk
proto string no 0 Packets matching this protocol belong to the bucket defined in target
srchost string no (none) Packets matching this source host(s) (single IP or in CIDR notation) belong to the bucket defined in target
dsthost string no (none) Packets matching this destination host(s) (single IP or in CIDR notation) belong to the bucket defined in target
ports integer no (none) Packets matching this, belong to the bucket defined in target
srcports integer no (none) Packets matching this, belong to the bucket defined in target
dstports integer no (none) Packets matching this, belong to the bucket defined in target
portrange integer no (none) Packets matching this, belong to the bucket defined in target
pktsize integer no (none) Packets matching this, belong to the bucket defined in target
tcpflags string no (none) Packets matching this, belong to the bucket defined in target
mark string no (none) Packets matching this, belong to the bucket defined in target
layer7 string no (none) Packets matching this, belong to the bucket defined in target
connbytes int no (none) Packets matching this, belong to the bucket defined in target
tos string no (none) Packets matching this, belong to the bucket defined in target
dscp string no (none) Packets matching this, belong to the bucket defined in target
direction string no (none) Packets matching this traffic direction (in or out) belong to the bucket defined in target

Classgroup

As we can have more then one interfaces, we can have more then one classgroups.

Name Type Required Default Description
classes bucket names yes (none) Specifies the number of buckets and their names
default bucket name yes (none) Defines which bucket is considered default

Classes

Each Bucket has its own configuration.

Name Type Required Default Description
packetsize integer yes (none) in bytes
packetdelay integer yes (none) in ms
maxsize integer yes (none) in bytes
avgrate integer yes (none) unknown, value in %
maxrate integer no 100 Defines to how much percent of the available bandwidth this class is capped to, value in %
maxsize integer yes (none) in bytes
priority integer yes (none) in %

Quick start guide

1. Install the qos-scripts package:

opkg install qos-scripts

2. Perform minimum configuration needed using UCI command line:

uci set qos.wan.upload=1000            # Upload speed in kBits/s
uci set qos.wan.download=16000         # Download speed in kBits/s
uci commit qos

3. Start it immediatly (look for error output and test):

/etc/init.d/qos start

4. Make script run at every boot up:

/etc/init.d/qos enable

Types and Groups

The qos-scripts package didn't come with documentation and there has been some confusion about its features, among users. The information in this section comes straight from nbd (the developer), so it should come a long way to clearing some confusion on two major issues.

The biggest item of contention was which group setting gives better performance, Priority or Express. As it turns out, it depends on the application. Priority boosts low-bandwidth small frames, such as TCP-ACKs and DNS more than Express. Express is for prioritizing bigger frames, which would include stuff like VoIP (port 5060).

Another biggie was the exact meaning of each type. Types are necessary for connection tracking. By default, Classify is not run on a connection that had already been assigned a traffic class, so it is the initial connection-tracked classification. Reclassify can override the traffic class per packet, without altering the connection tracking mark. Default is a fall-back for everything that has not been marked by Classify/Reclassify. Rules get processed by type first (Classify gets processed first, then Reclassify and finally Default) and then based on the order in the configuration file (top to bottom).

Back to top

doc/uci/qos.txt · Last modified: 2012/05/12 07:52 by kenyon