#

Monday, September 16, 2019

CBWFQ Example with MQC/HQF

CBWFQ (Class Based Weighted Fair Queuing) is the MQC/HQF feature to reserve a minimum amount of bandwidth in the output queue for a particular traffic flow in the case of congestion.

To learn the basics of MQC/HQF please go here.

I have created the following picture to visualize what's happening in an interface.












In an event of a congestion, the queues which are attached to CBWFQ will be served in a round robin fashion proportional to the interface bandwidth.

Let's see how to address a requirement, explanation will be at the end.

(1) The traffic sourced from users subnet 1.1.1.0/32 should be guaranteed 50 Mbps.
(2) HTTP traffic should get a guaranteed bandwidth of 20 Mbps.
(3) Limit the sizes of the FIFO queues for the users and HTTP traffic classes to 16 and 24 packets, respectively.
(4) All other unmatched traffic in the policy should run WFQ and dynamic flows in this WFQ should drop when they reach packet length of 32.

1st let's create the ACL to capture the user traffic..

R1(config)#ip access-list standard USERS
R1(config-std-nacl)#permit 1.1.1.0 0.0.0.255

Now let's write the class-maps..

R1(config)#class-map USERS
R1(config-cmap)#match access-group name USERS 

R1(config)#class-map HTTP
R1(config-cmap)#match protocol http

Now it's the time to write the policy-map..

R1(config)#policy-map CBWFQ
R1(config-pmap)#class USERS
R1(config-pmap-c)#bandwidth 50000
R1(config-pmap-c)#queue-limit 16 packets
R1(config-pmap-c)#exit
R1(config-pmap)#class HTTP
R1(config-pmap-c)#bandwidth 20000
R1(config-pmap-c)#queue-limit 24 packets
R1(config-pmap-c)#exit
R1(config-pmap)#class class-default
R1(config-pmap-c)#fair-queue

Finally applying to interface;

R1(config)#int g0/1
R1(config-if)#service-policy output CBWFQ

Following is the active policy-map as per my configuration..




























Explanation:-
As soon as the bandwidth command is entered in any class in a policy-map, entire software queue for that interface turns into CBWFQ. The bandwidth specified by the bandwidth command or bandwidth percentage command becomes the weight as a proportion to the configured interface bandwidth or more specifically the bandwidth the policy can take as a whole if shaping is configured in the hierarchy.

Both the bandwidth and bandwidth percent commands cannot be used in same class map.

Because the entire software queue becomes CBWFQ, any unmatched flows that fall back into class-default are scheduled using dynamic WFQ weights which is equal to configuring fair-queue command. This means that automatic classification occurs, along with precedence based wight assignment and sharing of the single buffer space of WFQ.

This behavior is default, even if you did not configure fair-queue under the class-default.

If you want to disable fair-queue for unclassified packets, what you just want to do is specify a bandwidth value just like did in other classes which turns the class-default also to a single FIFO.

The command queue limit <n> packets will define the size / maximum capacity of the queue in packets.

No comments:

Post a Comment