QoS - CBWFQ
Class-Based Weighted Fair Queueing (CBWFQ) is an advanced queueing mechanism used in network Quality of Service (QoS). It's commonly employed in Cisco routers and switches to manage and prioritize network traffic. The primary goal of CBWFQ is to ensure that during times of congestion, different types of network traffic receive an appropriate share of bandwidth based on their importance and requirements.
Configuring CBWFQ on a Cisco device involves several steps, including defining traffic classes, marking traffic, allocating bandwidth, and potentially setting priorities for different classes. The key aspect of CBWFQ is that it doesn't just serve queues based on a strict priority but rather on a weighted basis, allowing for a more equitable distribution of bandwidth among different traffic classes. Here's a step-by-step guide on how to configure CBWFQ:
Define Traffic Classes
First, you define traffic classes using class maps. A class map identifies a specific set of traffic using match criteria like access control lists (Access-List (ACL)s), protocols, or input interfaces.
class-map match-any CLASS-A match ip dscp af31
Create a Policy Map
Next, you create a policy map where you assign specific actions to each traffic class. This is where you specify how each class should be treated.
policy-map CBWFQ-POLICY class CLASS-A bandwidth percent 30 class CLASS-B bandwidth percent 20
Allocate Bandwidth
In the policy map, for each class, you allocate bandwidth. This can be a percentage of the interface's bandwidth (bandwidth percent
) or a fixed amount of bandwidth (bandwidth
). The bandwidth
command specifies the minimum bandwidth guaranteed to the class during congestion.
Set Priorities (Optional)
If some traffic needs strict priority (like voice), you use the priority
command instead of bandwidth
for that class. This creates a Low Latency Queue (LLQ), which is served before other queues.
class VOICE priority 500
Apply the Policy Map
Finally, you apply the policy map to an interface. This activates the CBWFQ on that interface.
interface GigabitEthernet0/1 service-policy output CBWFQ-POLICY
How the Scheduler Works: The scheduler in CBWFQ uses a time-based round-robin scheduler that calculates weights based on both bandwidth allocations and packet sizes. The scheduler ensures that each class receives at least its minimum guaranteed bandwidth. If a class doesn’t use its full allocation, the unused bandwidth is proportionally redistributed among other classes.
Determining Importance: CBWFQ inherently does not assign "importance" in terms of priority, except for the LLQ. Instead, it uses the bandwidth specifications to ensure a fair distribution based on the configured weights. If certain traffic is more critical, you should allocate a higher percentage of bandwidth to its class.
In CBWFQ on Cisco devices, traffic importance is determined by the bandwidth allocation specified in the policy map. Classes with higher bandwidth allocations are given more bandwidth during congestion, but not necessarily strict priority, except for traffic in the priority queue (LLQ). This setup ensures a fairer distribution of bandwidth among different types of traffic.
Links
https://networklessons.com/quality-of-service/apply-cbwfq-to-sub-interface