Information About Traffic Classes
Traffic classes are categories of traffic (packets) that are grouped on the basis of similarity. Such groups of traffic are called class maps. Classifying network traffic is the foundation for enabling a quality of service (QoS) strategy in your network.
Figure 2-1 shows the criteria you use to classify network traffic.
Figure 2-1 Criteria for classifying network traffic
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.
Classifying network traffic allows you to see what kinds of traffic you have and treat some types of traffic differently than others. Identifying and organizing network traffic is key enabling you to allocate network resources to deliver best performance for each type of traffic. For example, high-priority network traffic can be singled out for special handling, and thus, help to achieve peak application performance.
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 proper QoS treatment, which you can configure in a policy map later.
You define each class of traffic in a class map based upon criteria such as IP precedence or Class of Service (CoS). The allowable criteria for mapping classes of traffic is listed in Table 2-1 . 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.
Table 2-1 lists and describes the allowable criteria used for mapping traffic classes.
Table 2-1 Traffic Class Criteria
|
|
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. The IP Precedence values are shown in the “DSCP and Precedence Values” section. |
Differentiated Services Code Point (DSCP) |
DSCP value within the DIffServ field of the IP header. The standard DSCP values are shown in the “DSCP and Precedence Values” section. |
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 ACL or MAC ACL name. If you configure the class to match-all ACLs, no other match criteria, except packet length, can be specified. If you configure the class to match-any ACL, you can match ACLs and any other match criteria. |
Packet length |
Size range of Layer 3 packet lengths. |
IP RTP |
Identify applications using Real-time Transport Protocol (RTP) by UDP port number range. |
Class map |
Criteria specified in a named class-map object. |
Classifying Traffic
This section includes the following topics.
Classifying ACL Traffic
Use this procedure to classify traffic by matching packets based on existing ACLs.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
- 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 ACLs, no other match criteria, except packet length, can be specified. If you configure the class to match-any ACL, you can match ACLs and any other match criteria.
- 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.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match access-group name acl_name
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_acl switch(config-cmap_qos)# class-map class_acl |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match access-group name acl-name Example: switch(config-cmap-qos)# match access-group name my_acl |
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. Note The not form of this command is not supported. |
Step 4 |
show class-map class_acl1 Example: switch(config-cmap-qos)# show class-map class_acl1 |
Displays the class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)#
copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
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 “DSCP and Precedence Values” section.
Note Tunneled IP packets will not be matched unless the tunneling protocol is also IP, and then the match applies to the outer IP header and not the encapsulated IP header.
SUMMARY STEPS
1. config t
2. class-map [type qos] [match-any | match-all] class_map_name
3. match [ not] dscp dscp_list
4. show class-map class_map_name
5. copy running-config startup-config
`DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_dscp |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] dscp dscp_list Example: switch(config-cmap-qos)# match dscp af21, af32 |
Configures the traffic class by matching packets based on dscp-values. The standard DSCP values are shown in the “DSCP and Precedence Values” section. Use the not keyword to match on values that do not match the specified range. |
Step 4 |
show class-map class_dscp Example: switch(config-cmap-qos)# show class-map class_dscp |
Displays the class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
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 “DSCP and Precedence Values” section.
Note Tunneled IP packets will not be matched unless the tunneling protocol is also IP, and then the match applies to the outer IP header and not the encapsulated IP header.
SUMMARY STEPS
1. config t
2. class-map [type qos] [match-any | match-all] class_map_name
3. match [not] precedence values
4. show class-map class_map_name
5. copy running-config startup-config
`DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_ip_precedence switch(config-cmap-qos)# |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] precedence values Example: switch(config-cmap-qos)# match precedence 1-2, 5-7 |
Configures the traffic class by matching packets based on precedence-values. Values are shown in “DSCP and Precedence Values” section. Use the not keyword to match on values that do not match the specified range. |
Step 4 |
show class-map class_ip_precedence Example: switch(config-cmap-qos)# show class-map class_ip_precedence |
Displays the class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Configuring QoS Group Classification
You can classify traffic based on the value of 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” section.
Note You match on the QoS group only in egress policies because its value is undefined until you set it in an ingress policy.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match [ not ] qos-group multi-range-qos-group-values
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_qos_group switch(config-cmap-qos)# |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] qos-group multi-range-qos-group-values Example: switch(config-cmap-qos)# match qos-group 4, 80-90 |
Configures the traffic class by matching packets based on a list of QoS group values. Values can range from 0 to 126. The default QoS group value is 0. Use the not keyword to match on values that do not match the specified range. |
Step 4 |
show class-map class_qos_group Example: switch(config-cmap-qos)# show class-map class_qos_group |
Displays the class map configuration for the specified traffic class name. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
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” section.
Note You match on the discard class only in egress policies because its value is undefined until you set it in an ingress policy.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match [ not ] discard-class multi-range-discard-class-values
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_discard_class switch(config-cmap-qos)# |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] discard-class multi-range-discard-class-values Example: switch(config-cmap-qos)# match discard-class 4, 60-62 switch(config-cmap-qos)# |
Configures the traffic class by matching packets based on the 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 |
show class-map class_discard_class Example: switch(config-cmap-qos)# show class-map class_discard_class switch(config-cmap-qos)# |
Displays the specified class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Configuring Layer 3 Packet Length Classification
You can classify Layer 3 traffic based on various packet lengths.
Note This feature is designed for IP packets only.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match [ not ] packet length packet-length-list
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_packet_length |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] packet length packet-length-list Example: switch(config-cmap-qos)# match packet length 2000 |
Configures the traffic class by matching packets 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 |
show class-map class_packet_length Example: switch(config-cmap-qos)# show class-map class_packet_length switch(config-cmap-qos)# |
Displays the specified class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Configuring CoS Classification
You can classify traffic based on Class of Service (CoS) in the IEEE 802.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 VLAN ID Tag field and is referred to as user_priority.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match [ not ] cos cos-list
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_cos |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] cos cos-list Example: switch(config-cmap-qos)# match cos 4, 5-6 |
Configures the traffic class by matching packets based on 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 |
show class-map class_cos Example: switch(config-cmap-qos)# show class-map class_cos switch(config-cmap-qos)# |
Displays the specified class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Configuring IP RTP Classification
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 uses 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.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match [ not ] ip rtp udp-port-values
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_rtp switch(config-cmap-qos)# |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] ip rtp udp-port-value Example: switch(config-cmap-qos)# match ip rtp 2000-2100, 4000-4100 |
Configures the traffic class by matching packets based on range of lower and upper UDP port numbers, 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 |
show class-map class_rtp Example: switch(config-cmap-qos)# show class-map class_rtp switch(config-cmap-qos)# |
Displays the specified class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Configuring Class Map Classification
Use this procedure to classify traffic based on the match criteria in another class map.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
- 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 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 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.
SUMMARY STEPS
1. config t
2. class-map [ type qos ] [ match-any | match-all ] class_map_name
3. match [ not ] class-map class_map_name
4. show class-map class_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
class-map [ type qos ] [ match-any | match-all ] class_map_name Example: switch(config)# class-map class_class_map |
Places you into Class Map QoS Configuration mode for the specified class map. Configures and saves the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
match [ not ] class-map class_map_name Example: switch(config-cmap-qos)# match class-map class_map3 |
Configures the traffic class by matching packets based on match criteria in another class map. Because match-all is the default for the class-map command, match criteria specified in class_map3 are ANDed with match criteria in class_class_map. Use the not keyword to match on values that do not match the specified range. |
Step 4 |
show class-map class_class_map Example: switch(config-cmap-qos)# show class-map class_class_map switch(config-cmap-qos)# |
Displays the specified class map configuration. |
Step 5 |
copy running-config startup-config Example:
switch(config-cmap-qos)# copy running-config startup-config
[######################################] 100%
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |