Cisco IOS XE Quality of Service Solutions Configuration Guide, Release 2
Class-Based Policing

Table Of Contents

Class-Based Policing

Finding Feature Information

Contents

Information About Class-Based Policing

Class-Based Policing Functionality

Benefits of Class-Based Policing

Restrictions for Class-Based Policing

How to Configure Class-Based Policing

Configuring Traffic Policing

Verifying Class-Based Traffic Policing

Troubleshooting Tips

Monitoring and Maintaining Traffic Policing

Configuration Examples for Class-Based Policing

Configuring a Service Policy That Includes Traffic Policing: Example

Additional References

Related Documents

Standards

MIBs

RFCs

Technical Assistance

Feature Information for Class-Based Policing

Glossary


Class-Based Policing


Class-based policing allows you to control the maximum rate of traffic that is transmitted or received on an interface. Class-based policing is often configured on interfaces at the edge of a network to limit traffic into or out of the network.

Finding Feature Information

For the latest feature information and caveats, see the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the"Feature Information for Class-Based Policing" section.

Use Cisco Feature Navigator to find information about platform support and Cisco IOS XE Software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.

Contents

Information About Class-Based Policing

Restrictions for Class-Based Policing

How to Configure Class-Based Policing

Configuration Examples for Class-Based Policing

Additional References

Feature Information for Class-Based Policing

Glossary

Information About Class-Based Policing

Before configuring class-based policing, you should understand the following concepts:

Class-Based Policing Functionality

Benefits of Class-Based Policing

Class-Based Policing Functionality

The Class-Based Policing feature performs the following functions:

Limits the input or output transmission rate of a class of traffic based on user-defined criteria.

Marks packets by setting the ATM Cell Loss Priority (CLP) bit, Frame Relay Discard Eligibility (DE) bit, IP precedence value, IP differentiated services code point (DSCP) value, MPLS experimental value, and quality of service (QoS) group.

Class-based policing allows you to control the maximum rate of traffic transmitted or received on an interface. The Class-Based Policing feature is applied when you attach a traffic policy that contains the class-based policing configuration to an interface. A traffic policy is configured using the Modular Quality of Service Command-Line Interface (MQC). For information on configuring the MQC, see the "Applying QoS Features Using the MQC" module.

Benefits of Class-Based Policing

Bandwidth Management Through Rate Limiting

Class-based policing allows you to control the maximum rate of traffic transmitted or received on an interface. Class-based policing is often configured on interfaces at the edge of a network to limit traffic into or out of the network. In most class-based policing configurations, traffic that falls within the rate parameters is transmitted, whereas traffic that exceeds the parameters is dropped or transmitted with a different priority.

Packet Marking

Packet marking allows you to partition your network into multiple priority levels or classes of service (CoS). A packet is marked and these markings can be used to identify and classify traffic for downstream devices.

Use class-based policing to set the IP precedence or DSCP values for packets entering the network. Networking devices within your network can then use the adjusted IP precedence values to determine how the traffic should be treated.

Use class-based policing to assign packets to a QoS group. The router uses the QoS group to determine how to prioritize packets.

Traffic can be marked without using the Class-Based Policing feature. If you want to mark traffic but do not want to use class-based policing, see the "Marking Network Traffic" module.

Restrictions for Class-Based Policing

Class-based policing can be configured on an interface or a subinterface, but it is not supported on EtherChannel or tunnel interfaces.

How to Configure Class-Based Policing

See the following sections for configuration tasks for the Class-Based Policing feature. Each task is identified as optional or required.

Configuring Traffic Policing (required)

Verifying Class-Based Traffic Policing (optional)

Monitoring and Maintaining Traffic Policing (optional)

Configuring Traffic Policing

To successfully configure the Class-Based Policing feature, a traffic class and a traffic policy must be created, and the traffic policy must be attached to a specified interface. These tasks are performed using the Modular QoS CLI. For information on the Modular QoS CLI, see the "Applying QoS Features Using the MQC" module.

The Class-Based Policing feature is configured in the traffic policy. To configure the Class-Based Policing feature, use the following command in policy-map class configuration mode:

Command
Purpose

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

Specifies a maximum bandwidth usage by a traffic class.


