GUIDES
Linux Traffic Control (tc) Guide
A reference guide for Linux traffic control covering egress and ingress shaping, WAN emulation for testing, hierarchical bandwidth allocation, and modern AQM qdiscs.
View the full interactive guide: Linux Traffic Control (tc) Guide
Tools and topics covered:
- tc basics —
tc qdisc show,tc class show,tc filter show,tc -sstatistics, add/change/del/replace syntax - netem — Network emulator: delay, jitter, packet loss, corruption, duplication, and reordering
- tbf — Token Bucket Filter: smooth single-rate egress shaping
- htb — Hierarchical Token Bucket: class-based bandwidth allocation with guaranteed rates, ceilings, and borrowing
- fq_codel — Fair queuing + CoDel AQM; default qdisc on many modern distros
- cake — Modern all-in-one qdisc with bandwidth shaping, NAT-aware fairness, and DSCP prioritisation
- Ingress shaping (ifb) — How to shape incoming traffic using the ifb virtual device redirect trick
- tc filters —
u32,flower, andbpffilter types for classifying traffic by IP, port, DSCP, and MAC - Practical recipes — Bad WAN simulation, per-IP rate limiting, 3-tier HTB priority setup, and full reset
- Reference cheat sheet — Show commands, netem/tbf/cake one-liners, HTB skeleton, and interface reset