Classifying network traffic allows you to organize traffic (that is, packets) into traffic classes or categories on the basis of whether the traffic matches specific criteria. Classifying network traffic is the foundation for enabling many quality of service (QoS) features on your network. This module contains conceptual information and the configuration tasks for classifying network traffic.
Your software release may not support all the features documented in this module. For the latest caveats and feature information, see
Bug Search Tool and 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 table at the end of this module.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Classifying network traffic allows you to organize traffic (that is, packets) into traffic classes or categories on the basis of whether the traffic matches specific criteria. Classifying network traffic is the foundation for enabling other QoS features such as traffic shaping and traffic policing on your network.
The goal of network traffic classification is to group traffic based on user-defined criteria so that the resulting groups of network traffic can then be subjected to specific QoS treatments. The QoS treatments might include faster forwarding by intermediate routers and switches or reduced probability of the traffic being dropped due to lack of buffering resources.
Identifying and categorizing network traffic into traffic classes (that is, classifying packets) enables distinct handling for different types of traffic, effectively separating network traffic into different categories. This classification can be associated with a variety of match criteria such as the IP Precedence value, differentiated services code point (DSCP) value, class of service (CoS) value, source and destination MAC addresses, input interface, or protocol type. You classify network traffic by using class maps and policy maps with the Modular Quality of Service Command-Line Interface (MQC). For example, you can configure class maps and policy maps to classify network traffic on the basis of the QoS group, Frame Relay DLCI number, Layer 3 packet length, or other criteria that you specify.
Benefits of Classifying Network Traffic
Classifying network traffic allows you to see what kinds of traffic you have, organize the various kinds of network traffic into traffic classes, and treat some types of traffic differently than others. Identifying and organizing network traffic is the foundation for applying the appropriate QoS feature to that traffic, enabling you to allocate network resources to deliver optimal performance for different types of traffic. For example, high-priority network traffic or traffic matching specific criteria can be singled out for special handling, and thus, help to achieve peak application performance.
MQC and Network Traffic Classification
To configure network traffic classification, you use the Modular Quality of Service Command-Line Interface (MQC).
The MQC is a CLI structure that allows you to complete the following tasks:
Specify the matching criteria used to define a traffic class.
Create a traffic policy (policy map). The traffic policy defines the QoS policy actions to be taken for each traffic class.
Apply the policy actions specified in the policy map to an interface, subinterface, or ATM permanent virtual circuit (PVC) by using the service-policy command.
Network Traffic Classification match Commands and Match Criteria
Network traffic classification allows you to group or categorize traffic on the basis of whether the traffic meets one or more specific criteria. For example, network traffic with a specific IP precedence can be placed into one traffic class, while traffic with a specific DSCP value can be placed into another traffic class. The network traffic within that traffic class can be given the appropriate QoS treatment, which you can configure in a policy map later.
You specify the criteria used to classify traffic with a
match command. The table below lists the available
match commands and the corresponding match criterion.
Table 1 match Commands and Corresponding Match Criterion
Fields defined in the protocol header description files (PHDFs)
matchfr-de
Frame Relay discard eligibility (DE) bit setting
matchfr-dlci
Frame Relay data-link connection identifier (DLCI) number
matchinput-interface
Input interface name
matchiprtp
Real-Time Transport Protocol (RTP) port
matchmplsexperimental
Multiprotocol Label Switching (MPLS) experimental (EXP) value
matchmplsexperimentaltopmost
MPLS EXP value in the topmost label
matchnot
Single match criterion value to use as an unsuccessful match criterion
matchpacketlength(class-map)
Layer 3 packet length in the IP header
matchport-type
Port type
matchprecedence
IP precedence values
matchprotocol
Protocol type
matchprotocol(NBAR)
Protocol type known to network-based application recognition (NBAR)
matchprotocolcitrix
Citrix protocol
matchprotocolfasttrack
FastTrack peer-to-peer traffic
matchprotocolgnutella
Gnutella peer-to-peer traffic
matchprotocolhttp
Hypertext Transfer Protocol
matchprotocolrtp
RTP traffic
matchqos-group
QoS group value
matchsource-addressmac
Source Media Access Control (MAC) address
matchstart
Datagram header (Layer 2) or the network header (Layer 3)
matchtag(class-map)
Tag type of class map
matchvlan(QoS)
Layer 2 virtual local-area network (VLAN) identification number
1 Cisco match commands can vary by release and platform. For more information, see the command documentation for the Cisco release and platform that you are using.
Traffic Classification Compared with Traffic Marking
Traffic classification and traffic marking are closely related and can be used together. Traffic marking can be viewed as an additional action, specified in a policy map, to be taken on a traffic class.
Traffic classification allows you to organize into traffic classes on the basis of whether the traffic matches specific criteria. For example, all traffic with a CoS value of 2 is grouped into one class, and traffic with a DSCP value of 3 is grouped into another class. The match criteria are user-defined.
After the traffic is organized into traffic classes, traffic marking allows you to mark (that is, set or change) an attribute for the traffic belonging to that specific class. For instance, you may want to change the CoS value from 2 to 1, or you may want to change the DSCP value from 3 to 2.
The match criteria used by traffic classification are specified by configuring a
match command in a class map. The marking action taken by traffic marking is specified by configuring a
set command in a policy map. These class maps and policy maps are configured using the MQC.
The table below compares the features of traffic classification and traffic marking.
Table 2 Traffic Classification Compared with Traffic Marking
Feature
Traffic Classification
Traffic Marking
Goal
Groups network traffic into specific traffic classes on the basis of whether the traffic matches the user-defined criterion.
After the network traffic is grouped into traffic classes, modifies the attributes for the traffic in a particular traffic class.
Configuration Mechanism
Uses class maps and policy maps in the MQC.
Uses class maps and policy maps in the MQC.
CLI
In a class map, uses
match commands (for example,
matchcos) to define the traffic matching criteria.
Uses the traffic classes and matching criteria specified by traffic classification.
In addition, uses
set commands (for example,
setcos) in a policy map to modify the attributes for the network traffic.
Creating a Class Map for Classifying Network Traffic
Note
In the following task, the
matchfr-dlcicommand is shown in Step 4. The
matchfr-dlcicommand matches traffic on the basis of the Frame Relay DLCI number. The
matchfr-dlcicommand is just an example of one of the
match commands that can be used. For a list of other
match commands, see the Network Traffic Classification match Commands and Match Criteria section.
SUMMARY STEPS
1.enable
2.configureterminal
3.class-mapclass-map-name [match-all|
match-any]
4.matchfr-dlcidlci-number
5.end
DETAILED STEPS
Command or Action
Purpose
Step 1
enable
Example:
Router> enable
Enables privileged EXEC mode.
Enter your password if prompted.
Step 2
configureterminal
Example:
Router# configure terminal
Enters global configuration mode.
Step 3
class-mapclass-map-name [match-all|
match-any]
Example:
Router(config)# class-map class1
Creates a class map to be used for matching traffic to a specified class, and enters class-map configuration mode.
Enter the class map name.
Step 4
matchfr-dlcidlci-number
Example:
Router(config-cmap)# match fr-dlci 500
(Optional) Specifies the match criteria in a class map.
Note
The
matchfr-dlci command classifies traffic on the basis of the Frame Relay DLCI number. The
matchfr-dlcicommand is just an example of one of the
match commands that can be used. For a list of other
match commands, see the Network Traffic Classification match Commands and Match Criteria section.
Step 5
end
Example:
Router(config-cmap)# end
(Optional) Returns to privileged EXEC mode.
Creating a Policy Map for Applying a QoS Feature to Network Traffic
Note
In the following task, the
bandwidth command is shown at
Step 5
. The
bandwidth command configures the QoS feature
class-based weighted fair queuing (CBWFQ). CBWFQ is just an example of a QoS
feature that can be configured. Use the appropriate command for the QoS feature
you want to use.
Note
Configuring bandwidth on policies that have the class-default
class is supported on physical interfaces such as Gigabit Ethernet (GigE),
Serial, Mobile Location Protocol (MLP), and Multilink Frame-Relay (MFR), but it
is not supported on logical interfaces such as Virtual Access Interface (VAI),
Subinterface, and Frame-Relay on Virtual Circuits (FR-VC).
(Optional) Specifies or modifies the bandwidth allocated for a
class belonging to a policy map.
Enter the amount of
bandwidth as a number of kbps, a relative percentage of bandwidth, or an
absolute amount of bandwidth.
Note
The
bandwidth command configures the QoS
feature class-based weighted fair queuing (CBWFQ). CBWFQ is just an example of
a QoS feature that can be configured. Use the appropriate command for the QoS
feature that you want to use.
Step 6
end
Example:
Router(config-pmap-c)# end
Returns to privileged EXEC mode.
Step 7
showpolicy-map
(Optional) Displays all configured policy maps.
Step 8
or
Step 9
showpolicy-mappolicy-mapclassclass-name
Example:
(Optional) Displays the configuration for the specified class of
the specified policy map.
Enter the policy map
name and the class name.
Step 10
Router# show policy-map
Step 11
Step 12
Router# show policy-map policy1 class class1
Step 13
exit
Example:
Router# exit
(Optional) Exits privileged EXEC mode.
What to Do Next
Create and configure as many policy maps as you need for your network. To create and configure additional policy maps, repeat the steps in the “Creating a Policy Map for Applying a QoS Feature to Network Traffic” section. Then attach the policy maps to the appropriate interface, following the instructions in the “Attaching the Policy Map to an Interface” section.
Attaching the Policy Map to an Interface
Note
Depending on the needs of your network, policy maps can be
attached to an interface, a subinterface, or an ATM PVC.
Configures an interface type and enters interface configuration
mode.
Enter the interface
type and number.
Step 4
pvc [name]
vpi/vci
[ilmi|qsaal|smds|
l2transport]
Example:
Router(config-if)# pvc cisco 0/16
(Optional) Creates or assigns a name to an ATM PVC, specifies the
encapsulation type on an ATM PVC, and enters ATM virtual circuit configuration
mode.
Enter the PVC name,
the ATM network virtual path identifier, and the network virtual channel
identifier.
Note
This step is required only if you are attaching the policy map
to an ATM PVC. If you are not attaching the policy map to an ATM PVC, advance
to
Step 6
.
Step 5
exit
Example:
Router(config-atm-vc)# exit
(Optional) Returns to interface configuration mode.
Note
This step is required only if you are attaching the policy map
to an ATM PVC and you completed
Step 4
. If you are not attaching the policy map to an ATM PVC,
advance to
Step 6
.
Step 6
service-policy
{input |
output}policy-map-name
Example:
Router(config-if)# service-policy input policy1
Attaches a policy map to an input or output interface.
Enter the policy map
name.
Note
Policy maps can be configured on ingress or egress routers.
They can also be attached in the input or output direction of an interface. The
direction (input or output) and the router (ingress or egress) to which the
policy map should be attached varies according your network configuration. When
using the
service-policy command to attach the
policy map to an interface, be sure to choose the router and the interface
direction that are appropriate for your network configuration.
Step 7
end
Example:
Router(config-if)# end
Returns to privileged EXEC mode.
Step 8
showpolicy-mapinterfacetypenumber
Example:
Router#
show policy-map interface serial4/0/0
(Optional) Displays the traffic statistics of all traffic classes
that are configured for all service policies either on the specified interface
or subinterface or on a specific PVC on the interface.
Enter the type and
number.
Step 9
exit
Example:
Router# exit
(Optional) Exits privileged EXEC mode.
Configuration Examples for Classifying Network Traffic
Example Creating a Class Map for Classifying Network Traffic
The following is an example of creating a class map to be used for traffic classification. In this example, a traffic class called class1 has been created. Traffic with a Frame Relay DLCI value of 500 will be put in this traffic class.
Example Creating a Policy Map for Applying a QoS Feature to Network Traffic
The following is an example of creating a policy map to be used for traffic classification. In this example, a policy map called policy1 has been created, and the bandwidth command has been configured for class1. The bandwidth command configures the QoS feature CBWFQ.
Router> enable
Router# configure terminal
Router(config)# policy-map policy1
Router(config-pmap)# class class1
Router(config-pmap-c)# bandwidth percent 50
Router(config-pmap-c)# end
Router#
show policy-map policy1 class class1
Router# exit
Note
This example uses the bandwidth command. The bandwidth command configures the QoS feature class-based weighted fair queuing (CBWFQ). CBWFQ is just an example of a QoS feature that can be configured. Use the appropriate command for the QoS feature that you want to use.
Example Attaching the Policy Map to an Interface
The following is an example of attaching the policy map to an interface. In this example, the policy map called policy1 has been attached in the input direction of serial interface 4/0.
Cisco IOS Quality of Service Solutions Command Reference
MQC
"Applying QoS Features Using the MQC" module
Marking network traffic
"Marking Network Traffic" module
IPsec and VPNs
"Configuring Security for VPNs with IPsec" module
NBAR
"Classifying Network Traffic Using NBAR" module
IPv6 QoS
“IPv6 Quality of Service” module
IPv6 MQC Packet Classification
“IPv6 QoS: MQC Packet Classification” module
Standards
Standard
Title
No new or modified standards are supported, and support for existing standards has not been modified.
--
MIBs
MIB
MIBs Link
No new or modified MIBs are supported, and support for existing MIBs has not been modified.
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:
No new or modified RFCs are supported, and support for existing RFCs has not been modified.
--
Technical Assistance
Description
Link
The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.
Feature Information for Classifying Network Traffic
The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 3 Feature Information for Classifying Network Traffic
Feature Name
Releases
Feature Information
Packet Classification Using Frame Relay DLCI Number
12.2(13)T
Cisco IOS XE Release 2.1
The Packet Classification Using the Frame Relay DLCI Number feature allows customers to match and classify traffic based on the Frame Relay data-link connection identifier (DLCI) number associated with a packet. This new match criteria is in addition to the other match criteria, such as the IP Precedence, differentiated services code point (DSCP) value, class of service (CoS), currently available.
QoS: Local Traffic Matching Through MQC
Cisco IOS XE Release 2.1
This feature was introduced on Cisco ASR 1000 Series Routers.
QoS: Match ATM CLP
Cisco IOS XE Release 2.3
The QoS: Match ATM CLP features allows you to classify traffic on the basis of the ATM cell loss priority (CLP) value.
The following command was introduced or modified:
matchatm-clp.
QoS: MPLS EXP Bit Traffic Classification
Cisco IOS XE Release 2.3
The QoS: MPLS EXP Bit Traffic Classification feature allows you to classify traffic on the basis of the Multiprotocol Label Switching (MPLS) experimental (EXP) value.
The following command was introduced or modified:
matchmplsexperimental.