Traffic Control HOWTO

Version 1.1

© 2016, 2006, Martin A. Brown

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no invariant sections, with no Front-Cover Texts, with no Back-Cover Text. A copy of the license is located at http://www.gnu.org/licenses/fdl.html.

2016-03-11

Revision History
Revision 1.1.02016-01-30MAB
Incorporate new qdisc description sections written by Federico Bollelli and Natale Patriciello
Revision 1.0.22006-10-28MAB
Add references to HFSC, alter author email addresses
Revision 1.0.12003-11-17MAB
Added link to Leonardo Balliache's documentation
Revision 1.02003-09-24MAB
reviewed and approved by TLDP
Revision 0.72003-09-14MAB
incremental revisions, proofreading, ready for TLDP
Revision 0.62003-09-09MAB
minor editing, corrections from Stef Coene
Revision 0.52003-09-01MAB
HTB section mostly complete, more diagrams, LARTC pre-release
Revision 0.42003-08-30MAB
added diagram
Revision 0.32003-08-29MAB
substantial completion of classless, software, rules, elements and components sections
Revision 0.22003-08-23MAB
major work on overview, elements, components and software sections
Revision 0.12003-08-15MAB
initial revision (outline complete)

Abstract

Traffic control encompasses the sets of mechanisms and operations by which packets are queued for transmission/reception on a network interface. The operations include enqueuing, policing, classifying, scheduling, shaping and dropping. This HOWTO provides an introduction and overview of the capabilities and implementation of traffic control under Linux.


Table of Contents

1. Introduction to Linux Traffic Control
1.1. Target audience and assumptions about the reader
1.2. Conventions
1.3. Recommended approach
1.4. Missing content, corrections and feedback
2. Overview of Concepts
2.1. What is it?
2.2. Why use it?
2.3. Advantages
2.4. Disdvantages
2.5. Queues
2.6. Flows
2.7. Tokens and buckets
2.8. Packets and frames
2.9. NIC, Network Interface Controller
2.10. Starvation and Latency
2.11. Relationship between throughput and latency
3. Traditional Elements of Traffic Control
3.1. Shaping
3.2. Scheduling
3.3. Classifying
3.4. Policing
3.5. Dropping
3.6. Marking
4. Components of Linux Traffic Control
4.1. qdisc
4.2. class
4.3. filter
4.4. classifier
4.5. policer
4.6. drop
4.7. handle
4.8. txqueuelen
4.9. Driver Queue (aka ring buffer)
4.10. Byte Queue Limits (BQL)
5. Software and Tools
5.1. Kernel requirements
5.2. iproute2 tools (tc)
5.3. tcng, Traffic Control Next Generation
5.4. Netfilter
5.5. IMQ, Intermediate Queuing device
5.6. ethtool, Driver Queue
6. Classless Queuing Disciplines (qdiscs)
6.1. FIFO, First-In First-Out (pfifo and bfifo)
6.2. pfifo_fast, the default Linux qdisc
6.3. SFQ, Stochastic Fair Queuing
6.4. ESFQ, Extended Stochastic Fair Queuing
6.5. RED,Random Early Drop
6.6. GRED, Generic Random Early Drop
6.7. TBF, Token Bucket Filter
7. Classful Queuing Disciplines (qdiscs)
7.1. HTB, Hierarchical Token Bucket
7.2. HFSC, Hierarchical Fair Service Curve
7.3. PRIO, priority scheduler
7.4. CBQ, Class Based Queuing (CBQ)
7.5. WRR, Weighted Round Robin
8. Rules, Guidelines and Approaches
8.1. General Rules of Linux Traffic Control
8.2. Handling a link with a known bandwidth
8.3. Handling a link with a variable (or unknown) bandwidth
8.4. Sharing/splitting bandwidth based on flows
8.5. Sharing/splitting bandwidth based on IP
9. Scripts for use with QoS/Traffic Control
9.1. wondershaper
9.2. ADSL Bandwidth HOWTO script (myshaper)
9.3. htb.init
9.4. tcng.init
9.5. cbq.init
10. Diagram
10.1. General diagram
11. Annotated Traffic Control Links