version 4, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
HTB |
|
|
2 |
!!!HTB |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
SHAPING ALGORITHM |
|
|
7 |
CLASSIFICATION |
|
|
8 |
LINK SHARING ALGORITHM |
|
|
9 |
QDISC |
|
|
10 |
CLASSES |
|
|
11 |
NOTES |
|
|
12 |
BUGS |
|
|
13 |
SEE ALSO |
|
|
14 |
AUTHOR |
|
|
15 |
---- |
|
|
16 |
!!NAME |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
HTB - Hierarchy Token Bucket |
|
|
20 |
!!SYNOPSIS |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__tc qdisc ... dev__ dev __( parent__ classid __| |
|
|
24 |
root) [[ handle__ major: __] htb [[ default__ minor-id |
|
|
25 |
__]__ |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
__tc class ... dev__ dev __parent__ major:[[minor] __[[ |
|
|
29 |
classid__ major:minor __] htb rate__ rate __[[ ceil__ |
|
|
30 |
rate __] burst__ bytes __[[ cburst__ bytes __] [[ |
|
|
31 |
prio__ priority __]__ |
|
|
32 |
!!DESCRIPTION |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
HTB is meant as a more understandable and intuitive |
|
|
36 |
replacement for the CBQ qdisc in Linux. Both CBQ and HTB |
|
|
37 |
help you to control the use of the outbound bandwidth on a |
|
|
38 |
given link. Both allow you to use one physical link to |
|
|
39 |
simulate several slower links and to send different kinds of |
|
|
40 |
traffic on different simulated links. In both cases, you |
|
|
41 |
have to specify how to divide the physical link into |
|
|
42 |
simulated links and how to decide which simulated link to |
|
|
43 |
use for a given packet to be sent. |
|
|
44 |
|
|
|
45 |
|
|
|
46 |
Unlike CBQ, HTB shapes traffic based on the Token Bucket |
|
|
47 |
Filter algorithm which does not depend on interface |
|
|
48 |
characteristics and so does not need to know the underlying |
|
|
49 |
bandwidth of the outgoing interface. |
|
|
50 |
!!SHAPING ALGORITHM |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
Shaping works as documented in __tc-tbf |
|
|
54 |
(8).__ |
|
|
55 |
!!CLASSIFICATION |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
Within the one HRB instance many classes may exist. Each of |
|
|
59 |
these classes contains another qdisc, by default |
4 |
perry |
60 |
tc-pfifo(8). |
1 |
perry |
61 |
|
|
|
62 |
|
|
|
63 |
When enqueueing a packet, HTB starts at the root and uses |
|
|
64 |
various methods to determine which class should receive the |
|
|
65 |
data. |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
In the absence of uncommon configuration options, the |
|
|
69 |
process is rather easy. At each node we look for an |
|
|
70 |
instruction, and then go to the class the instruction refers |
|
|
71 |
us to. If the class found is a barren leaf-node (without |
|
|
72 |
children), we enqueue the packet there. If it is not yet a |
|
|
73 |
leaf node, we do the whole thing over again starting from |
|
|
74 |
that node. |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
The following actions are performed, in order at each node |
|
|
78 |
we visit, until one sends us to another node, or terminates |
|
|
79 |
the process. |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
(i) |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
Consult filters attached to the class. If sent to a |
|
|
86 |
leafnode, we are done. Otherwise, restart. |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
(ii) |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
If none of the above returned with an instruction, enqueue |
|
|
93 |
at this node. |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
This algorithm makes sure that a packet always ends up |
|
|
97 |
somewhere, even while you are busy building your |
|
|
98 |
configuration. |
|
|
99 |
!!LINK SHARING ALGORITHM |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
FIXME |
|
|
103 |
!!QDISC |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
The root of a CBQ qdisc class tree has the following |
|
|
107 |
parameters: |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
parent major:minor | root |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
This mandatory parameter determines the place of the CBQ |
|
|
114 |
instance, either at the __root__ of an interface or |
|
|
115 |
within an existing class. |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
handle major: |
|
|
119 |
|
|
|
120 |
|
|
|
121 |
Like all other qdiscs, the CBQ can be assigned a handle. |
|
|
122 |
Should consist only of a major number, followed by a colon. |
|
|
123 |
Optional, but very useful if classes will be generated |
|
|
124 |
within this qdisc. |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
default minor-id |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
Unclassified traffic gets sent to the class with this |
|
|
131 |
minor-id. |
|
|
132 |
!!CLASSES |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
Classes have a host of parameters to configure their |
|
|
136 |
operation. |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
parent major:minor |
|
|
140 |
|
|
|
141 |
|
|
|
142 |
Place of this class within the hierarchy. If attached |
|
|
143 |
directly to a qdisc and not to another class, minor can be |
|
|
144 |
omitted. Mandatory. |
|
|
145 |
|
|
|
146 |
|
|
|
147 |
classid major:minor |
|
|
148 |
|
|
|
149 |
|
|
|
150 |
Like qdiscs, classes can be named. The major number must be |
|
|
151 |
equal to the major number of the qdisc to which it belongs. |
|
|
152 |
Optional, but needed if this class is going to have |
|
|
153 |
children. |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
prio priority |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
In the round-robin process, classes with the lowest priority |
|
|
160 |
field are tried for packets first. Mandatory. |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
rate rate |
|
|
164 |
|
|
|
165 |
|
|
|
166 |
Maximum rate this class and all its children are guaranteed. |
|
|
167 |
Mandatory. |
|
|
168 |
|
|
|
169 |
|
|
|
170 |
ceil rate |
|
|
171 |
|
|
|
172 |
|
|
|
173 |
Maximum rate at which a class can send, if its parent has |
|
|
174 |
bandwidth to spare. Defaults to the configured rate, which |
|
|
175 |
implies no borrowing |
|
|
176 |
|
|
|
177 |
|
|
|
178 |
burst bytes |
|
|
179 |
|
|
|
180 |
|
|
|
181 |
Amount of bytes that can be burst at __ceil__ speed, in |
|
|
182 |
excess of the configured __rate.__ Should be at least as |
|
|
183 |
high as the highest burst of all children. |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
cburst bytes |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
Amount of bytes that can be burst at 'infinite' speed, in |
|
|
190 |
other words, as fast as the interface can transmit them. For |
|
|
191 |
perfect evening out, should be equal to at most one average |
|
|
192 |
packet. Should be at least as high as the highest cburst of |
|
|
193 |
all children. |
|
|
194 |
!!NOTES |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
Due to Unix timing constraints, the maximum ceil rate is not |
|
|
198 |
infinite and may in fact be quite low. On Intel, there are |
|
|
199 |
100 timer events per second, the maximum rate is that rate |
|
|
200 |
at which 'burst' bytes are sent each timer tick. From this, |
|
|
201 |
the mininum burst size for a specified rate can be |
|
|
202 |
calculated. For i386, a 10mbit rate requires a 12 kilobyte |
|
|
203 |
burst as 100*12kb*8 equals 10mbit. |
|
|
204 |
!!BUGS |
|
|
205 |
|
|
|
206 |
|
|
|
207 |
Not in the stock kernel yet. |
|
|
208 |
!!SEE ALSO |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
tc(8) |
|
|
212 |
|
|
|
213 |
|
|
|
214 |
HTB website: |
|
|
215 |
http://luxik.cdi.cz/~devik/qos/htb/ |
|
|
216 |
!!AUTHOR |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
Martin Devera |
|
|
220 |
---- |