Traffic Policing and Shaping Configuration

Last Update: Nov 19, 2024 | Published: Jul 25, 2011

SHARE ARTICLE

This article focuses on the the configuration of the two different traffic shaping and traffic policing mechanisms. A general understanding how the token bucket is implemented by these two features is necessary before getting into the details of traffic policing and shaping setup. For an introduction to these concepts, check out the Traffic Policing and Shaping Overview article. For traffic policing, the Traffic policing feature is covered and is implemented using the Modular Quality of Service (QoS) Command line interface (MQC), and is based on traffic class. For traffic shaping, the Class-based traffic shaping feature is covered and is also implemented using the MQC.

Traffic Policing and Shaping Configuration

Both the Traffic policing and Class-based traffic shaping features are implemented using the MQC. The MQC is used to classify traffic by defining a traffic class, set traffic policy by defining a traffic policy (where policing and shaping is implemented) and is assigned to a specific interface.

Setting Up Traffic Classification

The first step involves traffic classification setup; traffic that is matched to a specific class can have a number of different actions taken against it. For the purposes of this article, the action to be taken will be to police or shape the matched traffic. There are a number of different ways to match the specific traffic, however since this is outside the scope of this article, a link to the available commands can be found here:
http://www.cisco.com/en/US/docs/ios/qos/configuration/guide/classification_oview_

ps10592_TSD_Products_Configuration_Guide_Chapter.html

Setting Up a Traffic Policy

The second step involves traffic policy setup; the traffic policy is where specific actions can be configured. As stated before, in the context of this article, this is where the traffic policing and shaping are configured.

Setting Up Assignment of the Configured Traffic Policy onto a Specific Interface

The third step involves assigning the configured traffic policy onto a specific interface.  In the context of this article, the interface that is assigned will implement the traffic policing or shaping feature configuration.

Traffic Policing Configuration

The Traffic policing feature uses the police command to implement a specific policing policy. The command is used within the configuration of a traffic policy as stated earlier. The following commands are used to create a traffic policy and implement the Traffic policing feature:

router#configure terminal

router(config)#policy-map policy-map-name

router(config-pmap)#class {class-name | class-default}

router(config-pmap-c)#police bps [burst-normal] [burst-max] conform-action action exceed-action action [violate-action action]

The bps parameter configures the allowed traffic rate and is specified in bits per second; if the traffic is within this allowed traffic rate, then the conform action is taken, if not the exceed action is taken. The Traffic policing feature enables the use of a single or dual token bucket implementation. When implementing a dual token bucket implementation, the violate action is specified. The violate action is taken when traffic violates not only the traffic rate and the normal burst, but also violates the configured maximum burst. There are a number of different actions that can be configured, the most common ones include transmit and drop.

Traffic Shaping Configuration

The Class-based traffic shaping feature uses the shape command to implement a specific shaping policy. While it is possible to use other queuing mechanisms, by default the weighted fair queuing (WFQ) mechanism is used. As stated before, the main difference between traffic policing and shaping is that when shaping, non-conforming traffic is placed into a queue and is allowed to be transmitted based on the status of that queue.

As with traffic policing above, class-based traffic shaping is implemented using MQC and is implemented using a traffic policy in the same way. The following commands are used to create a traffic policy and implement class-based traffic shaping:

router#configure terminal

router(config)#policy-map policy-map-name

router(config-pmap)#class {class-name | class-default}

router(config-pmap-c)#shape {average | peak} mean-rate [burst-size] [excess-burst-size]

There are two different mechanisms that can be used by the class-based traffic feature that affect how traffic is transmitted: average rate shaping and peak rate shaping; these will be explained shortly. The mean-rate parameter configures the allowed traffic rate and is specified in bits per second. The burst-size parameter is used to configure the optional committed burst size and is specified in bits. The excess-burst-size parameter is used to configure the optional excess burst size and is specified in bits.

To explain the different shaping mechanisms, using average rate shaping, traffic is transmitted based on the configured mean-rate and is limited to this rate on average. Peak rate shaping allows traffic to be passed at a higher rate based on the following calculation:

peak rate = mean rate(1 + Be (excess-burst) / Bc (burst)

While peak rate allows higher burst and rate capability, it also has a higher likelihood of being dropped by other elements in the network which  are not expecting this traffic rate.

This article covered the implementation of traffic policing and shaping configuration. Both use the token bucket mechanism, which is covered in the Traffic Policing and Shaping Overview article. Hopefully this article has provided enough information for a basic understanding of how these features can be configured and how they operate.

SHARE ARTICLE