The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
Contents
This chapter contains the following sections:
Traffic classes are categories of traffic (packets) that are grouped on the basis of similarity of traffic are called class maps. Classifying network traffic allows you to enable a quality of service (QoS) strategy in your network.
Identifying and categorizing network traffic into traffic classes (that is, classifying packets) enables you to handle different types of traffic by separating network traffic into different categories.
Classifying network traffic allows you to see the kinds of traffic you have and treat some types of traffic differently than others. Identifying and organizing network traffic allows you to allocate network resources to deliver the best performance for each type of traffic.
You can place network traffic with a specific IP precedence into one traffic class, while you place traffic with a specific differentiated services code point (DSCP) value into another traffic class. Each traffic class can be given a different QoS treatment, which you configure in a policy map later.
You define each class of traffic in a class map based upon criteria, such as the IP precedence or Class of Service (CoS). The allowable criteria for mapping classes of traffic is listed in Criteria for Mapping Classes section. You can match the criteria to your traffic as follows:
Matching all
Matching or not matching one
Matching or not matching multiple
Matching or not matching another class map
Some of the criteria used in traffic class maps relates only to one direction of traffic—either ingress or egress. For example, the internal label QoS group has no meaning on ingress traffic because it has not yet been assigned a value.
Traffic that fails to match any traffic class in a QoS policy map is assigned to a default class of traffic. called class-default. The class-default can be referenced in a QoS policy map to select this unmatched traffic.
The allowable criteria for the mapping traffic classes are as follows:
Class Criteria | Description |
---|---|
CoS |
Class of service (CoS) field in the IEEE 802.1Q header. |
IP precedence |
Precedence value within the type of service (ToS) byte of the IP header. For details see the IP Precedence Values table. |
Differentiated Services Code Point (DSCP) |
DSCP value within the DIffServ field of the IP header. The standard DSCP values are listed in Commonly Used DSCP Values. |
QoS group |
Locally significant QoS values that can be manipulated and matched within the system. The range is from 0 to 126. |
Discard class |
Locally significant values that can be matched and manipulated within the system. The range is from 0 to 63. |
ACL |
IP access control list (ACL) or MAC ACL name. If you configure the class to match-all and ACL used as match-criteria, then no other match criteria, except the packet length, can be specified. If you configure the class to match-any and ACL used as match-criteria, then you can also match ACLs and any other match criteria. |
Packet length |
Size range of Layer 3 packet lengths. |
IP RTP |
Applications that are using the Real-time Transport Protocol (RTP) are identified by UDP port number range. |
Class map |
Criteria that are specified in a named class-map object. |
You are logged in to the CLI in EXEC mode.
You can specify a maximum of 32 match criteria in a class map.
You can configure a maximum of 64 classes for use in a single policy map, if no policers are configured.
When you match on an ACL, the only other match that you can specify is the Layer 3 packet length in a match-all class.
You can classify traffic on Layer 2 ports based on the port policy of the incoming packet.
Classifying Traffic
You can classify traffic by matching packets based on existing access control lists (ACLs).
QoS does not use the permit-deny functions of ACLs. The permit and deny ACL keywords are ignored when matching.
QoS does not support the not form of this command.
If you configure the class to match-all and ACL used as match-criteria, then no other match criteria, except the packet length, can be specified.
If you configure the class to match-any and ACL used as match-criteria, then you can match ACLs and any other match criteria also.
You are logged in to the CLI in EXEC mode.
Tunneled IP packets are not matched unless the tunneling protocol is also IP, and then the match applies to the outer IP header and not the encapsulated IP header.
The following example shows how to classify the ACL traffic:
switch# config terminal switch(config)# class-map class_acl switch(config-cmap-qos)# match access-group name my_acl switch(config-cmap-qos)# show class-map class_acl1 switch(config-cmap-qos)# copy running-config startup-config
You can classify traffic based on the DSCP value in the DiffServ field of the IP header. The standard DSCP values are found in the Commonly Used DSCP Values and IP Precedence Values.
Note | Tunneled IP packets are not matched unless the tunneling protocol is also IP, and then the match applies to the outer IP header and not the encapsulated IP header. |
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] dscp dscp_list | Configures the traffic class by matching packets that are based on dscp-values. The standard DSCP values are listed in the Commonly Used DSCP Values and IP Precedence Values. Use the not keyword to match on values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
switch# config terminal switch(config)# class-map class_dscp switch(config-cmap-qos)# match dscp-af21, af32 switch(config-cmap-qos)# show class-map class_dscp switch(config-cmap-qos)# copy running-config startup-config
You can classify traffic based on the precedence value in the type of service (ToS) byte field of the IP header. Precedence values can be found in the Commonly Used DSCP Values and IP Precedence Values tables.
Note | Tunneled IP packets are not matched unless the tunneling protocol is also IP, and then the match applies to the outer IP header and not the encapsulated IP header. |
Command or Action | Purpose | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. | ||||||||||||||||||
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. | ||||||||||||||||||
Step 3 | switch(config-cmap-qos)# match [not] precedence values |
| ||||||||||||||||||
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration. | ||||||||||||||||||
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
The following example shows how to configure the IP precedence classification:
switch# config terminal switch(config)# class-map class_ip_precedence switch(config-cmap-qos)# match precedence 1-2, 5-7 switch(config-cmap-qos)# show class-map class_ip_precedence switch(config-cmap-qos)# copy running-config startup-config
You can classify traffic based on the QoS group internal label, which is not part of the packet payload or any packet header. You can set the value of the QoS group within a policy map using the set qos-group command as described in the Creating a QoS Group Policy.
Note | You match on the QoS group only in egress policies because its value is undefined until you set it in an ingress policy. |
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] qos-group multi-range-qos-group-values | Configures the traffic class by matching packets that are based on a list of QoS group values. Values can range from 0 to 126. The default QoS group value is 0. Use thenot keyword to match on values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration for the specified traffic class name. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
switch# config terminal switch(config)# class-map class_qos_group switch(config-cmap-qos)# match qos-group 4, 80-90 switch(config-cmap-qos)# show class-map class_qos_group switch(config-cmap-qos)# copy running-config startup-config
You can classify traffic based on the value of the discard class internal label, which is not part of the packet payload or any packet header. You can set the value of the discard class within a policy map using the set discard-class command as described in the Creating a Discard Class Policy.
Note | You match on the discard class only in egress policies because its value is undefined until you set it in an ingress policy. |
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] discard-class multi-range-discard-group-values | Configures the traffic class by matching packets that are based on a list of discard-class values. Values can range from 0 to 63. The default discard class value is 0. Use the not keyword to match on values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration for the specified traffic class name. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
switch# config terminal switch(config)# class-map class_discard_class switch(config-cmap-qos)# match discard-class 4, 60-62 switch(config-cmap-qos)# show class-map class-discard-class switch(config-cmap-qos)# copy running-config startup-config
You can classify You can classify Layer 3 traffic based on various packet lengths.
Note | This feature is designed for IP packets only. |
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] packet-length packet-length-list | Configures the traffic class by matching packets that are based on various packet lengths. Values can range from 1 to 9198. Use the not keyword to match on values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration for the specified traffic class name. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
switch# config terminal switch(config)# class-map class_packet_length switch(config-cmap-qos)# match packet length 2000 switch(config-cmap-qos)# show class-map class_packet_length switch(config-cmap-qos)# copy running-config startup-config
Traffic classification allows you to organize traffic (packets) into traffic classes or categories on the basis of whether the traffic matches the criteria you specify. The values used to classify traffic are called match criteria. When you define a traffic class, you can specify multiple match criteria, you can choose to not match on a particular criterion, or you can determine the traffic class by matching any or all criteria.
You can classify traffic based on the class of service (CoS) in the IEEE 1Q header. This 3-bit field is defined in IEEE.802.1p to support QoS traffic classes. CoS is encoded in the high order 3 bits of the VAN ID Tag field and is referred to as user_priority.
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] cos cos-list | Configures the traffic class by matching packets that are based on a list of CoS values. Values can range from 0 to 7. Use the not keyword to match on values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration for the specified traffic class name. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
switch# config terminal switch(config)# class-map class_cos switch(config-cmap-qos)# match cos 4, 5-6 switch(config-cmap-qos)# show class-map class-cos switch(config-cmap-qos)# copy running-config startup-config
The IP Real-time Transport Protocol (RTP) is a transport protocol for real-time applications that transmits data such as audio or video and is defined by RFC 3550 . Although RTP does not use a common TCP or UDP port, you typically configure RTP to use ports 16384 to 32767. UDP communications use an even port and the next higher odd port is used for RTP Control Protocol (RTCP) communications.
You can configure classification based on UDP port ranges, which are likely to target applications using RTP.
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] ip rtp udp-port-values | Configures the traffic class by matching packets that are based on the range of lower and upper UDP port number, which is likely to target applications using RTP. Values can range from 2000 to 65535. Use the not keyword to match on values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration for the specified traffic class name. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
switch# config terminal switch(config)# class-map class_rtp switch(config-cmap-qos)# match ip rtp 2000-21000, 4000-4100 switch(config-cmap-qos)# show class-map class-rtp switch(config-cmap-qos)# copy running-config startup-config
The referenced class map must be created prior to its reference.
You can reference the same class map in multiple policies.
You can configure only one level of nesting of class maps. You cannot reference a class map that references another class map.
Before you delete a referenced class map, you should delete all references to that class map.
To perform a logical OR with the class map that is specified in the match class-map command, use the match-any keyword. The match-any or match-all specification of the matched class map is ignored.
To perform a logical AND with the class map that is specified in the match class-map command, use the match-all keyword. The match-any or match-all specification of the matched class map is ignored.
Command or Action | Purpose | |
---|---|---|
Step 1 | switch# configure terminal |
Enters global configuration mode. |
Step 2 | switch(config)# class-map [type qos] [match-any | match-all] class_map_name |
Places you into class map QoS configuration mode for the specified class map and configures and saves the map name in the running configuration. The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map. |
Step 3 | switch(config-cmap-qos)# match [not] class-map class_map_name | Configures the traffic class by matching packets that are based on the match criteria in another class map. Because match-all is the default for the class-map command, the match criteria that is specified in class_map3 are ANDed with match criteria in class_class_map. Use the not keyword to find values that do not match the specified range. |
Step 4 | switch(config-cmap-qos)# show class-map class_map_name | Displays the class map configuration. |
Step 5 | switch(config-cmap-qos)# copy running-config startup-config | (Optional)
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
The following example shows how to configure the class map classification:
switch# config terminal switch(config)# class-map class_class_map switch(config-cmap-qos)# match class-map class-map3 switch(config-cmap-qos)# show class-map class_class_map switch(config-cmap-qos)# copy running-config startup-config
To verify the classification configuration, use the commands in the following table:
Command |
Description |
---|---|
show class-map name |
Displays the class map configuration for all class maps or for a specified class map. |
show ip access-lists name |
Displays all IPv4 access control lists (ACLs) or a specific IPv4 ACL. |
This example shows how to configure classification for the class map named cmap1, which matches DSCP traffic AF21 and AF32:
switch(config)# class-map type qos match-all cmap1 switch(config-cmap-qos)# match dscp af21 af32 switch(config-cmap-qos)# exit
This section provides the QoS Classification release history.
Feature Name |
Release |
Feature Information |
---|---|---|
QoS Classification |
4.0. |
This feature was introduced |