Traffic shaping/scheduling serves several primary use cases:
- General ongoing network contention between various hosts (e.g clients uploading/downloading from a server or a router directing traffic on the network).
- The server's workload would be better served by changing how packets are enqueued and dequeued
- Protecting high priority traffic from usage spikes in lower priority traffic (e.g. protecting production web server network performance from a full website publish being pushed to the server)
Historically, the command required possession of the CAP_NET_ADMIN capability (usually root has this) however as part of the move towards better support for Operating System Level Virtualization this was migrated over to NS_CAPABLE. This allows users who only administer particular namespaces to be able to set queuing disciplines within their namespace.
Analogous to I/O scheduling which shapes traffic sent to and from mass storage devices, queuing disciplines shape traffic going in (ingress) or going out (egress) a network interface.
Available queuing disciplines:
- HTB Hierarchical Token Bucket
- HFSC Hierarchical Fair Service Curve
- PRIO Priority Scheduler
- CBQ Class Based Queuing
- pfifo_fast Packet-wise First-in-First-Out. Consists of a three band (aka "class") queue which honors Type of Service flags, as well as the priority that may be assigned to a packet (as set by [Differentiated_services|DSCP]]). Unlike other queuing disciplines pfifo_fast does not allow you to change queuing discipline used by its classes.
- SFQ Stochastic Fair Queuing. Separates streams into classes based on a hashing algorithm that may result in two streams being assigned the hash ID. These hashes are periodically recalculated ("perturbed") so that any unintentional coupling is undone before it becomes apparent on the long term. For this reason it is called "stochastic" (meaning here essentially "random"). Nondeterministic hashing was chosen so that fewer queues would be needed and to speed computation time associated with queuing. 
- TBF Token bucket filter. Implements a Token bucket queueing discipline. This queuing discipline does not schedule network traffic (i.e reorder the network packets) it only shapes bandwidth.
- pfifo and bfifo Packet FIFO and Byte FIFO respectively. More or less identical, the only functional difference is whether the specific value for "limit" is measured in packets or in bytes
- noqueue Sends the packet immediately, or drops it if it can't be sent. It can not be set by the administrator and will only be used as the default queuing discipline for virtual devices (like loopback or virtual bridges). Not relevant for physical devices.
- CoDel and Fair Queueing CoDel
- mq Multiqueue
- netem Network Emulator. Simulates various aspects of a faulty network such as duplicating/dropping packets or delivering them out of order. Only useful for troubleshooting and performance measurements.
- "list of the Debian package iproute2". Debian.
- Linux Administration and Privileged Commands Manual –
- "[PATCH] net: Allow tc changes in user namespaces".
- Shreedhar, M. (June 1996). IEEE/ACM Transactions on Networking (TON) (IEEE) 4 (3): 375–385.
- cgroups Overlap somewhat in that they provide higher level network QoS controls that are enforced at the application level.
- Traffic Control HOWTO Dated but still very relevant HOWTO from the Linux Documentation Project.
- Linux Advanced Routing & Traffic Control HOWTO More up-to-date HOWTO for advanced networking topics, including traffic control
- Linux TC Notes brief note of various parts of linux traffic control. English is sometimes broken, but the information is still good.
- tc: Linux HTTP Outgoing Traffic Shaping Example use of tc for shaping tcp/80 traffic.
- Advanced Traffic Control ArchLinux wiki entry for traffic control with tc.
- tcng A proposed alternative to the regular tc program, however it appear to have stalled.
|This Linux-related article is a stub. You can help Wikipedia by expanding it.|