Traffic Shaping on Cisco IOS

Hello David

CBWFQ and shaping are often used together for effective bandwidth management. CBWFQ ensures fair bandwidth distribution among different traffic classes while shaping controls the traffic rate to prevent congestion. Shaping can be applied to traffic classes defined by CBWFQ. This means you can classify traffic using CBWFQ and then apply shaping to each class as needed.

Here is an example of a CBWFQ with applied shaping policies. In this example, we’ll assume you have three types of traffic: high-priority (like VoIP), medium-priority (like business-critical applications), and default traffic (everything else). We’ll shape the total outbound traffic and allocate guaranteed bandwidth to each class.

  1. Define Class Maps:

    • For High-Priority Traffic (e.g., VoIP):
      class-map match-any HIGH_PRIORITY
        match protocol ip rtp 16384 32767
      
    • For Medium-Priority Traffic (e.g., business applications):
      class-map match-any MEDIUM_PRIORITY
        match access-group 100
      
    • Access control list for medium-priority:
      ip access-list extended 100
        permit ip any any
      
  2. Create a Policy Map:

    • This policy map applies CBWFQ:
      policy-map CBWFQ_WITH_SHAPING
        class HIGH_PRIORITY
          priority percent 30
        class MEDIUM_PRIORITY
          bandwidth percent 50
        class class-default
          fair-queue
      
  3. Apply Traffic Shaping:

    • Assume we want to shape traffic to 10 Mbps. Note we are shaping the traffic that matches the class-default class:
      policy-map SHAPING_POLICY
        class class-default
          shape average 10000000
          service-policy CBWFQ_WITH_SHAPING
      
  4. Apply the Policy Map to an Interface:

    • For example, applying it to GigabitEthernet0/0:
      interface GigabitEthernet0/0
        service-policy output SHAPING_POLICY
      
  • Class Maps: Define the types of traffic. HIGH_PRIORITY for VoIP (using RTP ports) and MEDIUM_PRIORITY based on an ACL.
  • Policy Map for CBWFQ: CBWFQ_WITH_SHAPING allocates 30% of bandwidth to high-priority traffic, 50% to medium-priority, and the rest is handled by the default class using fair queuing.
  • Traffic Shaping: SHAPING_POLICY shapes the traffic that does not match the high or medium priority classes to a rate of 10 Mbps. It references CBWFQ_WITH_SHAPING to apply CBWFQ within this shaped traffic.
  • Interface Application: The final policy SHAPING_POLICY is applied to the outbound direction of the interface GigabitEthernet0/0.

This configuration is a basic example and might need adjustments based on the specific network setup, traffic patterns, and requirements. You can also apply shaping only to the high- and/or medium-priority traffic, or to all the traffic. This is just a basic example that I hope will help you understand how CBWFQ and shaping can be applied together.

I hope this has been helpful!

Laz