Examples: Ingress Classification
The following table provides the traffic class commands supported at the ingress:
Table 1 Traffic Class CommandsCommand |
Description |
match cos cos-number Example:
Router(config-cmap)# match cos 2
|
Matches a packet on the basis of a Layer 2 CoS number. - cos-number— CoS value. The value can range from 0 to 7.
|
match ip precedence ip-precedence-value Example:
Router(config-cmap)# match ip precedence 5 |
Identifies the IP precedence value as match criteria. - ip-precedence-value— IP precedence value. The value can range from 0 to 7.
|
match ip dscp ip- dscp-value Example:
Router(config-cmap)# match ip dscp 6 |
Identifies a specific IP DSCP value as a match criterion.- ip- dscp-value — IP DSCP value. The value can range from 0 to 63.
|
match mpls experimental topmost exp-value Example:
Router(config-cmap)# match mpls experimental topmost 5 |
Matches the MPLS EXP value in the topmost label.- exp-value — MPLS EXP value. The value can range from 0 to 7.
|
match vlan [vlanid ] Example:
Router(config-cmap)# match vlan 100
|
Specifies a VLAN ID or range of VLAN IDs in a class-map to match packets.- vlanid —VLAN ID. The value can range from 0 to 4096.
|
The following example shows how to configure a class-map named ipp5, and enter a match statement for IP precedence 5:
Router# enable
Router# configure terminal
Router(config)# class-map ipp5
Router(config-cmap)# match ip precedence 5
The following example shows how to configure a class-map on multiple match statements:
Router# enable
Router# configure terminal
Router(config)# class-map match-any IPP
Router(config-cmap)# match ip precedence 3
Router(config-cmap)# match ip precedence 4
The following example shows how to a configure a class-map using match-all and match-any keywords:
Router# enable
Router# configure terminal
Router(config)# class-map match-any class1
Router(config-cmap)# match vlan 100 200 400-500
Router(config-cmap)# match cos 1
Router(config-cmap)# exit
Router(config)# class-map match-all class2
Router(config-cmap)# match vlan 1000 1100-1120
Router(config-cmap)# match cos 3
Router(config-cmap)# exit
The match-all criteria with multiple VLANs and CoS marking gets translated to a combination of match criteria. Therefore matching is based on the following incoming packet:
VLAN 1000 AND COS 3
VLAN 1100-1200 AND COS 3
The match-any criteria gets translated to individual match criteria. Therefore matching is based on VLAN 100, VLAN 200, VLAN 400-500, or COS 1.
The following example shows a logical OR operation in a child policy with match cos and class-default in a parent class.
Router(config)# class-map match-any childOR
Router(config-cmap)# match cos 5
Router(config)# policy-map testchildOR
Router(config-pmap)# class childOR
Router(config-pmap-c)# police cir percent 10
Router(config)# policy-map parentOR
Router(config-pmap)# class class-default
Router(config-pmap-c)# police cir percent 20
Router(config-pmap-c)# service-policy testchildOR
This example shows how to display class-map information for a specific class map:
Router# show class-map ipp5
class Map match-any ipp5 (id 1)
match ip precedence 5