In this blog, we’ll cover class-based weighted fair queuing (CBWFQ) for effective traffic shaping and bandwidth management in a busy or congested network.

To understand CBWFQ, you first need to understand standard weighted fair queuing (WFQ).

What is WFQ?

A flow is defined as a stream of packets with a unique source IP, destination IP, input interface, port, protocol, etc.

WFQ is a flow-based queuing algorithm commonly used in quality of service for effective delivery of business-critical applications. WFQ sends the less weighted (volume) traffic first and lets the high-volume traffic share the remaining bandwidth.

WFQ ensures effective traffic management and reduces congestion due to the transmission of packets in the network.

 There are three types of WFQ:

  1. Flow-based WFQ

  2. VIP distributed WFQ

  3. CBWFQ

WFQ is reliable, fast, and easy to implement.

What is CBWFQ?

CBWFQ is an advanced form of WFQ that supports user-defined traffic classes, i.e., protocols, access control lists (ACLs), or input interfaces. A flow satisfying the match criteria for a class contributes the traffic for that particular defined class. A queue is allocated for each class, and the traffic belonging to a class is directed to the queue for that class.

Prerequisites for configuring CBWFQ

Before implementing CBWFQ in the network, an admin must do the following:

  1. Create traffic classes

  2. Define characteristics for each class

  3. Attach policies to interfaces

Creating a traffic class:

By studying the traffic on their network, admins can determine which traffic deserves the highest priority. They can then create a class based on match criteria like protocols, ACLs, or input interfaces. Next, they create a class map to define the name of the class and which traffic will be associated with the class.

Defining characteristics for each class:

Once the traffic class is created, admins create policy maps by associating the following characteristics with that class:

  1. Bandwidth
  2. Weight
  3. Maximum packet limit 

Traffic allocated for each class is guaranteed bandwidth. The queue limit is also specified while creating the traffic class, which is the maximum number of packets that can be in the queue. If the queue limit is reached, the enqueuing of additional packets will cause tail drop or packet drop, depending on how the traffic class is configured.

Tail drop is often carried out; however, if the user specifies a weight for the packets, Weighted Random Early Detection will occur to drop packets.

Attaching policies to interfaces:

Once the class map and related policy map are defined for the created class, the next step is to associate it with the interfaces where CBWFQ is being deployed.

Example configuration

Class creation:

 Router(config)# access-list 101 permit tcp host host range

16384 20000

Router(config)# access-list 102 permit tcp host host range

53000 56000

Router(config)# class-map Host1

Router(config-cmap)# match access-group 101

Router(config-cmap)# exit

Router(config-cmap)# class-map Host2

Router(config-cmap)# match access-group 102

Router(config-cmap)# exit

Policy map creation:

Router(config)# policy-map CBWFQ

Router(config-pmap)# class Host1

Router(config-pmap-c)# bandwidth 3000

Router(config-pmap-c)# queue-limit 30

Router(config-pmap-c)# exit

Router(config-pmap)# class Host2

Router(config-pmap-c)# bandwidth 2000

Router(config-pmap-c)# exit

Policy attachment to interfaces:

Router(config)# interface fa1/0/0

Router(config-if)# service output CBWFQ

Router(config-if)# exit

Advantages of implementing CBWFQ in your network

  • Efficient delivery of business-critical applications

  • Effective management of available bandwidth

  • Critical traffic can be given higher priority

  • Bandwidth optimization and traffic shaping


Download | Interactive demo | Customers

Praveen Kumar
Member Leadership Staff