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.
Figure 1. Criteria for Classifying Network Traffic
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.
Criteria for Mapping Classes
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.
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.
Prerequisites for Classification
You are logged in to the CLI in EXEC mode.
Guidelines and Limitations
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
Classifying ACL Traffic
You can classify traffic by matching packets based on existing access control lists (ACLs).
Before You Begin
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.
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 an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match access-group nameac1-name
Configures and saves the access group to match for this class in the running configuration.
Note
The permit and deny keywords are ignored when matching the ACL.
The not form of this command is not supported.
Step 4
switch(config-cmap-qos)# show class-mapclass_map_name
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.
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
Classifying DSCP Traffic
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.
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 an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] dscpdscp_list
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
Configuring IP Precedence Classification
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.
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 an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] precedencevalues
Configures the traffic class by matching packets that are based on precedence-values listed in the following table:
Value
Description
000 (0)
Routine or Best Effort
001 (1)
Priority
010 (2)
Immediate
011 (3)
Flash (mainly used for voice signaling or for video)
100 (4)
Flash Override
101 (5)
Critical (mainly used for voice RTP)
110 (6)
Internet
111 (7)
Network
Use the not keyword to match on values that do not match the specified range.
Step 4
switch(config-cmap-qos)# show class-mapclass_map_name
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
Configuring QoS Group Classification
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.
Places you into class map QoS configuration mode the specified class map and configures and saves the map name in the running configuration.
The class_map_name argument is an alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] qos-groupmulti-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-mapclass_map_name
Displays the class map configuration for the specified traffic class name.
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
Configuring Discard Class Classification
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.
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 an alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] discard-classmulti-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-mapclass_map_name
Displays the class map configuration for the specified traffic class 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 an alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] packet-lengthpacket-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-mapclass_map_name
Displays the class map configuration for the specified traffic class name.
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
Configuring CoS Classification
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.
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 an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] coscos-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-mapclass_map_name
Displays the class map configuration for the specified traffic class name.
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
Configuring IP RTP Classification
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.
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 an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] ip rtpudp-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-mapclass_map_name
Displays the class map configuration for the specified traffic class name.
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
Configuring Class Map Classification
You can classify traffic based on the match criteria in another class map.
Before You Begin
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.
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 an alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-cmap-qos)# match [not] class-mapclass_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-mapclass_map_name