1HTB(8) Linux HTB(8)
2
3
4
6 HTB - Hierarchy Token Bucket
7
9 tc qdisc ... dev dev ( parent classid | root) [ handle major: ] htb [
10 default minor-id ] [ r2q divisor ]
11
12 tc class ... dev dev parent major:[minor] [ classid major:minor ] htb
13 rate rate [ ceil rate ] burst bytes [ cburst bytes ] [ prio priority ]
14 [ quantum bytes ]
15
16
18 HTB is meant as a more understandable and intuitive replacement for the
19 CBQ qdisc in Linux. Both CBQ and HTB help you to control the use of the
20 outbound bandwidth on a given link. Both allow you to use one physical
21 link to simulate several slower links and to send different kinds of
22 traffic on different simulated links. In both cases, you have to spec‐
23 ify how to divide the physical link into simulated links and how to
24 decide which simulated link to use for a given packet to be sent.
25
26 Unlike CBQ, HTB shapes traffic based on the Token Bucket Filter algo‐
27 rithm which does not depend on interface characteristics and so does
28 not need to know the underlying bandwidth of the outgoing interface.
29
30
32 Shaping works as documented in tc-tbf (8).
33
34
36 Within the one HTB instance many classes may exist. Each of these
37 classes contains another qdisc, by default tc-pfifo(8).
38
39 When enqueueing a packet, HTB starts at the root and uses various meth‐
40 ods to determine which class should receive the data.
41
42 In the absence of uncommon configuration options, the process is rather
43 easy. At each node we look for an instruction, and then go to the
44 class the instruction refers us to. If the class found is a barren
45 leaf-node (without children), we enqueue the packet there. If it is not
46 yet a leaf node, we do the whole thing over again starting from that
47 node.
48
49 The following actions are performed, in order at each node we visit,
50 until one sends us to another node, or terminates the process.
51
52 (i) Consult filters attached to the class. If sent to a leafnode, we
53 are done. Otherwise, restart.
54
55 (ii) If none of the above returned with an instruction, enqueue at
56 this node.
57
58 This algorithm makes sure that a packet always ends up somewhere, even
59 while you are busy building your configuration.
60
61
63 FIXME
64
65
67 The root of a HTB qdisc class tree has the following parameters:
68
69
70 parent major:minor | root
71 This mandatory parameter determines the place of the HTB
72 instance, either at the root of an interface or within an exist‐
73 ing class.
74
75 handle major:
76 Like all other qdiscs, the HTB can be assigned a handle. Should
77 consist only of a major number, followed by a colon. Optional,
78 but very useful if classes will be generated within this qdisc.
79
80 default minor-id
81 Unclassified traffic gets sent to the class with this minor-id.
82
83 r2q divisor
84 Divisor used to calculate quantum values for classes. Classes
85 divide rate by this number. Default value is 10.
86
87
89 Classes have a host of parameters to configure their operation.
90
91
92 parent major:minor
93 Place of this class within the hierarchy. If attached directly
94 to a qdisc and not to another class, minor can be omitted.
95 Mandatory.
96
97 classid major:minor
98 Like qdiscs, classes can be named. The major number must be
99 equal to the major number of the qdisc to which it belongs.
100 Optional, but needed if this class is going to have children.
101
102 prio priority
103 In the round-robin process, classes with the lowest priority
104 field are tried for packets first.
105
106
107 rate rate
108 Maximum rate this class and all its children are guaranteed.
109 Mandatory.
110
111
112 ceil rate
113 Maximum rate at which a class can send, if its parent has band‐
114 width to spare. Defaults to the configured rate, which implies
115 no borrowing
116
117
118 burst bytes
119 Amount of bytes that can be burst at ceil speed, in excess of
120 the configured rate. Should be at least as high as the highest
121 burst of all children.
122
123
124 cburst bytes
125 Amount of bytes that can be burst at 'infinite' speed, in other
126 words, as fast as the interface can transmit them. For perfect
127 evening out, should be equal to at most one average packet.
128 Should be at least as high as the highest cburst of all chil‐
129 dren.
130
131
132 quantum bytes
133 Number of bytes to serve from this class before the scheduler
134 moves to the next class. Default value is rate divided by the
135 qdisc r2q parameter. If specified, r2q is ignored.
136
137
139 Due to Unix timing constraints, the maximum ceil rate is not infinite
140 and may in fact be quite low. On Intel, there are 100 timer events per
141 second, the maximum rate is that rate at which 'burst' bytes are sent
142 each timer tick. From this, the minimum burst size for a specified
143 rate can be calculated. For i386, a 10mbit rate requires a 12 kilobyte
144 burst as 100*12kb*8 equals 10mbit.
145
146
148 tc(8)
149
150 HTB website: http://luxik.cdi.cz/~devik/qos/htb/
151
153 Martin Devera <devik@cdi.cz>. This manpage maintained by bert hubert
154 <ahu@ds9a.nl>
155
156
157
158iproute2 10 January 2002 HTB(8)