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 ] [ offload ]
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 de‐
24 cide 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 in‐
72 stance, either at the root of an interface or within an existing
73 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 offload
88 Offload the HTB algorithm to hardware (requires driver and de‐
89 vice support).
90
91
93 Classes have a host of parameters to configure their operation.
94
95
96 parent major:minor
97 Place of this class within the hierarchy. If attached directly
98 to a qdisc and not to another class, minor can be omitted.
99 Mandatory.
100
101 classid major:minor
102 Like qdiscs, classes can be named. The major number must be
103 equal to the major number of the qdisc to which it belongs. Op‐
104 tional, but needed if this class is going to have children.
105
106 prio priority
107 In the round-robin process, classes with the lowest priority
108 field are tried for packets first.
109
110
111 rate rate
112 Maximum rate this class and all its children are guaranteed.
113 Mandatory.
114
115
116 ceil rate
117 Maximum rate at which a class can send, if its parent has band‐
118 width to spare. Defaults to the configured rate, which implies
119 no borrowing
120
121
122 burst bytes
123 Amount of bytes that can be burst at ceil speed, in excess of
124 the configured rate. Should be at least as high as the highest
125 burst of all children.
126
127
128 cburst bytes
129 Amount of bytes that can be burst at 'infinite' speed, in other
130 words, as fast as the interface can transmit them. For perfect
131 evening out, should be equal to at most one average packet.
132 Should be at least as high as the highest cburst of all chil‐
133 dren.
134
135
136 quantum bytes
137 Number of bytes to serve from this class before the scheduler
138 moves to the next class. Default value is rate divided by the
139 qdisc r2q parameter. If specified, r2q is ignored.
140
141
143 Due to Unix timing constraints, the maximum ceil rate is not infinite
144 and may in fact be quite low. On Intel, there are 100 timer events per
145 second, the maximum rate is that rate at which 'burst' bytes are sent
146 each timer tick. From this, the minimum burst size for a specified
147 rate can be calculated. For i386, a 10mbit rate requires a 12 kilobyte
148 burst as 100*12kb*8 equals 10mbit.
149
150
152 tc(8)
153
154 HTB website: http://luxik.cdi.cz/~devik/qos/htb/
155
157 Martin Devera <devik@cdi.cz>. This manpage maintained by bert hubert
158 <ahu@ds9a.nl>
159
160
161
162iproute2 10 January 2002 HTB(8)