Traffic Shaping
Traffic shaping is typically used to prevent and manage congestion in ATM, Frame Relay, or Metro Ethernet networks, where asymmetric bandwidths are used along the traffic path. Traffic shaping is performed on outbound traffic of an interface.
Per-Interface Traffic Shaping
The command syntax for the traffic-shape rate command is
Router(config-if)# traffic-shape rate bit-rate [burst-size [excess-
burst-size]][buffer-limit]
bit-rate | Bit rate that traffic is shaped to, in bits per second. |
burst-size | Sustained number of bits that can be sent per interval. |
excess-burst-size | Maximum number of bits that can exceed the burst size in the first interval in a congestion event. |
buffer-limit | Maximum buffer limit in bps. Valid entries are numbers in the range of 0 to 4096. |
Note
Both burst-size and excess-burst-size are not measured in bits per second but rather the number of bits counted in a prescribed timing interval.
Router>enable | Enables privileged EXEC mode. |
Router# configure terminal | Enters global configuration mode. |
Router(config)# interface serial 0/0/0 | Enters interface configuration mode. |
Router(config-if)# traffic-shape rate 250000 4000 8000 | Enables traffic shaping for outbound traffic based on the bit rate specified. |
Router(config-if)# end | Returns to privileged EXEC mode. |
Class-Based Traffic Shaping
Note
Class-based traffic shaping applies to outbound traffic only.
The command syntax for the shape command is
Router(config-pmap-c)# shape {average | peak} cir [bc] [be]
The following explains the syntax:
average | Specifies average rate shaping. |
peak | Specifies peak rate shaping. |
cir | The committed information rate (CIR), in bits per second (bps). |
bc | The committed burst size, in bits. |
be | The excess burst size, in bits. |
Router(config)# class-map 2BWHUNGRY | Creates class map 2BWHUNGRY. |
Router(config-cmap)# match protocol pop3 | Chooses traffic by protocol. |
Router(config-cmap)# exit | Exits class map mode. |
Router(config)# policy-map NOTU2 | Creates a policy named NOTU2. |
Router(config-pmap)# class 2BWHUNGRY | Chooses a class to apply policy. |
Router(config-pmap-c)# shape average 128000 6000 3000 | Shapes traffic at an average of 128 kbps with a committed burst size of 6000 bits and an excess burst size of 3000 bits. |
Router(config-pmap-c)# exit | Returns to config-pmap mode. |
Router(config-pmap)# exit | Returns to global configuration mode. |
Router(config)# interface serial 0/0 | Enters interface mode where the policy will be applied. |
Router(config-if)# service-policy out NOTU2 | Applies policy NOTU2. |
Router(config-if)# end | Returns to privileged mode. |
Router# show policy-map | Displays all configured policy maps on the device. |
Router# show policy-map NOTU2 | Displays the policy map NOTU2. |
Router# show policy-map interface fastethernet 0/0 | Displays the configurations and statistics of policy maps applied at fastethernet 0/0. |