1 .TH TC 8 "16 December 2001" "iproute2" "Linux"
3 tc \- show / manipulate traffic control settings
5 .B tc qdisc [ add | change | replace | link ] dev
13 [ qdisc specific parameters ]
16 .B tc class [ add | change | replace ] dev
22 [ qdisc specific parameters ]
25 .B tc filter [ add | change | replace ] dev
33 [ filtertype specific parameters ]
53 \fB\-s\fR[\fItatistics\fR] |
54 \fB\-d\fR[\fIetails\fR] |
56 \fB\-p\fR[\fIretty\fR] |
61 is used to configure Traffic Control in the Linux kernel. Traffic Control consists
66 When traffic is shaped, its rate of transmission is under control. Shaping may
67 be more than lowering the available bandwidth - it is also used to smooth out
68 bursts in traffic for better network behaviour. Shaping occurs on egress.
72 By scheduling the transmission of packets it is possible to improve interactivity
73 for traffic that needs it while still guaranteeing bandwidth to bulk transfers. Reordering
74 is also called prioritizing, and happens only on egress.
78 Where shaping deals with transmission of traffic, policing pertains to traffic
79 arriving. Policing thus occurs on ingress.
83 Traffic exceeding a set bandwidth may also be dropped forthwith, both on
84 ingress and on egress.
87 Processing of traffic is controlled by three kinds of objects: qdiscs,
92 is short for 'queueing discipline' and it is elementary to
93 understanding traffic control. Whenever the kernel needs to send a
94 packet to an interface, it is
96 to the qdisc configured for that interface. Immediately afterwards, the kernel
97 tries to get as many packets as possible from the qdisc, for giving them
98 to the network adaptor driver.
100 A simple QDISC is the 'pfifo' one, which does no processing at all and is a pure
101 First In, First Out queue. It does however store traffic when the network interface
102 can't handle it momentarily.
105 Some qdiscs can contain classes, which contain further qdiscs - traffic may
106 then be enqueued in any of the inner qdiscs, which are within the
108 When the kernel tries to dequeue a packet from such a
110 it can come from any of the classes. A qdisc may for example prioritize
111 certain kinds of traffic by trying to dequeue from certain classes
117 is used by a classful qdisc to determine in which class a packet will
118 be enqueued. Whenever traffic arrives at a class with subclasses, it needs
119 to be classified. Various methods may be employed to do so, one of these
120 are the filters. All filters attached to the class are called, until one of
121 them returns with a verdict. If no verdict was made, other criteria may be
122 available. This differs per qdisc.
124 It is important to notice that filters reside
126 qdiscs - they are not masters of what happens.
129 The classless qdiscs are:
132 Simplest usable qdisc, pure First In, First Out behaviour. Limited in
136 Standard qdisc for 'Advanced Router' enabled kernels. Consists of a three-band
137 queue which honors Type of Service flags, as well as the priority that may be
138 assigned to a packet.
141 Random Early Detection simulates physical congestion by randomly dropping
142 packets when nearing configured bandwidth allocation. Well suited to very
143 large bandwidth applications.
146 Stochastic Fairness Queueing reorders queued traffic so each 'session'
147 gets to send a packet in turn.
150 The Token Bucket Filter is suited for slowing traffic down to a precisely
151 configured rate. Scales well to large bandwidths.
152 .SH CONFIGURING CLASSLESS QDISCS
153 In the absence of classful qdiscs, classless qdiscs can only be attached at
154 the root of a device. Full syntax:
159 QDISC QDISC-PARAMETERS
169 qdisc is the automatic default in the absence of a configured qdisc.
172 The classful qdiscs are:
175 Class Based Queueing implements a rich linksharing hierarchy of classes.
176 It contains shaping elements as well as prioritizing capabilities. Shaping is
177 performed using link idle time calculations based on average packet size and
178 underlying link bandwidth. The latter may be ill-defined for some interfaces.
181 The Hierarchy Token Bucket implements a rich linksharing hierarchy of
182 classes with an emphasis on conforming to existing practices. HTB facilitates
183 guaranteeing bandwidth to classes, while also allowing specification of upper
184 limits to inter-class sharing. It contains shaping elements, based on TBF and
185 can prioritize classes.
188 The PRIO qdisc is a non-shaping container for a configurable number of
189 classes which are dequeued in order. This allows for easy prioritization
190 of traffic, where lower classes are only able to send if higher ones have
191 no packets available. To facilitate configuration, Type Of Service bits are
193 .SH THEORY OF OPERATION
194 Classes form a tree, where each class has a single parent.
195 A class may have multiple children. Some qdiscs allow for runtime addition
196 of classes (CBQ, HTB) while others (PRIO) are created with a static number of
199 Qdiscs which allow dynamic addition of classes can have zero or more
200 subclasses to which traffic may be enqueued.
202 Furthermore, each class contains a
206 behaviour though another qdisc can be attached in place. This qdisc may again
207 contain classes, but each class can have only one leaf qdisc.
209 When a packet enters a classful qdisc it can be
211 to one of the classes within. Three criteria are available, although not all
212 qdiscs will use all three:
215 If tc filters are attached to a class, they are consulted first
216 for relevant instructions. Filters can match on all fields of a packet header,
217 as well as on the firewall mark applied by ipchains or iptables.
220 Some qdiscs have built in rules for classifying packets based on the TOS field.
223 Userspace programs can encode a class-id in the 'skb->priority' field using
224 the SO_PRIORITY option.
226 Each node within the tree can have its own filters but higher level filters
227 may also point directly to lower classes.
229 If classification did not succeed, packets are enqueued to the leaf qdisc
230 attached to that class. Check qdisc specific manpages for details, however.
233 All qdiscs, classes and filters have IDs, which can either be specified
234 or be automatically assigned.
236 IDs consist of a major number and a minor number, separated by a colon.
240 A qdisc, which potentially can have children,
241 gets assigned a major number, called a 'handle', leaving the minor
242 number namespace available for classes. The handle is expressed as '10:'.
243 It is customary to explicitly assign a handle to qdiscs expected to have
248 Classes residing under a qdisc share their qdisc major number, but each have
249 a separate minor number called a 'classid' that has no relation to their
250 parent classes, only to their parent qdisc. The same naming custom as for
255 Filters have a three part ID, which is only needed when using a hashed
258 All parameters accept a floating point number, possibly followed by a unit.
260 Bandwidths or rates can be specified in:
277 Amounts of data can be specified in:
294 Lengths of time can be specified in:
302 us, usec, usecs or a bare number
306 The following commands are available for qdiscs, classes and filter:
309 Add a qdisc, class or filter to a node. For all entities, a
311 must be passed, either by passing its ID or by attaching directly to the root of a device.
312 When creating a qdisc or a filter, it can be named with the
314 parameter. A class is named with the
320 A qdisc can be removed by specifying its handle, which may also be 'root'. All subclasses and their leaf qdiscs
321 are automatically deleted, as well as any filters attached to them.
325 Some entities can be modified 'in place'. Shares the syntax of 'add', with the exception
326 that the handle cannot be changed and neither can the parent. In other words,
333 Performs a nearly atomic remove/add on an existing node id. If the node does not exist yet
338 Only available for qdiscs and performs a replace where the node
342 The show command has additional formatting options:
345 .BR "\-s" , " \-stats", " \-statistics"
346 output more statistics about packet usage.
349 .BR "\-d", " \-details"
350 output more detailed information about rates and cell sizes.
354 output raw hex values for handles.
357 .BR "\-p", " \-pretty"
358 decode filter offset and mask values to equivalent filter commands based on TCP/IP.
362 print rates in IEC units (ie. 1K = 1024).
367 was written by Alexey N. Kuznetsov and added in Linux 2.2.
381 .BR tc-pfifo_fast (8),
384 .RB "User documentation at " http://lartc.org/ ", but please direct bugreports and patches to: " <netdev@vger.kernel.org>
387 Manpage maintained by bert hubert (ahu@ds9a.nl)