1 .TH TC 8 "8 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 ]
37 .B tc [-s | -d ] qdisc show [ dev
41 .B tc [-s | -d ] class show dev
49 is used to configure Traffic Control in the Linux kernel. Traffic Control consists
54 When traffic is shaped, its rate of transmission is under control. Shaping may
55 be more than lowering the available bandwidth - it is also used to smooth out
56 bursts in traffic for better network behaviour.
60 By changing the relative positions of packets it is possible to improve interactivity
61 for traffic that needs it while still guaranteeing bandwidth to bulk transfers. Reordering
62 is also called prioritizing.
66 Traffic exceeding a set bandwidth may also be dropped forthwith.
69 Processing of traffic is controlled by three kinds of objects: qdiscs,
74 is short for 'queueing discipline' and it is elementary to
75 understanding traffic control. Whenever the kernel needs to send a
76 packet to an interface, it is
78 to the qdisc configured for that interface. Immediately afterwards, the kernel
79 tries to get as many packets as possible from the qdisc, for giving them
80 to the network adaptor driver.
82 A simple QDISC is the 'pfifo' one, which does no processing at all and is a pure
83 First In, First Out queue. It does however store traffic when the network interface
84 can't handle it momentarily.
87 Some qdiscs can contain further qdiscs - traffic may then be enqueued in any
88 of the inner qdiscs, which are called
90 When the kernel tries to dequeue a packet from such a
92 it can come from any of the classes. A qdisc may for example prioritize
93 certain kinds of traffic by trying to dequeue from certain classes
99 is used by a classful qdisc to determine in which class a packet will
100 be enqueued. Whenever traffic arrives in a classful queueing discipline,
101 it calls all filters attached to it to determine where to send it.
103 It is important to notice that filters reside
105 qdiscs - they are not masters of what happens.
108 The classless qdiscs are:
111 Simplest usable qdisc, pure First In, First Out behaviour. Limited in
115 Standard qdisc for 'Advanced Router' enabled kernels. Consists of a three-band
116 queue which honors Type of Service flags by default.
119 Random Early Detection simulates physical congestion by randomly dropping
120 packets when nearing configured bandwidth allocation. Well suited to very
121 large bandwidth applications.
124 Stochastic Faireness Queueing reorders queued traffic so each 'session'
125 gets to send a packet in turn.
128 The Token Bucket Filter is suited for slowing traffic down to a precisely
129 configured level. Scales well to large bandwidths.
130 .SH CONFIGURING CLASSLESS QDISCS
131 In the absence of classful qdiscs, classless qdiscs can only be attached at
132 the root of a device. Full syntax:
137 QDISC QDISC-PARAMETERS
147 qdisc is the automatic default in the absence of a configured qdisc.
150 The classful qdiscs are:
153 Class Based Queueing implements a rich linksharing hierarchy of classes.
154 It contains shaping elements as well as prioritizing capabilities. Shaping is
155 performed using link idle time calculations based on average packetsize and
156 underlying link bandwidth. The latter may be ill-defined for some interfaces.
159 The Hierarchy Token Bucket implements a rich linksharing hierarchy of
160 classes with an emphasis on conforming to existing practices. HTB facilitates
161 guaranteeing bandwidth to classes, while also allowing specification of upper
162 limits to inter-class sharing. It contains shaping elements, based on TBF and
163 can prioritize classes.
166 The PRIO qdisc is a non-shaping container for a configurable number of
167 classes which are dequeued in order. This allows for easy prioritization
168 of traffic, where lower classes are only able to send if higher ones have
169 no packets available. To facilitate configuration, Type Of Service bits are
171 .SH THEORY OF OPERATION
172 Classful qdiscs form a tree, where each class has a single parent.
173 A parent may have multiple children. Some qdiscs allow for runtime addition
174 of classes (CBQ, HTB) while others (PRIO) are created with a static number of
177 Qdiscs which allow dynamic classes can have zero or more subclasses to
178 which traffic may be enqueued.
180 Furthermore, each class contains a
184 behaviour though another qdisc can be attached in place. This qdisc may again
185 contain classes, but each class can have only one leaf qdisc.
187 When a packet enters a classful qdisc it can be
189 to one of the children. Three criteria are available, although not all qdiscs
193 If tc filters are attached to a classful qdisc, they are consulted first
194 for relevant instructions. Filters can match on all fields of a packet header,
195 as well as on the firewall mark applied by ipchains or iptables. See
199 Some qdiscs have built in rules for classifying packets based on the TOS field.
202 Userspace programs can encode a class-id in the 'skb->prio' field using
205 Each node within the tree can have its own filters but higher level filters
206 may also point directly to lower classes.
208 If classification did not succeed, packets are enqueued to the leaf qdisc
209 attached to that class. Check qdisc specific manpages for details, however.
212 All qdiscs, classes and filters have IDs, which can either be specified
213 or be automatically assigned.
215 IDs consist of a major number and a minor number, separated by a colon.
219 A qdisc, which potentially can have children,
220 gets assigned a major number, called a 'handle', leaving the minor
221 number namespace available for classes. The handle is expressed as '10:'.
222 It is customary to explicitly assign a handle to qdiscs expected to have
227 Classes residing under a qdisc share their qdisc major number, but each have
228 a separate minor number called a 'classid' that has no relation to their
229 parent classes, only to their parent qdisc. The same naming custom as for
234 Filters have a three part ID, which is only needed when using a hashed
235 filter hierarchy, for which see
239 The following commands are available for qdiscs, classes and filter:
242 Add a qdisc, class or filter to a node. For all entities, a
244 must be passed, either by passing its ID or by attaching directly to the root of a device.
245 When creating a qdisc or a filter, it can be named with the
247 parameter. A class is named with the
253 A qdisc can be removed by specifying its handle, which may also be 'root'. All subclasses and their leaf qdiscs
254 are automatically deleted, as well as any filters attached to them.
258 Some entities can be modified 'in place'. Shares the syntax of 'add', with the exception
259 that the handle cannot be changed and neither can the parent. In other words,
266 Performs a nearly atomic remove/add on an existing node id. If the node does not exist yet
271 Only available for qdiscs and performs a replace where the node
277 was written by Alexey N. Kuznetsov and added in Linux 2.2.
286 .BR tc-pfifo_fast (8),
290 Manpage maintained by bert hubert (ahu@ds9a.nl)