tc-cbq
Shape network traffic using Class Based Queuing
SYNOPSIS
tc qdisc add dev DEVICE root cbq [scfg SCFG] [dev DEVICE] [mpu BYTES] [limit PACKETS] [ptab BITS] [level LEVEL] [splittail SCFG]
PARAMETERS
dev DEVICE
Specifies the network interface to attach the CBQ qdisc to. Defaults to the interface tc is operating on.
scfg SCFG
Specifies the shaping configuration. If not specified, tc tries to derive reasonable default shaping parameters based on the link layer type.
mpu BYTES
Minimum Packet Unit. All packets are accounted as being at least this many bytes long. Defaults to zero.
limit PACKETS
The number of packets to queue. Defaults to 540 packets.
ptab BITS
Defines the precision to which packet sizes can be accounted for. BITS can be from 0-31. Lower values cause less precision but consume less memory. Defaults to 8.
level LEVEL
Defines the number of levels in the CBQ hierarchy. Must be large enough to hold the deepest class depth. Defaults to 0.
splittail SCFG
An optional Shaping Configuration. If present all the classes are managed by the single underlying queuing algorithm, allowing each class to be shaped at a different rate and prioritize the class based on their priority. Allows for a hierarchy to be maintained by the traffic controller.
DESCRIPTION
The tc CBQ (Class Based Queueing) scheduler is a traffic shaping mechanism in Linux that allows you to prioritize and manage network traffic based on defined classes. It's a hierarchical queuing discipline, meaning you can create a tree-like structure of classes, each with its own queue. Traffic is classified based on filters, and each class can be configured with parameters like bandwidth, priority, and maximum queue length. CBQ is more complex to configure than simpler schedulers like pfifo_fast, but offers greater flexibility for controlling network bandwidth allocation.
tc allows you to configure the Linux traffic control facility. The cbq qdisc is a shaping qdisc built on classful hiearchy, allowing you to prioritize network traffic.
CAVEATS
CBQ is considered complex and requires a good understanding of networking and traffic shaping concepts. Modern alternatives like HTB (Hierarchical Token Bucket) are often preferred for their ease of configuration and better performance in many scenarios. CBQ is no longer actively maintained and might be less efficient on modern high-speed networks.
SHAPING CONFIGURATION (SCFG)
The SCFG parameter itself takes several sub-parameters defining how the qdisc should shape. These include:
rate RATE: The maximum sending rate.
weight WEIGHT: The amount of traffic this qdisc may send.
maxburst BYTES: The size of the token bucket (in bytes) to allow some burstiness.
minburst BYTES: The number of bytes that *must* be available before we send. This is used to combat 'starvation' of interactive traffic.
latency TIME: The ideal latency within this class. Used to calculate minburst. Defaults to 10ms.
USING TC FILTERS
tc filters are used to direct incoming traffic into the correct class within the CBQ hierarchy. Filters can match traffic based on various criteria, such as source/destination IP address, port numbers, protocol, and even application data.
HISTORY
CBQ was one of the earlier traffic shaping mechanisms in Linux, developed to provide a more sophisticated way to manage network bandwidth than simple FIFO queues. It was widely used in the past, particularly in scenarios where fine-grained control over bandwidth allocation was required. However, its complexity led to the development of simpler and more efficient alternatives like HTB. CBQ is still available in Linux, but it's less commonly used in modern systems.
SEE ALSO
tc(8), tc-htb(8), tc-pfifo_fast(8)