Content

| 8.2 |  | Quality of Service Mechanisms |
| 8.2.7 |  | Using the class-map command to define traffic classes |

The class-map command is used to define a traffic class. The purpose of a traffic class is to classify traffic that should be given a particular QoS. A traffic class contains three major elements, a name, a series of match commands, and if more than one match command exists in the traffic class, an instruction on how to evaluate these match commands. The traffic class is named in the class-map command line. For example, if the class-map cisco command is entered while configuring the traffic class in the CLI, the traffic class would be named cisco.

> Switch(config)#class-map cisco
> Switch(config-cmap)#

match commands are used to specify various criteria for classifying packets. Packets are checked to determine whether they match the criteria specified in the match commands. If a packet matches the specified criteria, that packet is considered a member of the class and is forwarded according to the QoS specifications set in the traffic policy. Packets that fail to meet any of the matching criteria are classified as members of the default traffic class and will be subject to a separate traffic policy.

The actual criteria that can be used to establish a match vary considerably between hardware platforms and versions of the IOS. A comparison of the supported match commands on the Catalyst 2950 and Catalyst 3550 is presented in Figure .

In the example below, any traffic that is “permitted” by the named ACL test will be considered part of the traffic class known as cisco.

> Switch(config)#class-map cisco
> Switch(config-cmap)#match access-group name test

The instruction on how to evaluate these match commands needs to be specified if more than one match statement exists in the traffic class. The evaluation instruction is specified with one of the following two options:

- class-map match-any or
- class-map match-all

> Note: For the Catalyst 2950 there is no match-any option. The default behavior of the 2950 is to match-any. This can be overridden using the match-all command.

If match-any is specified as the evaluation instruction, the traffic being evaluated by the traffic class must match one of the specified criteria. If match-all is specified as the evaluation instruction, the traffic being evaluated by the traffic class must match all of the specified criteria.

For example:

> Switch(config)#class-map match-any cisco
> Switch(config-cmap)#match access-group name test
> Switch(config-cmap)#match interface fastethernet 0/1

If traffic matches a permit statement in the ACL test or the traffic originates from FastEthernet 0/1 then it will be considered to be part of the class of traffic known as cisco.

On the Catalyst 3550 and 6500 the Modular QoS CLI allows multiple traffic classes to be configured as a single traffic class, such as nested traffic classes, also called nested class maps. This nesting can be achieved with the use of the match class-map command.