The Class-Based Policing feature works with a token bucket mechanism. There are currently two types of token bucket algorithms: a single token bucket algorithm and a two-token bucket algorithm. A single token bucket system is used when the violate-action option is not specified, and a two-token bucket system is used when the violate-action option is specified.

For more information about token bucket mechanisms, see the "Policing and Shaping Overview" module.

Verifying Class-Based Traffic Policing

Use the show policy-map interface command to verify that the Class-Based Policing feature is configured on your interface. If the feature is configured on your interface, the show policy-map interface command output displays policing statistics:

Router# show policy-map interface

  FastEthernet1/1/1
  service-policy output: x
    class-map: a (match-all)
      0 packets, 0 bytes
      5 minute rate 0 bps
      match: ip precedence 0
      police:
        1000000 bps, 10000 limit, 10000 extended limit
        conformed 0 packets, 0 bytes; action: transmit
        exceeded 0 packets, 0 bytes; action: drop
        conformed 0 bps, exceed 0 bps, violate 0 bps

Troubleshooting Tips

Check the interface type. Verify that class-based policing is supported on your interface. See the "Restrictions for Class-Based Policing" section.

Monitoring and Maintaining Traffic Policing

To monitor and maintain the Class-Based Policing feature, use the following commands in EXEC mode, as needed:

Command
Purpose

Router# show policy-map

Displays all configured policy maps.

Router# show policy-map policy-map-name

Displays the user-specified policy map.

Router# show policy-map interface

Displays statistics and configurations of all input and output policies that are attached to an interface.


Configuration Examples for Class-Based Policing

This section provides the following configuration example:

Configuring a Service Policy That Includes Traffic Policing: Example

Configuring a Service Policy That Includes Traffic Policing: Example

In the following example, class-based policing is configured with the average rate at 8000 bits per second, the normal burst size at 1000 bytes, and the excess burst size at 1000 bytes for all packets leaving the interface.

For additional information on configuring traffic classes and traffic policies, see the "Applying QoS Features Using the MQC" module.

For more information about token bucket mechanisms, see the "Policing and Shaping Overview" module.

class-map access-match
 match access-group 1
 exit
policy-map police-setting
 class access-match
  police 8000 1000 1000 conform-action transmit exceed-action set-qos-transmit 1 
  violate-action drop
  exit
 exit
 service-policy output police-setting

The treatment of a series of packets leaving FastEthernet interface 1/1/1 depends on the size of the packet and the number of bytes remaining in the conform and exceed token buckets. The series of packets are policed based on the following rules:

If the previous arrival of the packet was at T1 and the current arrival of the packet is at T, the bucket is updated with T - T1 worth of bits based on the token arrival rate. The refill tokens are placed in the conform bucket. If the tokens overflow the conform bucket, the overflow tokens are placed in the exceed bucket. The token arrival rate is calculated as follows:

(time between packets < which is equal to T - T1 > * policer rate)/8 bytes

If the number of bytes in the conform bucket is greater than the length of the packet (for example, B), then the packet conforms and B bytes should be removed from the bucket. If the packet conforms, B bytes are removed from the conform bucket and the conform action is taken. The exceed bucket is unaffected in this scenario.

If the number of bytes in the conform bucket is less than the length of the packet, but the number of bytes in the exceed bucket is greater than the length of the packet (for example, B), the packet exceeds and B bytes are removed from the bucket.

If the number bytes in the exceed bucket B is fewer than 0, the packet violates the rate and the violate action is taken. The action is complete for the packet.

In this example, the initial token buckets starts full at 1000 bytes. If a 450-byte packet arrives, the packet conforms because enough bytes are available in the conform token bucket. The conform action (send) is taken by the packet, and 450 bytes are removed from the conform token bucket (leaving 550 bytes).

If the next packet arrives 0.25 seconds later, 250 bytes are added to the conform token bucket ((0.25 * 8000)/8), leaving 800 bytes in the conform token bucket. If the next packet is 900 bytes, the packet does not conform because only 800 bytes are available in the conform token bucket.

