Table Of Contents
Configuring QoS
Understanding QoS
Basic QoS Model
Classification
Classification Based on QoS ACLs
Classification Based on Class Maps and Policy Maps
Policing and Marking
Mapping Tables
Queueing and Scheduling
Packet Modification
Configuring QoS
Default QoS Configuration
Configuration Guidelines
Enabling QoS Globally
Configuring Classification Using Port Trust States
Configuring the Trust State on Ports within the QoS Domain
Configuring the CoS Value for an Interface
Configuring the DSCP Trust State on a Port Bordering Another QoS Domain
Configuring a QoS Policy
Classifying Traffic by Using ACLs
Classifying Traffic by Using Class Maps
Classifying, Policing, and Marking Traffic by Using Policy Maps
Classifying, Policing, and Marking Traffic by Using Aggregate Policers
Configuring DSCP Maps
Configuring the CoS-to-DSCP Map
Configuring the IP-Precedence-to-DSCP Map
Configuring the Policed-DSCP Map
Configuring the DSCP-to-CoS Map
Configuring the DSCP-to-DSCP-Mutation Map
Configuring Egress Queues on Gigabit-Capable Ethernet Ports
Mapping CoS Values to Select Egress Queues
Configuring the Egress Queue Size Ratios
Configuring Tail-Drop Threshold Percentages
Configuring WRED Drop Thresholds Percentages
Allocating Bandwidth among Egress Queues
Displaying QoS Information
QoS Configuration Examples
QoS Configuration for the Common Wiring Closet
QoS Configuration for the Intelligent Wiring Closet
QoS Configuration for the Distribution Layer
Configuring QoS
This chapter describes how to configure quality of service (QoS) on your switch. With this feature, you can provide preferential treatment to certain traffic at the expense of others. Without QoS, the switch offers best-effort service to each packet, regardless of the packet contents or size. It transmits the packets without any assurance of reliability, delay bounds, or throughput.
Note
For complete syntax and usage information for the commands used in this chapter, refer to the Catalyst 3550 Multilayer Switch Command Reference for this release.
This chapter consists of these sections:
•
Understanding QoS
•
Configuring QoS
•
Displaying QoS Information
•
QoS Configuration Examples
Note
When you are configuring QoS parameters for the switch, in order to allocate system resources to maximize the number of possible QoS access control lists (ACLs) allowed, you can use the sdm prefer access global configuration command to set the Switch Database Management feature to the access template. For more information on the SDM templates, see the "Optimizing System Resources for User-Selected Features" section.
Understanding QoS
Typically, networks operate on a best-effort delivery basis, which means that all traffic has equal priority and an equal chance of being delivered in a timely manner. When congestion occurs, all traffic has an equal chance of being dropped.
With the QoS feature configured on your switch, you can select specific network traffic, prioritize it according to its relative importance, and use congestion-management and congestion-avoidance techniques to provide preferential treatment. Implementing QoS in your network makes network performance more predictable and bandwidth utilization more effective.
The QoS implementation for this release is based on the DiffServ architecture, an emerging standard from the Internet Engineering Task Force (IETF). This architecture specifies that each packet is classified upon entry into the network. The classification is carried in the IP packet header, using 6 bits from the deprecated IP type of service (TOS) field to carry the classification (class) information. Classification can also be carried in the Layer 2 frame. These special bits in the Layer 2 frame or a Layer 3 packet are described here and shown in Figure 18-1:
•
Prioritization values in Layer 2 frames:
Layer 2 Inter-Switch Link (ISL) frame headers have a 1-byte User field that carries an IEEE 802.1p class of service (CoS) value in the three least-significant bits. On interfaces configured as Layer 2 ISL trunks, all traffic is in ISL frames.
Layer 2 802.1Q frame headers have a 2-byte Tag Control Information field that carries the CoS value in the three most-significant bits, which are called the User Priority bits. On interfaces configured as Layer 2 802.1Q trunks, all traffic is in 802.1Q frames except for traffic in the native VLAN.
Other frame types cannot carry Layer 2 CoS values.
Layer 2 CoS values range from 0 for low priority to 7 for high priority.
•
Prioritization bits in Layer 3 packets:
Layer 3 IP packets can carry either an IP precedence value or a Differentiated Services Code Point (DSCP) value. QoS supports the use of either value because DSCP values are backward-compatible with IP precedence values.
IP precedence values range from 0 to 7.
DSCP values range from 0 to 63.
Figure 18-1 QoS Classification Layers in Frames and Packets
Note
Layer 3 IPv6 packets are dropped when received by the switch.
All switches and routers across the Internet rely on the class information to provide the same forwarding treatment to packets with the same class information and different treatment to packets with different class information. The class information in the packet can be assigned by end hosts or by switches or routers along the way, based on a configured policy, detailed examination of the packet, or both. Detailed examination of the packet is expected to happen closer to the edge of the network so that the core switches and routers are not overloaded.
Switches and routers along the path can use the class information to limit the amount of resources allocated per traffic class. The behavior of an individual device when handling traffic in the DiffServ architecture is called per-hop behavior. If all devices along a path provide a consistent per-hop behavior, you can construct an end-to-end QoS solution.
Implementing QoS in your network can be a simple or complex task and depends on the QoS features offered by your internetworking devices, the traffic types and patterns in your network, and the granularity of control you need over incoming and outgoing traffic.
Basic QoS Model
Figure 18-2 shows the basic QoS model. Actions at the ingress interface include classifying traffic, policing, and marking:
•
Classifying distinguishes one kind of traffic from another. The process generates an internal DSCP for a packet, which identifies all the future QoS actions to be performed on this packet. For more information, see the "Classification" section.
•
Policing determines whether a packet is in or out of profile by comparing the internal DSCP to the configured policer, which limits the bandwidth consumed by a flow of traffic. The result of this determination is passed to the marker. For more information, see the "Policing and Marking" section.
•
Marking evaluates the policer and configuration information regarding the action to be taken when a packet is out of profile and decides what to do with the packet (pass through a packet without modification, mark down the DSCP value in the packet, or drop the packet). For more information, see the "Policing and Marking" section.
Actions at the egress interface include queueing and scheduling:
•
Queueing evaluates the internal DSCP and determines which of the four egress queues in which to place the packet. The DSCP value is mapped to a CoS value, which selects one of the queues.
•
Scheduling services the four egress queues based on their configured weighted round robin (WRR) weights and thresholds. Congestion avoidance techniques include tail drop and Weighted Random Early Detection (WRED) on Gigabit-capable Ethernet ports.
Figure 18-2 Basic QoS Model
Classification
Classification is the process of distinguishing one kind of traffic from another by examining the fields in the packet. Classification is enabled only if QoS is globally enabled on the switch. By default, QoS is globally disabled, so no classification occurs.
Note
Classification occurs only on a physical interface basis. No support exists for classifying packets at the VLAN or the switched virtual interface level.
You specify which fields in the frame or packet that you want to use to classify incoming traffic.
For non-IP traffic, you have these classification options, as shown in Figure 18-3:
•
Use the port default. If the frame does not contain a CoS value, assign the default port CoS value to the incoming frame. Then use the configurable CoS-to-DSCP map to generate the internal DSCP value.
•
Trust the CoS value in the incoming frame (configure the port to trust CoS). Then use the configurable CoS-to-DSCP map to generate the internal DSCP value. Layer 2 ISL frame headers carry the CoS value in the three least-significant bits of the 1-byte User field. Layer 2 802.1Q frame headers carry the CoS value in the three most-significant bits of the Tag Control Information field. CoS values range from 0 for low priority to 7 for high priority.
The trust DSCP and trust IP precedence configurations are meaningless for non-IP traffic. If you configure a port with either of these options and non-IP traffic is received, the switch assigns the default port CoS value and generates the internal DSCP from the CoS-to-DSCP map.
•
Perform the classification based on the configured Layer 2 MAC access control list (ACL), which can examine the MAC source address, MAC destination address, and the Ethertype field. If no ACL is configured, the packet is assigned the default DSCP of 0, which means best-effort traffic; otherwise, the policy map specifies the DSCP to assign to the incoming frame.
For IP traffic, you have these classification options as shown in Figure 18-3:
•
Trust the IP DSCP in the incoming packet (configure the port to trust DSCP), and assign the same DSCP to the packet for internal use. The IETF defines the six most-significant bits of the 1-byte Type of Service (ToS) field as the DSCP. The priority represented by a particular DSCP value is configurable. DSCP values range from 0 to 63.
For ports that are on the boundary between two QoS administrative domains, you can modify the DSCP to another value by using the configurable DSCP-to-DSCP-mutation map.
•
Trust the IP precedence in the incoming packet (configure the port to trust IP precedence), and generate a DSCP by using the configurable IP-precedence-to-DSCP map. The IP version 4 specification defines the three most-significant bits of the 1-byte ToS field as the IP precedence. IP precedence values range from 0 for low priority to 7 for high priority.
•
Trust the CoS value (if present) in the incoming packet, and generate the DSCP by using the CoS-to-DSCP map.
•
Perform the classification based on a configured IP standard or extended ACL, which examines various fields in the IP header. If no ACL is configured, the packet is assigned the default DSCP of 0, which means best-effort traffic; otherwise, the policy map specifies the DSCP to assign to the incoming frame.
For information on the maps described in this section, see the "Mapping Tables" section. For configuration information on port trust states, see the "Configuring Classification Using Port Trust States" section.
Figure 18-3 Classification Flowchart
Classification Based on QoS ACLs
You can use IP standard, IP extended, and Layer 2 MAC ACLs to define a group of packets with the same characteristics (class). In the QoS context, the permit and deny actions in the access control entries (ACEs) have different meanings than with security ACLs:
•
If a match with a permit action is encountered (first-match principle), the specified QoS-related action is taken.
•
If a match with a deny action is encountered, the ACL being processed is skipped, and the next ACL is processed.
•
If no match with a permit action is encountered and all the ACEs have been examined, no QoS processing occurs on the packet.
•
If multiple ACLs are configured on an interface, the lookup stops after the packet matches the first ACL with a permit action, and QoS processing begins.
Note
When creating an access list, remember that, by default, the end of the access list contains an implicit deny statement for everything if it did not find a match before reaching the end.
After a traffic class has been defined with the ACL, you can attach a policy to it. A policy might contain multiple classes with actions specified for each one of them. A policy might include commands to classify the class as a particular aggregate (for example, assign a DSCP) or rate limit the class. This policy is then attached to a particular port on which it becomes effective.
You implement IP ACLs to classify IP traffic by using the access-list global configuration command; you implement Layer 2 MAC ACLs to classify non-IP traffic by using the mac access-list extended global configuration command. For configuration information, see the "Configuring a QoS Policy" section.
Classification Based on Class Maps and Policy Maps
A class map is a mechanism that you use to isolate and name a specific traffic flow (or class) from all other traffic. The class map defines the criterion used to match against a specific traffic flow to further classify it; the criteria can include matching the access group defined by the ACL or matching a specific list of DSCP or IP precedence values. If you have more than one type of traffic that you want to classify, you can create another class map and use a different name. After a packet is matched against the class-map criteria, you further classify it through the use of a policy map.
A policy map specifies which traffic class to act on. Actions can include trusting the CoS, DSCP, or IP precedence values in the traffic class; setting a specific DSCP or IP precedence value in the traffic class; or specifying the traffic bandwidth limitations and the action to take when the traffic is out of profile. Before a policy map can be effective, you must attach it to an interface.
You create a class map by using the class-map global configuration command or the class policy-map configuration command; you should use the class-map command when the map is shared among many ports. When you enter the class-map command, the switch enters the class-map configuration mode. In this mode, you define the match criterion for the traffic by using the match class-map configuration command.
You create and name a policy map by using the policy-map global configuration command. When you enter this command, the switch enters the policy-map configuration mode. In this mode, you specify the actions to take on a specific traffic class by using the class, trust, or set policy-map configuration and policy-map class configuration commands. To make the policy map effective, you attach it to an interface by using the service-policy interface configuration command.
The policy map can also contain commands that define the policer, the bandwidth limitations of the traffic, and the action to take if the limits are exceeded. For more information, see the "Policing and Marking" section.
A policy map also has these characteristics:
•
A policy map can contain multiple class statements.
•
A separate policy-map class can exist for each type of traffic received through an interface.
•
A policy-map trust state supersedes an interface trust state.
For configuration information, see the "Configuring a QoS Policy" section.
Policing and Marking
After a packet is classified and has an internal DSCP value assigned to it, the policing and marking process can begin as shown in Figure 18-4.
Policing involves creating a policer that specifies the bandwidth limits for the traffic. Packets that exceed the limits are out of profile or nonconforming. Each policer specifies the action to take for packets that are in or out of profile. These actions, carried out by the marker, include passing through the packet without modification, dropping the packet, or marking down the packet with a new DSCP value that is obtained from the configurable, policed-DSCP map. For information on the policed-DSCP map, see the "Mapping Tables" section.
You can create these types of policers:
•
Individual
QoS applies the bandwidth limits specified in the policer separately to each matched traffic class. You configure this type of policer within a policy map by using the police policy-map configuration command.
•
Aggregate
QoS applies the bandwidth limits specified in an aggregate policer cumulatively to all matched traffic flows. You configure this type of policer by specifying the aggregate policer name within a policy map by using the police aggregate policy-map configuration command. You specify the bandwidth limits of the policer by using the mls qos aggregate-policer global configuration command. In this way, the aggregate policer is shared by multiple classes of traffic within a policy map.
When configuring policing and policers, keep these items in mind:
•
By default, no policers are configured.
•
Policers can only be configured on a physical port. There is no support for policing at a VLAN or switched virtual interface (SVI) level.
•
Only one policer can be applied to a packet per direction.
•
Only the average rate and committed burst parameters are configurable.
•
Policing can occur on ingress and egress interfaces:
–
128 policers are supported on ingress Gigabit-capable Ethernet ports.
–
8 policers are supported on all egress ports.
–
Ingress policers can be individual or aggregate.
•
On an interface configured for QoS, all traffic received through the interface is classified, policed, and marked according to the policy map attached to the interface. On a trunk interface configured for QoS, traffic in all VLANs received through the interface is classified, policed, and marked according to the policy map attached to the interface.
After you configure the policy map and policing actions, attach the policy to an ingress or egress interface by using the service-policy interface configuration command. For configuration information, see the "Classifying, Policing, and Marking Traffic by Using Policy Maps" section and the "Classifying, Policing, and Marking Traffic by Using Aggregate Policers" section.
Figure 18-4 Policing and Marking Flowchart
Mapping Tables
During QoS processing, the switch represents the priority of all traffic (including non-IP traffic) with an internal DSCP value:
•
During classification, QoS uses configurable mapping tables to derive the internal DSCP (a 6-bit value) from received CoS or IP precedence (3-bit) values. These maps include the CoS-to-DSCP map and the IP-precedence-to-DSCP map.
On an ingress interface configured in the DSCP-trusted state, if the DSCP values are different between the QoS domains, you can apply the configurable DSCP-to-DSCP-mutation map to the interface that is on the boundary between the two QoS domains.
•
During policing, QoS can assign another DSCP value to an IP or non-IP packet (if the packet is out of profile and the policer specifies a marked down DSCP value). This configurable map is called the policed-DSCP map.
•
Before the traffic reaches the scheduling stage, QoS uses the configurable DSCP-to-CoS map to derive a CoS value from the internal DSCP value. Through the CoS-to-egress-queue map, the CoS values select one of the four egress queues for output processing.
The CoS-to-DSCP, DSCP-to-CoS, and the IP-precedence-to-DSCP map have default values that might or might not be appropriate for your network.
The default DSCP-to-DSCP-mutation map and the default policed-DSCP map are null maps; they map an incoming DSCP value to the same DSCP value. The DSCP-to-DSCP-mutation map is the only map you apply to a specific interface. All other maps apply to the entire switch.
For configuration information, see the "Configuring DSCP Maps" section.
Queueing and Scheduling
After a packet is policed and marked, the queueing and scheduling process begins as shown in Figure 18-5 for Gigabit-capable Ethernet ports.
Figure 18-5 Queueing and Scheduling Flowchart for Gigabit-Capable Ethernet Ports
During the queueing and scheduling process, the switch uses egress queues and WRR for congestion management, and tail drop or WRED algorithms for congestion avoidance on Gigabit-capable Ethernet ports.
Each Gigabit-capable Ethernet port has four egress queues. The total size of the queue can vary depending on the amount of RAM installed in the switch. You can configure the buffer space allocated to each queue as a ratio of weights by using the wrr-queue queue-limit interface configuration command, where the relative size differences in the numbers indicates the relative differences in the queue sizes. To display the absolute value of the queue size, use the show mls qos interface interface-id statistics privileged EXEC command, and examine the FreeQ information.
You assign two drop thresholds to each queue, map DSCPs to the thresholds through the DSCP-to-threshold map, and enable either tail drop or WRED on the interface. The queue size, drop thresholds, tail-drop or WRED algorithm, and the DSCP-to-threshold map work together to determine when and which packets are dropped when the thresholds are exceeded. You configure the drop percentage thresholds by using either the wrr-queue threshold interface configuration command for tail drop or the wrr-queue random-detect max-threshold interface configuration command for WRED; in either case, you map DSCP values to the thresholds (DSCP-to-threshold map) by using the wrr-queue dscp-map interface configuration command. For more information, see the "Tail Drop" section and "WRED" section.
The available bandwidth of the egress link is divided among the queues. You configure the queues to be serviced according to the ratio of WRR weights by using the wrr-queue bandwidth interface configuration command. Queues are selected by the CoS ingress value that is mapped to an egress queue (CoS-to-egress-queue map) through the wrr-queue cos-map interface configuration command.
You can combine the commands described in this section to prioritize traffic by placing packets with particular DSCPs into certain queues, allocate a larger queue size or service the particular queue more frequently, and adjust queue thresholds so that packets with lower priorities are dropped. For configuration information, see the "Configuring Egress Queues on Gigabit-Capable Ethernet Ports" section.
Tail Drop
Tail drop is the default congestion-avoidance technique on Gigabit-capable Ethernet ports. With tail drop, packets are queued until the thresholds are exceeded. Specifically, all packets with DSCPs assigned to the first threshold are dropped until the threshold is no longer exceeded. However, packets assigned to the second threshold continue to be queued and transmitted as long as this threshold is not exceeded.
You can modify the two tail-drop threshold percentages assigned to the four egress queues by using the wrr-queue threshold interface configuration command. Each threshold value is a percentage of the total number of allocated queue descriptors for the queue. The default threshold is 100 percent for thresholds 1 and 2.
You modify the DSCP-to-threshold map to determine which DSCPs are mapped to which threshold ID by using the wrr-queue dscp-map interface configuration command. By default, all DSCPs are mapped to threshold 1, and when this threshold is exceeded, all the packets are dropped.
If you use tail-drop thresholds, you cannot use WRED, and vice versa. If tail drop is disabled, WRED is automatically enabled with the previous configuration (or the default if it was not previously configured).
WRED
Cisco's implementation of Random Early Detection (RED), called Weighted Random Early Detection (WRED), differs from other congestion-avoidance techniques because it attempts to anticipate and avoid congestion, rather than controlling congestion once it occurs.
WRED takes advantage of TCP congestion control to try to control the average queue size by indicating to end hosts when they should temporarily stop sending packets. By randomly dropping packets before periods of high congestion, it tells the packet source to decrease its transmission rate. Assuming the packet source is using TCP, WRED tells it to decrease its transmission rate until all the packets reach their destination, meaning that the congestion is cleared.
WRED reduces the chances of tail drop by selectively dropping packets when the output interface begins to show signs of congestion. By dropping some packets early rather than waiting until the queue is full, WRED avoids dropping large numbers of packets at once. Thus, WRED allows the transmission line to be fully used at all times. In addition, WRED statistically drops more packets from large users than small. Therefore, traffic sources that generate the most traffic are more likely to be slowed down than traffic sources that generate little traffic.
You can enable WRED and configure the two threshold percentages assigned to the four egress queues on a Gigabit-capable Ethernet port by using the wrr-queue random-detect max-threshold interface configuration command. All packets with DSCPs assigned to the first threshold are randomly dropped when the first threshold is exceeded. However, packets with DSCPs assigned to the second threshold continue to be queued and transmitted as long as this threshold is not exceeded. Each threshold percentage represents where WRED starts to randomly drop packets. By default, WRED is disabled.
You modify the DSCP-to-threshold map to determine which DSCPs are mapped to which threshold ID by using the wrr-queue dscp-map interface configuration command. By default, all DSCPs are mapped to threshold 1, and when this threshold is exceeded, all the packets are randomly dropped.
If you use WRED thresholds, you cannot use tail drop, and vice versa. If WRED is disabled, tail drop is automatically enabled with the previous configuration (or the default if it was not previously configured).
Packet Modification
A packet is classified, policed, and queued to provide QoS. Packet modifications can occur during this process:
•
For IP packets, classification involves assigning a DSCP to the packet. However, the packet is not modified at this stage; only an indication of the assigned DSCP is carried along. The reason for this is that QoS classification and ACL lookup occur in parallel, and it is possible that the ACL specifies that the packet should be denied and logged. In this situation, the packet is forwarded with its original DSCP to the CPU, where it is again processed through ACL software. However, route lookup is performed based on classified DSCPs.
•
For non-IP packets, classification involves assigning an internal DSCP to the packet, but because there is no DSCP in the non-IP packet, no overwrite occurs. Instead, the internal DSCP is translated to the CoS and is used both for queueing and scheduling decisions and for writing the CoS priority value in the tag if the packet is being transmitted on either an ISL or 802.1Q trunk port. Because the CoS priority is written in the tag, Catalyst 3500 series XL switches that use the 802.1P priority can interoperate with the QoS implementation on the Catalyst 3550 switches.
•
During policing, IP and non-IP packets can have another DSCP assigned to them (if they are out of profile and the policer specifies a markdown DSCP). Once again, the DSCP in the packet is not modified, but an indication of the marked-down value is carried along. For IP packets, the packet modification occurs at a later stage; for non-IP packets the DSCP is converted to CoS and used for queueing and scheduling decisions.
Configuring QoS
Before configuring QoS, you must have a thorough understanding of these items:
•
The types of applications used and the traffic patterns on your network.
•
Traffic characteristics and needs of your network. Is the traffic bursty? Do you need to reserve bandwidth for voice and video streams?
•
Bandwidth requirements and speed of the network.
•
Location of congestion points in the network.
This section describes how to configure QoS on your switch. It contains this configuration information:
•
Default QoS Configuration
•
Enabling QoS Globally
•
Configuring Classification Using Port Trust States
•
Configuring a QoS Policy
•
Configuring DSCP Maps
•
Configuring Egress Queues on Gigabit-Capable Ethernet Ports
Default QoS Configuration
Table 18-1 shows the default QoS configuration when QoS is disabled.
Table 18-1 Default QoS Parameters when QoS is Disabled
Port Type
|
QoS State
|
Egress traffic (DSCP and CoS Value)
|
Queue
|
Queue Weights
|
Tail-drop Thresholds
|
CoS Mapping to Queue
|
Gigabit-capable Ethernet ports
|
Disabled
|
Pass through.
|
All of the queue RAM is allocated to queue 1.
|
-
|
100%, 100%
WRED is disabled.
|
All CoS values map to to queue 1.
|
Table 18-2 shows the default QoS parameters without any further configuration when QoS is enabled.
Table 18-2 Default QoS Parameters when QoS is Enabled
Port Type
|
QoS State
|
Egress traffic (DSCP and CoS Value)
|
Queue
|
Queue Weights
|
Tail-drop Thresholds
|
CoS Mapping to Queue
|
Gigabit-capable Ethernet ports
|
Enabled
(no policing)
|
DSCP=0
CoS=0
(0 means best-effort delivery.)
|
Four queues are available.
|
Each queue has the same weight.
|
100%, 100%
WRED is disabled.
|
0, 1: queue 1
2, 3: queue 2
4, 5: queue 3
6, 7: queue 4
|
The default port CoS value is 0.
The default port trust state is untrusted.
No policy maps are configured.
No policers are configured.
The default CoS-to-DSCP map is shown in Table 18-3.
The default IP-precedence-to-DSCP map is shown in Table 18-4.
The default DSCP-to-CoS map is shown in Table 18-5.
The default DSCP-to-DSCP-mutation map is a null map, which maps an incoming DSCP value to the same DSCP value.
The default policed-DSCP map is a null map, which maps an incoming DSCP value to the same DSCP value (no markdown).
Configuration Guidelines
Before beginning the QoS configuration, you should be aware of this information:
•
If you have EtherChannel ports configured on your switch, you must configure QoS classification, policing, mapping, and queueing on the individual physical ports that comprise the EtherChannel. You must decide whether the QoS configuration should match on all ports in the EtherChannel.
•
It is not possible to match IP fragments against configured IP extended ACLs to enforce QoS. IP fragments are transmitted as best effort. IP fragments are denoted by fields in the IP header.
•
It is not possible to match IP options against configured IP extended ACLs to enforce QoS. These packets are sent to the CPU and processed by software. IP options are denoted by fields in the IP header.
•
Control traffic (such as spanning-tree BPDUs and routing update packets) received by the switch are subject to all ingress QoS processing.
•
We strongly recommend that you disable the IEEE 802.3x flowcontrol on all ports before enabling QoS on the switch. To disable it, use the flowcontrol receive off and flowcontrol send off interface configuration commands.
•
Only one ACL per class map and only one match command per class map are supported. The ACL can have multiple access control entries, which are commands that match fields against the contents of the packet.
•
Policy maps with ACL classification in the egress direction are not supported and cannot be attached to an interface by using the service-policy output policy-map-name interface configuration command. Policy maps containing set or trust policy-map class configuration commands cannot be attached to an egress interface; instead, you can use the police policy-map class configuration command to mark down (reduce) the DSCP value at the egress interface.
•
If you want to use set command in the policy map and are using the Layer 3 switch image, you must enable IP routing (disabled by default) and configure an IP default route to send traffic to the next-hop device that is capable of forwarding.
If your switch is running the Layer 3 image, the set command is not supported with the sdm prefer vlan global configuration command. IP routing is required for the set command with the Layer 3 image, but IP routing cannot be enabled for this template.
•
You can create an aggregate policer that is shared by multiple traffic classes within the same policy map. However, you cannot use the aggregate policer across different policy maps or interfaces.
Enabling QoS Globally
By default, QoS is disabled on the switch, which means that the switch offers best-effort service to each packet regardless of the packet contents or size. All packets pass through the switch without modification; all CoS values map to egress queue 1 with both tail-drop thresholds set to 100 percent of the total queue size.
Beginning in privileged EXEC mode, follow these steps to enable QoS:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
interface range gi0/1 -12
|
Enter interface configuration mode, and execute a command on multiple interfaces.
|
Step 3
|
flowcontrol receive off
flowcontrol send off
|
Disable flowcontrol on all interfaces.
|
Step 4
|
exit
|
Return to global configuration mode.
|
Step 5
|
mls qos
|
Enable QoS globally.
|
Step 6
|
end
|
Return to privileged EXEC mode.
|
Step 7
|
show mls qos
|
Verify your entries.
|
Step 8
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
After QoS is enabled, the default settings are as shown in Table 18-1.
To disable QoS, use the no mls qos global configuration command.
Configuring Classification Using Port Trust States
This section describes how to classify incoming traffic by using port trust states. It contains this configuration information:
•
Configuring the Trust State on Ports within the QoS Domain
•
Configuring the CoS Value for an Interface
•
Configuring the DSCP Trust State on a Port Bordering Another QoS Domain
Configuring the Trust State on Ports within the QoS Domain
Packets entering a QoS domain are classified at the edge of the QoS domain. When the packets are classified at the edge, the switch port within the QoS domain can be configured to one of the trusted states because there is no need to classify the packets at every switch within the QoS domain. Figure 18-6 shows a sample network topology.
Figure 18-6 Port Trusted States within the QoS Domain
Beginning in privileged EXEC mode, follow these steps to configure the port to trust the classification of the traffic that it receives:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS globally.
|
Step 3
|
interface interface-id
|
Enter interface configuration mode, and specify the interface to be trusted.
Valid interfaces include physical interfaces.
|
Step 4
|
mls qos trust {cos | dscp | ip-precedence}
|
Configure the port trust state.
By default, the port is not trusted.
Use the cos keyword setting if your network is composed of Ethernet LANs, consists of Catalyst 2900 and 3500 series XL switches, and has no more than two types of traffic.
Use the dscp or ip-precedence keyword if your network is not composed of only Ethernet LANs and if you are familiar with sophisticated QoS features and implementations.
Enter the cos keyword if you want ingress packets to be classified with the packet CoS values. For untagged packets, the port default CoS value is used. The default port CoS value is 0.
Enter the dscp keyword if you want ingress packets to be classified with packet DSCP values. For non-IP packets, the packet CoS value is used if the packet is tagged; for untagged packets, the default port CoS is used. Internally, the switch maps the CoS value to a DSCP value by using the CoS-to-DSCP map.
Enter the ip-precedence if you want ingress packets to be classified with the packet IP-precedence values. For non-IP packets, the packet CoS value is used if the packet is tagged; for untagged packets, the default port CoS is used. Internally, the switch maps the CoS value to a DSCP value by using the CoS-to-DSCP map.
|
Step 5
|
end
|
Return to privileged EXEC mode.
|
Step 6
|
show mls qos interface
|
Verify your entries.
|
Step 7
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
To return a port to its untrusted state, use the no mls qos trust interface configuration command.
For information on how to change the default CoS value, see the "Configuring the CoS Value for an Interface" section. For information on how to configure the CoS-to-DSCP map, see the "Configuring the CoS-to-DSCP Map" section.
Configuring the CoS Value for an Interface
QoS assigns the CoS value specified with this command to untagged frames received on trusted and untrusted ports.
Beginning in privileged EXEC mode, follow these steps to define the default CoS value of a port or to assign the default CoS to all incoming packets on the port:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS globally.
|
Step 3
|
interface interface-id
|
Enter interface configuration mode, and specify the interface to be trusted.
Valid interfaces include physical interfaces.
|
Step 4
|
mls qos cos {default-cos | override}
|
Configure the default CoS value for the port.
For default-cos, specify a default CoS value to be assigned to a port. If the port is CoS trusted and packets are untagged, the default CoS value becomes the CoS value for the packet. The CoS range is 0 to 7. The default is 0.
With the override keyword, you can override the previously configured trust state of the incoming packets and apply the default port CoS value to all incoming packets. By default, CoS override is disabled.
Use the override keyword when all incoming packets on certain ports deserve higher priority than packets entering from other ports. Even if a port is previously set to trust DSCP, CoS, or IP precedence, this command overrides the previously configured trust state, and all the incoming CoS values are assigned the default CoS value configured with this command. If an incoming packet is tagged, the CoS value of the packet is modified with the default CoS of the port at the egress port.
|
Step 5
|
end
|
Return to privileged EXEC mode.
|
Step 6
|
show mls qos interface
|
Verify your entries.
|
Step 7
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
To return to the default setting, use the no mls qos cos {default-cos | override} interface configuration command.
Configuring the DSCP Trust State on a Port Bordering Another QoS Domain
If you are administering two separate QoS domains between which you want to implement QoS features for IP traffic, you can configure the switch ports bordering the domains to a DSCP-trusted state as shown in Figure 18-7. Then the receiving port accepts the DSCP-trusted value and avoids the classification stage of QoS. If the two domains use different DSCP values, you can configure the DSCP-to-DSCP-mutation map to translate a set of DSCP values to match the definition in the other domain.
Figure 18-7 DSCP-Trusted State on a Port Bordering Another QoS Domain
Beginning in privileged EXEC mode, follow these steps to configure the DSCP-trusted state on a port and modify the DSCP-to-DSCP-mutation map. To ensure a consistent mapping strategy across both QoS domains, you must perform this procedure on the ports in both domains:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS on the switch.
|
Step 3
|
mls qos map dscp-mutation dscp-mutation-name in-dscp to out-dscp
|
Modify the DSCP-to-DSCP-mutation map.
The default DSCP-to-DSCP-mutation map is a null map, which maps an incoming DSCP value to the same DSCP value.
For dscp-mutation-name, enter the mutation map name. You can create more than one map by specifying a new name.
For in-dscp, enter up to eight DSCP values separated by spaces. Then enter the to keyword.
For out-dscp, enter up to eight DSCP values separated by spaces.
The DSCP range is 0 to 63.
|
Step 4
|
interface interface-id
|
Enter interface configuration mode, and specify the interface to be trusted.
Valid interfaces include physical interfaces.
|
Step 5
|
mls qos trust dscp
|
Configure the ingress port as a DSCP-trusted port.
|
Step 6
|
mls qos dscp-mutation dscp-mutation-name
|
Apply the map to the specified ingress DSCP-trusted port.
You can apply the map to different Gigabit-capable Ethernet ports.
|
Step 7
|
end
|
Return to privileged EXEC mode.
|
Step 8
|
show mls qos maps dscp-mutation
|
Verify your entries.
|
Step 9
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
To return a port to its non-trusted state, use the no mls qos trust interface configuration command. To return to the default DSCP-to-DSCP-mutation map values, use the no mls qos map dscp-mutation dscp-mutation-map-name global configuration command.
This example shows how to configure Gigabit Ethernet port 0/1 to the DSCP-trusted state and to modify the DSCP-to-DSCP-mutation map (named gi0/2-mutation) so that incoming DSCP values 10 to 13 are mapped to DSCP values 30 to 33:
Switch# configure terminal
Switch(config)# mls qos map dscp-mutation gi0/2-mutation 10 11 12 13 to 30 31 32 33
Switch(config)# interface gigabitethernet0/2
Switch(config-if)# mls qos trust dscp
Switch(config-if)# mls qos dscp-mutation gi0/2-mutation
Configuring a QoS Policy
Configuring a QoS policy typically requires classifying traffic into classes, configuring policies applied to those traffic classes, and attaching policies to interfaces.
For background information, see the "Classification" section and the "Policing and Marking" section.
This section contains this configuration information:
•
Classifying Traffic by Using ACLs
•
Classifying Traffic by Using Class Maps
•
Classifying, Policing, and Marking Traffic by Using Policy Maps
•
Classifying, Policing, and Marking Traffic by Using Aggregate Policers
Classifying Traffic by Using ACLs
You can classify IP traffic by using IP standard or IP extended ACLs; you can classify non-IP traffic by using Layer 2 MAC ACLs.
Beginning in privileged EXEC mode, follow these steps to create an IP standard ACL for IP traffic:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS on the switch.
|
Step 3
|
access-list access-list-number permit source [source-wildcard]
|
Create an IP standard ACL, repeating the command as many times as necessary.
For access-list-number, enter the access list number. The range is 1 to 99 and 1300 to 1999.
Use the permit keyword to permit a certain type of traffic if the conditions are matched.
For source, enter the network or host from which the packet is being sent. You can use the any keyword as an abbreviation for 0.0.0.0 255.255.255.255.
(Optional) For source-wildcard, enter the wildcard bits in dotted decimal notation to be applied to the source. Place ones in the bit positions that you want to ignore.
Note When creating an access list, remember that, by default, the end of the access list contains an implicit deny statement for everything if it did not find a match before reaching the end.
|
Step 4
|
end
|
Return to privileged EXEC mode.
|
Step 5
|
show access-lists
|
Verify your entries.
|
Step 6
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
To delete an access list, use the no access-list access-list-number global configuration command.
This example shows how to allow access for only those hosts on the three specified networks. The wildcard bits apply to the host portions of the network addresses. Any host with a source address that does not match the access list statements is rejected.
Switch(config)# access-list 1 permit 192.5.255.0 0.0.0.255
Switch(config)# access-list 1 permit 128.88.0.0 0.0.255.255
Switch(config)# access-list 1 permit 36.0.0.0 0.0.0.255
! (Note: all other access implicitly denied)
Beginning in privileged EXEC mode, follow these steps to create an IP extended ACL for IP traffic:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS on the switch.
|
Step 3
|
access-list access-list-number permit protocol source source-wildcard destination destination-wildcard
|
Create an IP extended ACL, repeating the command as many times as necessary.
For access-list-number, enter the access list number. The range is 100 to 199 and 2000 to 2699.
Use the permit keyword to permit a certain type of traffic if the conditions are matched.
For protocol, enter the name or number of an IP protocol. Use the question mark (?) to see a list of available protocol keywords.
For source, enter the network or host from which the packet is being sent. You specify this by using dotted decimal notation, by using the any keyword as an abbreviation for source 0.0.0.0 source-wildcard 255.255.255.255, or by using the host keyword for source 0.0.0.0.
For source-wildcard, enter the wildcard bits by placing ones in the bit positions that you want to ignore. You specify the wildcard by using dotted decimal notation, by using the any keyword as an abbreviation for source 0.0.0.0 source-wildcard 255.255.255.255, or by using the host keyword for source 0.0.0.0.
For destination, enter the network or host to which the packet is being sent. You have the same options for specifying the destination and destination-wildcard as those described by source and source-wildcard.
Note When creating an access list, remember that, by default, the end of the access list contains an implicit deny statement for everything if it did not find a match before reaching the end.
|
Step 4
|
end
|
Return to privileged EXEC mode.
|
Step 5
|
show access-lists
|
Verify your entries.
|
Step 6
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
To delete an access list, use the no access-list access-list-number global configuration command.
This example shows how to create an ACL that permits IP traffic from any source to any destination that has the DSCP value set to 32:
Switch(config)# access-list 100 permit ip any any dscp 32
This example shows how to create an ACL that permits IP traffic from a source host at 10.1.1.1 to a destination host at 10.1.1.2 with a precedence value of 5:
Switch(config)# access-list 100 permit ip host 10.1.1.1 host 10.1.1.2 precedence 5
This example shows how to create an ACL that permits PIM traffic from any source to a destination group address of 224.0.0.2 with a DSCP set to 32:
Switch(config)# access-list 102 permit pim any 224.0.0.2 dscp 32
Beginning in privileged EXEC mode, follow these steps to create a Layer 2 MAC ACL for non-IP traffic:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS on the switch.
|
Step 3
|
mac access-list extended name
|
Create a Layer 2 MAC ACL by specifying the name of the list.
After entering this command, the mode changes to extended MAC ACL configuration.
|
Step 4
|
permit {host src-MAC-addr mask | any | host dst-MAC-addr | dst-MAC-addr mask} [type mask]
|
Specify the type of traffic to permit if the conditions are matched, entering the command as many times as necessary.
For src-MAC-addr, enter the MAC address of the host from which the packet is being sent. You specify this by using the hexadecimal format (H.H.H), by using the any keyword as an abbreviation for source 0.0.0. source-wildcard 255.255.255, or by using the host keyword for source 0.0.0.
For mask, enter the wildcard bits by placing ones in the bit positions that you want to ignore.
For dst-MAC-addr, enter the MAC address of the host to which the packet is being sent. You specify this by using the hexadecimal format (H.H.H), by using the any keyword as an abbreviation for source 0.0.0. source-wildcard 255.255.255, or by using the host keyword for source 0.0.0.
(Optional) For type mask, specify the Ethertype number of a packet with Ethernet II or SNAP encapsulation to identify the protocol of the packet. For type, the range is from 0 to 65535, typically specified in hexadecimal. For mask, enter the don't care bits applied to the Ethertype before testing for a match.
Note When creating an access list, remember that, by default, the end of the access list contains an implicit deny statement for everything if it did not find a match before reaching the end.
|
Step 5
|
end
|
Return to privileged EXEC mode.
|
Step 6
|
show access-lists [access-list-number | access-list-name]
|
Verify your entries.
|
Step 7
|
copy running-config startup-config
|
(Optional) Save your entries in the configuration file.
|
To delete an access list, use the no mac access-list extended access-list-name global configuration command.
This example shows how to create a Layer 2 MAC ACL with two permit statements. The first statement allows traffic from the host with MAC address 0001.0000.0001 to the host with MAC address 0002.0000.0001. The second statement allows only Ethertype XNS-IDP traffic from the host with MAC address 0001.0000.0002 to the host with MAC address 0002.0000.0002.
Switch(config)# mac access-list extended maclist1
Switch(config-ext-macl)# permit 0001.0000.0001 0.0.0 0002.0000.0001 0.0.0
Switch(config-ext-macl)# permit 0001.0000.0002 0.0.0 0002.0000.0002 0.0.0 xns-idp
! (Note: all other access implicitly denied)
Classifying Traffic by Using Class Maps
You use the class-map global configuration command to isolate a specific traffic flow (or class) from all other traffic and to name it. The class map defines the criteria to use to match against a specific traffic flow to further classify it. Match statements can include criterion such as an ACL, IP precedence values, or DSCP values. The match criterion is defined with one match statement entered within the class-map configuration mode.
Note
You can also create class-maps during policy map creation by using the class policy-map configuration command. For more information, see the "Classifying, Policing, and Marking Traffic by Using Policy Maps" section.
Beginning in privileged EXEC mode, follow these steps to create a class map and to define the match criterion to classify traffic:
| |
Command
|
Purpose
|
Step 1
|
configure terminal
|
Enter global configuration mode.
|
Step 2
|
mls qos
|
Enable QoS on the switch.
|
Step 3
|
access-list access-list-number {deny | permit} source [source-wildcard]
or
access-list access-list-number {deny | permit} protocol source [source-wildcard] destination [destination-wildcard]
or
mac access-list extended name
permit {host src-MAC-addr mask | any | host dst-MAC-addr | dst-MAC-addr mask} [type mask]
|
Create an IP standard or extended ACL for IP traffic or a Layer 2 MAC ACL for non-IP traffic, repeating the command as many times as necessary.
For more information, see the "Classifying Traffic by Using ACLs" section.
Note When creating an access list, remember that, by default, the end of the access list contains an implicit deny statement for everything if it did not find a match before reaching the end.
|
Step 4
|
class-map class-map-name [match-all | match-any]
|
Create a class map, and enter class-map configuration mode.
By default, no class maps are defined.
For class-map-name, specify the name of the class map.
(Optional) Use the match-all keyword to perform a logical-AND of all matching statements under this class map. All match criteria in the class map must be matched.
(Optional) Use the match-any keyword to perform a logical-OR of all matching statements under this class map. One or more match criteria must be matched.
If neither the match-all or match-any keyword is specified, the default is match-all.
Note Because only one match command per class map is supported, the match-all and match-any keywords function the same.
|
Step 5
|
match {access-group acl-index-or-name | ip dscp dscp-list | ip precedence ip-precedence-list}
|
Define the match criterion to classify traffic.
By default, no match criterion is supported.
Only one match criterion per class map is supported, and only one ACL per class map is supported.
For access-group acl-index-or-name, specify the number or name of the ACL created in Step 3.
For ip dscp dscp-list, enter a list of up to eight IP DSCP values to match against incoming packets. Separate each value with a space. The range is 0 to 63.
For ip precedence ip-precedence-list, enter a list of up to eight IP-precedence values to match against incoming packets. Separate each value with a space. The range is 0 to 7.
|
Step 6
|
end
|
Return to privileged EXEC mode.
|
Step 7
|
show class-map
|
Verify your entries.
|
|