User Tools

Site Tools


doc:uci:qos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:uci:qos [2012/09/14 05:43]
zuirch
doc:uci:qos [2015/06/14 13:28] (current)
grumbler_eburg [Classes]
Line 1: Line 1:
 ====== Quality of Service (qos-scripts) configuration ====== ====== Quality of Service (qos-scripts) configuration ======
-This is documentation for the UCI configuration file ''​[[https://​dev.openwrt.org/​browser/​trunk/​package/​qos-scripts/​files/​etc/​config/​qos|/​etc/​config/​qos]]''​. It is used by the package ''​qos-scripts''​ only.+This is the documentation for the UCI configuration file ''/​etc/​config/​qos''​. It is used by the package ''​qos-scripts''​ only.
  
-| {{:​meta:​icons:​tango:​48px-emblem-important.svg.png?​nolink}} | So far (2010) there are at least two other packages in the OpenWrt repositories regarding ​QoS/ToS: ''​[[https://​dev.openwrt.org/​browser/​packages/​net/​dsl-qos-queue|dsl-qos-queue]]''​ and ''​[[https://​dev.openwrt.org/​browser/​packages/​net/​wshaper|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 [[wp>​Asynchronous Transfer Mode|ATM (Asynchronous Transfer Mode)]] overhead, which can be significant. |+| {{:​meta:​icons:​tango:​48px-emblem-important.svg.png?​nolink}} | Do NOT install multiple QoS-packages simultaneously! Uninstall the old package before installing a new one. \\ There are at least two other QoS/​ToS ​packages in the OpenWrt repositories regarding: ''​[[https://​dev.openwrt.org/​browser/​packages/​net/​dsl-qos-queue|dsl-qos-queue]]''​ and ''​[[https://​dev.openwrt.org/​browser/​packages/​net/​wshaper|wshaper]]''​. They do NOT use this file.\\ ​\\ ''​qos-scripts''​ is written in AWK/shell script and uses [[doc/​howto/​packet.scheduler/​sch_hfsc]] and [[doc/​howto/​packet.scheduler/​sch_fq_codel]]\\ ''​dsl-qos-queue''​ does factor in the [[wp>​Asynchronous Transfer Mode|ATM (Asynchronous Transfer Mode)]] overhead, which can be significant. Removed in [[https://​dev.openwrt.org/​changeset/​37494|r37494]]\\ ''​wshaper''​ is and uses [[doc/​howto/​packet.scheduler/​sch_sfq]] [[doc/​howto/​packet.scheduler/​sch_htb]] [[doc/​howto/​packet.scheduler/​act_police]];​ [[http://​lartc.org/​wondershaper/​]] ​ \\ \\ For help writing your own script please see [[doc:​howto:​packet.scheduler:​packet.scheduler|Traffic Control on OpenWrt: configuring the Linux Network Scheduler]]. |
  
-| {{:​meta:​icons:​tango:​dialog-information.png?​nolink}} | You can browse the scripts here: ''​[[https://​dev.openwrt.org/​browser/​trunk/​package/​qos-scripts|qos-scripts]]''​\\ There is direct LuCI-support for ''​qos-scripts''​ called: ''​luci-app-qos''​.\\ NOTE: ''​luci-app-qos''​ won't start until you enable the ''​qos''​ Initscript within the System-->​Startup tab as well as enable qos under Network-->​QoS |+| {{:​meta:​icons:​tango:​dialog-information.png?​nolink}} | You can browse the scripts here: ''​[[https://​dev.openwrt.org/​browser/​trunk/​package/​network/​config/​qos-scripts|qos-scripts]]''​\\ There is direct LuCI-support for ''​qos-scripts''​ called: ''​luci-app-qos''​.\\ NOTE: ''​luci-app-qos''​ won't start until you enable the ''​qos''​ Initscript within the System-->​Startup tab as well as enable qos under Network-->​QoS |
  
-| {{:​meta:​icons:​tango:​dialog-information.png?​nolink}} | For help writing your own script please see [[doc:​howto:​packet.scheduler:​Packet Scheduler]]. | 
  
 | {{:​meta:​icons:​tango:​48px-outdated.svg.png?​nolink}} | As of [[https://​dev.openwrt.org/​changeset/​25641/​trunk|r25641]] ''​qos-scripts''​ dropped the use of IMQ (package ''​iptables-mod-imq''​ – Intermediate Queueing Device). Its successor is [[http://​www.linuxfoundation.org/​collaborate/​workgroups/​networking/​ifb|IFB (Intermediate Functional Block device)]], (requires package: ''​kmod-ifb''​ and the scheduler action //​[[https://​dev.openwrt.org/​browser/​trunk/​package/​iproute2/​patches/​200-act_connmark.patch?​rev=25639|act_connmark]]//​ included). ​ | | {{:​meta:​icons:​tango:​48px-outdated.svg.png?​nolink}} | As of [[https://​dev.openwrt.org/​changeset/​25641/​trunk|r25641]] ''​qos-scripts''​ dropped the use of IMQ (package ''​iptables-mod-imq''​ – Intermediate Queueing Device). Its successor is [[http://​www.linuxfoundation.org/​collaborate/​workgroups/​networking/​ifb|IFB (Intermediate Functional Block device)]], (requires package: ''​kmod-ifb''​ and the scheduler action //​[[https://​dev.openwrt.org/​browser/​trunk/​package/​iproute2/​patches/​200-act_connmark.patch?​rev=25639|act_connmark]]//​ included). ​ |
  
 | {{:​meta:​icons:​tango:​48px-outdated.svg.png?​nolink}} | As of [[https://​dev.openwrt.org/​changeset/​31759|r31759]] ''​qos-scripts''​ replaced sfq/red with fq_codel to massively improve latency under load  | | {{:​meta:​icons:​tango:​48px-outdated.svg.png?​nolink}} | As of [[https://​dev.openwrt.org/​changeset/​31759|r31759]] ''​qos-scripts''​ replaced sfq/red with fq_codel to massively improve latency under load  |
- 
  
  
  
 ===== Sections ===== ===== 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.+A minimal QoS configuration usually consists of
 +  * one //​interface//​ section 
 +  * some //rules// allocating packets to at least two buckets 
 +  * //​configuration//​ of the buckets.
  
 ==== Interface ==== ==== Interface ====
Line 32: Line 33:
 ^ Name ^ Type ^ Required ^ Default ^ Description ^ ^ Name ^ Type ^ Required ^ Default ^ Description ^
 | ''​enabled''​ | boolean | yes | ''​1''​ | Enable/​Disable QoS | | ''​enabled''​ | boolean | yes | ''​1''​ | Enable/​Disable QoS |
-| ''​classgroup''​ | string | yes//(none)// | no idea FIXME |+| ''​classgroup''​ | string | yes | ''​Default''​ | Specify ''​classgroup''​ used for this interface ​(see description of ''​classgroup''​ below) |
 | ''​overhead''​ | boolean | yes | ''​1''​ | decrease upload and download ratio to prevent link saturation | | ''​overhead''​ | boolean | yes | ''​1''​ | decrease upload and download ratio to prevent link saturation |
-| ''​download''​ | integer | yes | ''​4096''​ | in ''​kilobits/​second'' ​(only possible for tcp) +| ''​download''​ | integer | yes | ''​4096''​ | Download limit in ''​kilobits/​second''​ | 
-| ''​upload''​ | integer | yes | ''​512''​ | in ''​kilobits/​second''​ |+| ''​upload''​ | integer | yes | ''​512''​ | Upload limit in ''​kilobits/​second''​ |
  
 ==== Rules ==== ==== Rules ====
Line 57: Line 58:
 | ''​dscp''​ | 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 | | ''​direction''​ | string | no | //(none)// | Packets matching this traffic direction (''​in''​ or ''​out''​) belong to the bucket defined in target |
- 
  
 ==== Classgroup ==== ==== Classgroup ====
-As we can have more then one interfaces, we can have more then one classgroups.+As we can have more then one interface, we can have more then one classgroup. 
 + 
 +<​code>​ 
 +config classgroup "​Default"​ 
 + option classes ​     "​Priority Express Normal Bulk"​ 
 + option default ​     "​Normal"​ 
 +</​code>​
  
 ^ Name ^ Type ^ Required ^ Default ^ Description ^ ^ Name ^ Type ^ Required ^ Default ^ Description ^
-| ''​classes''​ | bucket names | yes | //(none)// | Specifies the number ​of //buckets// and their names +| ''​classes''​ | bucket names | yes | //(none)// | Specifies the list of  names of //classes//  
-| ''​default''​ | bucket name | yes | //(none)// | Defines which //bucket// is considered default |+| ''​default''​ | bucket name | yes | //(none)// | Defines which //class// is considered default |
  
  
 ==== Classes ==== ==== Classes ====
 Each Bucket has its own configuration. Each Bucket has its own configuration.
 +
 +Example:
 +<​code>​
 +config class "​Normal"​
 + option packetsize ​ 1500
 + option packetdelay 100
 + option avgrate ​    10
 + option priority ​   5
 +</​code>​
  
 ^ Name ^ Type ^ Required ^ Default ^ Description ^ ^ Name ^ Type ^ Required ^ Default ^ Description ^
Line 74: Line 89:
 | ''​packetdelay''​ | integer | yes | //(none)// | in ms | | ''​packetdelay''​ | integer | yes | //(none)// | in ms |
 | ''​maxsize''​ | integer | yes | //(none)// | in bytes | | ''​maxsize''​ | integer | yes | //(none)// | in bytes |
-| ''​avgrate''​ | integer | yes | //(none)// | unknown, value in % |+| ''​avgrate''​ | integer | yes | //(none)// | Average rate for this class, value in % of bandwidth (this value uses for calculate vaues '​Nx'​ of '''​tc ... hfsc rt m1 N1 d N2 m2 N3'''​) ​|
 | ''​limitrate''​ | integer | no  | 100 | Defines to how much percent of the available bandwidth this class is capped to, value in % | | ''​limitrate''​ | 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 | | ''​maxsize''​ | integer | yes | //(none)// | in bytes |
 | ''​priority''​ | integer | yes | //(none)// | in % | | ''​priority''​ | integer | yes | //(none)// | in % |
 +
 +==== Classes (For Advanced Users) ====
 +Below is unverified technical breakdown of each /​etc/​config/​qos claass parameters. Source: [[http://​pastebin.com/​YL55na2E]]
 +<​code>​
 +### Params:
 +#
 +# maxsize:
 +#       ​limits packet size in iptables rule
 +#
 +# avgrate: (note: sum(avgrates) ~ 100)
 +#       rt m1 = avgrate / sum (avgrate) * max_bandwidth
 +#       rt m2 = avgrate * max_bandwidth / 100
 +#       ls m1 = rt m1
 +#
 +# packetsize & packetdelay:​ (only works if avgrate is present)
 +#       rt d = max( packetdelay,​ 'time required for packetsize to transfer'​ ) (smaller ps -> smaller d)
 +#       ls d = rt d
 +#
 +# priority:
 +#       ls m2 = priority / sum (priority) * max_bandwidth
 +#
 +# limitrate:
 +#       ul rate = limitrate * max_bandwidth / 100
 +</​code>​
  
 ===== Quick start guide ===== ===== Quick start guide =====
Line 87: Line 126:
 </​code>​ </​code>​
  
-2. Perform minimum ​configuration ​needed ​using UCI command line:+2. Basic configuration using UCI command line:
  
 <​code>​ <​code>​
 uci set qos.wan.upload=1000 ​           # Upload speed in kBits/s uci set qos.wan.upload=1000 ​           # Upload speed in kBits/s
 uci set qos.wan.download=16000 ​        # Download speed in kBits/s uci set qos.wan.download=16000 ​        # Download speed in kBits/s
 +uci set qos.wan.enabled=1
 uci commit qos</​code>​ uci commit qos</​code>​
  
-3. Start it immediatly (look for error output and test):+3. Start it and look for error output and test):
  
 <​code>​ <​code>​
Line 105: Line 145:
 /​etc/​init.d/​qos enable /​etc/​init.d/​qos enable
 </​code>​ </​code>​
 +
 +===== Troubleshooting =====
 +
 +(Last updated for: Barrier Breaker 14.07)
 +
 +If your QoS doesn'​t seem to be working, it may be an error or typo in the config file is preventing it from loading properly.
 +
 +  * Check //enabled// is set to 1 in ///​etc/​config/​qos//​(!)
 +
 +  * Run //​iptables-save//​ and check there are lines near the top prefixed with either //-A qos_Default//​ or //-A qos_Default_ct//,​ and featuring the //​--set-xmark//​ directive. Here's an example:
 +<​code>​
 +-A qos_Default -p tcp -m mark --mark 0x0/0xf0 -m tcp --sport 1024:65535 --dport 1024:65535 -j MARK --set-xmark 0x44/0xff
 +</​code>​
 +The //​--set-xmark//​ is what flags the packet so it is picked up the traffic control subsystem.
 +
 +  * Look at the generated traffic control qdisc settings by running:
 +
 +<​code>​
 +tc qdisc
 +</​code>​
 +
 +The default (ie no-QoS-applied) values for any interface look like this:
 +
 +<​code>​
 +qdisc fq_codel 0: dev eth0 root refcnt 2 limit 1024p flows 1024 quantum 300 target 5.0ms interval 100.0ms ecn
 +</​code>​
 +
 +... Any interface with only a single qdisc line printed, showing the same settings as this line (this one is for //dev eth0//), indicates no QoS on that interface.
 +
 +Network interfaces with QoS enabled will have multiple qdisc lines printed, each corresponding to a QoS class, etc.
 +
 +  * If the printed qdisc settings don't seem to be correct, you can preview the //tc// commands generated from the OpenWRT ///​etc/​config/​qos//​ by running:
 +
 +<​code>​
 +/​usr/​lib/​qos/​generate.sh interface wan
 +</​code>​
 +
 +(Replace '​wan'​ with the OpenWRT interface name you're debugging, as given in the ///​etc/​config/​qos//​ file.)
 +
 +This should print a series of //insmod// and //tc// commands used to set up the QoS subsystem. You can debug any errors caused by running these commands by running:
 +
 +<​code>​
 +/​usr/​lib/​qos/​generate.sh interface wan | sh -x
 +</​code>​
 +
 +(Note //-x// option which tells //sh// to print each line as it is executed.)
 +
 +The output of ///​usr/​lib/​qos/​generate.sh//​ is normally executed automatically as part of ///​etc/​hotplug.d/​iface/​10-qos//​.
  
 ===== txqueuelen ===== ===== txqueuelen =====
Line 129: Line 217:
 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). 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).
  
 +===== Tags =====
 +{{tag>​QoS}}
doc/uci/qos.1347594203.txt.bz2 · Last modified: 2012/09/14 05:43 by zuirch