Traffic shaping in Cisco IOS/Shaping and queuing

From CT3

Jump to: navigation, search

By Ivan Pepelnjak

The test (part of traffic shaping lab tests) checks the internal shaping queue structure when the shape command is used with a child service-policy. The traffic generator was configured to send enough traffic to exceed the traffic contract (specified with the shape rate class configuration command) and the show traffic-shape command was used to inspect the shaping queue on the Test router.

Image:TrafficShapingTestbed.png

Contents

Test result summary

The child policy uses a single class configured with the bandwidth command. The shaping queue therefore uses class-based WFQ with reserved conversations (classes). As the same class is used in the parent and child service policy, only a single queue is created.

Test setup

The following traffic shaping configuration was used on the test router:

Traffic shaping configuration on the test router

policy-map SHAPE
 class UDP
  shape average 128000
  bandwidth 96
  service-policy SHAPE-UDP
 class class-default
  bandwidth 32
!
policy-map SHAPE-UDP
 class UDP
  bandwidth 64
 class class-default
  bandwidth 64 

The traffic generator was sending two UDP streams: a 160 kbps UDP stream to IP address 172.16.0.12 …

UDP stream in class UDP

$ flood.pl --size=400 -bandwidth=160 172.16.0.12
Flooding 172.16.0.12 random port with 400-byte packets
Interpacket delay 20 msec
total IP bandwidth 160 kbps
Break with Ctrl-C 

… and a 64 kbps UDP stream to IP address 172.16.0.13

UDP stream in the default class

$ flood.pl --size=200 --bandwidth=64 172.16.0.13
Flooding 172.16.0.13 random port with 200-byte packets
Interpacket delay 15 msec
total IP bandwidth 64 kbps
Break with Ctrl-C 

Test results

The show policy-map interface command verifies that the Test router performs traffic shaping in the UDP class. The printout includes the configuration of the child service-policy in which you can see the WFQ conversation identifiers (highlighted).

Test#show policy-map interface ser 0/1/0
 Serial0/1/0

  Service-policy output: SHAPE

    Class-map: UDP (match-all)
      1582 packets, 639128 bytes
      30 second offered rate 161000 bps, drop rate 54000 bps
      Match: access-group name UDP
      Traffic Shaping
           Target/Average   Byte   Sustain   Excess    Interval  Increment
             Rate           Limit  bits/int  bits/int  (ms)      (bytes)
           128000/128000    1984   7936      7936      62        992

        Adapt  Queue     Packets   Bytes     Packets   Bytes     Shaping
        Active Depth                         Delayed   Delayed   Active
        -      64        1258      508232    1258      508232    yes
      Queueing
        Output Queue: Conversation 41
        Bandwidth 96 (kbps)Max Threshold 64 (packets)
        (pkts matched/bytes matched) 1258/508232
        (depth/total drops/no-buffer drops) 63/331/0

      Service-policy : SHAPE-UDP

        Class-map: UDP (match-all)
          1582 packets, 639128 bytes
          30 second offered rate 161000 bps, drop rate 66000 bps
          Match: access-group name UDP
          Queueing
            Output Queue: Conversation 25
            Bandwidth 64 (kbps)Max Threshold 64 (packets)
            (pkts matched/bytes matched) 1582/639128
        (depth/total drops/no-buffer drops) 64/324/0

        Class-map: class-default (match-any)
          0 packets, 0 bytes
          30 second offered rate 0 bps, drop rate 0 bps
          Match: any
          Queueing
            Output Queue: Conversation 26
            Bandwidth 64 (kbps)Max Threshold 64 (packets)
            (pkts matched/bytes matched) 0/0
        (depth/total drops/no-buffer drops) 0/0/0

    Class-map: class-default (match-any)
      2636 packets, 273880 bytes
      30 second offered rate 69000 bps, drop rate 37000 bps
      Match: any
      Queueing
        Output Queue: Conversation 42
        Bandwidth 32 (kbps)Max Threshold 64 (packets)
        (pkts matched/bytes matched) 2633/273832
        (depth/total drops/no-buffer drops) 63/1422/0

The show traffic-shape queue command displays the shaping queue contents. As expected, the shaping queue uses WFQ mechanism. All the packets are placed in queue#25 (matching the conversation ID of the UDP class).

Test#show traffic-shape queue ser 0/1/0
Traffic queued in shaping queue on Serial0/1/0
 Traffic shape class: UDP
  Queueing strategy: weighted fair
  Queueing Stats: 63/1000/64/4483 (size/max total/threshold/drops)
     Conversations  1/1/16 (active/max active/max total)
     Reserved Conversations 1/1 (allocated/max allocated)
     Available Bandwidth 0 kilobits/sec

  (depth/weight/total drops/no-buffer drops/interleaves) 63/128/823/0/0
  Conversation 25, linktype: ip, length: 404
  source: 10.0.0.10, destination: 172.16.0.12, id: 0xC74F, ttl: 127,
  TOS: 0 prot: 17, source port 1046, destination port 46041

Additional Resources