The exceed token bucket, which starts full at 1000 bytes (as specified by the excess burst size, is then checked for available bytes. Because enough bytes are available in the exceed token bucket, the exceed action (set the QoS transmit value of 1) is taken, and 900 bytes are taken from the exceed bucket (leaving 100 bytes in the exceed token bucket).

If the next packet arrives 0.40 seconds later, 400 bytes are added to the token buckets ((.40 * 8000)/8). Therefore, the conform token bucket now has 1000 bytes (the maximum number of tokens available in the conform bucket, and 200 bytes overflow the conform token bucket (because only 200 bytes were needed to fill the conform token bucket to capacity). These overflow bytes are placed in the exceed token bucket, giving the exceed token bucket 300 bytes.

If the arriving packet is 1000 bytes, the packet conforms because enough bytes are available in the conform token bucket. The conform action (transmit) is taken by the packet, and 1000 bytes are removed from the conform token bucket (leaving 0 bytes).

If the next packet arrives 0.20 seconds later, 200 bytes are added to the token bucket ((.20 * 8000)/8). Therefore, the conform bucket now has 200 bytes. If the arriving packet is 400 bytes, the packet does not conform because only 200 bytes are available in the conform bucket. Similarly, the packet does not exceed because only 300 bytes are available in the exceed bucket. Therefore, the packet violates and the violate action (drop) is taken.

Additional References

The following sections provide references related to class-based policing.

Related Documents

Related Topic
Document Title

QoS commands: complete command syntax, command modes, command history, defaults, usage guidelines, and examples

Cisco IOS Quality of Service Solutions Command Reference

Traffic marking

"Marking Network Traffic" module

Traffic policing

"Traffic Policing" module

Traffic policing and shaping concepts and overview information

"Policing and Shaping Overview"

Modular Quality of Service Command-Line Interface (MQC)

"Applying QoS Features Using the MQC" module


Standards

Standard
Title

None


MIBs

MIB
MIBs Link

Class-Based Quality of Service MIB

CISCO-CLASS-BASED-QOS-MIB

CISCO-CLASS-BASED-QOS-CAPABILITY-MIB

To locate and download MIBs for selected platforms, Cisco IOS XE Software releases, and feature sets, use Cisco MIB Locator found at the following URL:

http://www.cisco.com/go/mibs


RFCs

RFC
Title

RFC 2697

A Single Rate Three Color Marker


Technical Assistance

Description
Link

The Cisco Support website provides extensive online resources, including documentation and tools for troubleshooting and resolving technical issues with Cisco products and technologies.

To receive security and technical information about your products, you can subscribe to various services, such as the Product Alert Tool (accessed from Field Notices), the Cisco Technical Services Newsletter, and Really Simple Syndication (RSS) Feeds.

Access to most tools on the Cisco Support website requires a Cisco.com user ID and password.

http://www.cisco.com/techsupport


Feature Information for Class-Based Policing

Table 1 lists the release history for this feature.

Use Cisco Feature Navigator to find information about platform support and software image support. Cisco Feature Navigator enables you to determine which Cisco IOS XE Software images support a specific software release, feature set, or platform. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.


Note Table 1 lists only the Cisco IOS XE Software release that introduced support for a given feature in a given Cisco IOS XE Software release train. Unless noted otherwise, subsequent releases of that Cisco IOS XE Software release train also support that feature.


Table 1 Feature Information for Class-Based Policing

Feature Name
Releases
Feature Information

Class-Based Policing

Cisco IOS XE Release 2.1

This feature was introduced on Cisco ASR 1000 Series Routers.

The following sections provide information about this feature:

Information About Class-Based Policing

How to Configure Class-Based Policing

The following command was introduced or modified: police.


Glossary

average rate—Maximum long-term average rate of conforming traffic.

conform action—Action to take on packets with a burst size below the rate allowed by the rate limit.

DSCP—differentiated services code point.

exceed action—Action to take on packets that exceed the rate limit.

excess burst size—Bytes allowed in a burst before all packets will exceed the rate limit.

normal burst size—Bytes allowed in a burst before some packets will exceed the rate limit. Larger bursts are more likely to exceed the rate limit.

policing policy—Rate limit, conform actions, and exceed actions that apply to traffic matching a certain criteria.

QoS group—Internal QoS group ID for a packet used to determine weighted fair queuing characteristics for that packet.