Configuring Ingress Classification
The following example shows how to configure a class-map named ipp5, and enter a match statement for IP precedence 5:
Switch> enable
Switch# configure terminal
Switch(config)# class-map ipp5
Switch(config-cmap)# match ip precedence 5
Switch(config-cmap)# exit
The following example shows how to configure a class-map on multiple match statements:
Switch> enable
Switch# configure terminal
Switch(config)# class-map match-any IPP
Switch(config-cmap)# match ip precedence 3
Switch(config-cmap)# match ip precedence 4
Switch(config-cmap)# exit
The following example shows how to a configure a class-map using match-all and match-any keywords:
Switch> enable
Switch# configure terminal
Switch(config)# class-map match-any class1
Switch(config-cmap)# match vlan 100 200 400-500
Switch(config-cmap)# match cos 1
Switch(config-cmap)# exit
Switch(config)# class-map match-any class2
Switch(config-cmap)# match vlan 1000 1100-1120
Switch(config-cmap)# match cos 3
Switch(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 how to configure a hierarchical ingress policy:
Switch> enable
Switch# configure terminal
Switch(config)# class-map match-any childOR
Switch(config-cmap)# match cos 5
Switch(config)# policy-map testchildOR
Switch(config-pmap)# class childOR
Switch(config-pmap-c)# police cir percent 10
Switch(config)# policy-map parentOR
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police rate 500000
Switch(config-pmap-c)# service-policy testchildOR
Switch(config-pmap-c)# exit
Configuring Ingress Policing
The following example shows how to configure policing actions:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map ABC
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police 10000000 8000 8000
Switch(config-pmap-c-police)# conform-action set-cos-transmit 2
Switch(config-pmap-c-police)# exceed-action set-cos-transmit 1
Switch(config-pmap-c-police)# end
The following example shows how to configure a single rate 2-color policer:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map 1r2c
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police 2000000
Switch(config-pmap-c-police)# conform-action transmit
Switch(config-pmap-c-police)# exceed-action drop
Switch(config-pmap-c-police)# end
The following example shows how to configure a single rate, 2-color policer with percent:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map 1r2c_percent
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police cir percent 20
Switch(config-pmap-c-police)# conform-action set-cos-transmit 0
Switch(config-pmap-c-police)# exceed-action drop
Switch(config-pmap-c-police)# end
The following example shows how to configure a dual rate, 3-color policer:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map 2r3c
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police cir 2000000 pir 3000000
Switch(config-pmap-c-police)# conform-action set-prec-transmit 3
Switch(config-pmap-c-police)# exceed-action set-prec-transmit 2
Switch(config-pmap-c-police)# violate-action set-prec-transmit 1
Switch(config-pmap-c-police)# end
The following example shows how to configure a dual rate, 3-color policer with percent:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map 2r3c_percent
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police cir percent 10 pir percent 20
Switch(config-pmap-c-police)# conform-action transmit
Switch(config-pmap-c-police)# xceed-action set-cos-transmit 0
Switch(config-pmap-c-police)# violate-action drop
Switch(config-pmap-c-police)# end
The following example shows how to configure a single rate, 2-color policer in class-default and a child policy:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map police5
Switch(config-pmap)# class test18
Switch(config-pmap-c)# service policy child-level
Switch(config-pmap-c)# police cir 64000 50
Switch(config-pmap-c-police)# end
The following example shows how to configure a dual rate, 3-color policer configuration in a class and policy-map:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map test
Switch(config-pmap)# class cos2
Switch(config-pmap-c)# police 1000000 pir 2000000 conform-action set-cos-transmit 3 exceed-action set-cos-transmit 1 violate-action drop
The following example shows how to configure a dual rate, 3-color policer in class-default with a CIR of 64 Kbps, and PIR doubled the CIR rate, a conform action of transmit, and an exceed action mark dscp af 11:
Switch> enable
Switch# configure terminal
Switch(config)# olicy-map qos_test
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police cir 64000 bc 2000 pir 128000 be 2000 conform-action transmit exceed-action set-dscp-transmit af11 violate-action set-dscp-transmit cs1
The following example shows how to configure a dual rate, 3-color policer in class-default:
Switch> enable
Switch# configure terminal
Switch(config)# olicy-map qos_test
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# police cir 64000 bc 2000 pir 128000 be 2000 conform-action transmit exceed-action set-dscp-transmit af11 violate-action set-dscp- transmit cs1
Attaching or Removing a QoS Traffic Policy for a Target
The following example shows how to attach a traffic policy to a target:
Switch> enable
Switch# configure terminal
Switch(config)# interface TenGigabitEthernet 0/45
Switch(config-if)# service instance 100 ethernet
Switch(config-if-srv-instance)# service-policy input policy1
Switch(config-if-srv-instance)# end
The following example shows how to remove a traffic policy from a target:
Switch> enable
Switch# configure terminal
Switch(config)# interface TenGigabitEthernet 0/45
Switch(config-if)# service instance 100 ethernet
Switch(config-if-srv-instance)# no service-policy input policy1
Switch(config-if-srv-instance)# end
Configuring Ingress Marking
The following example shows the creation of a service policy called policy1. This service policy is associated to a previously defined classification policy through the use of the class command. This example assumes that a classification policy called class1 was previously configured. This example configures marking to set the IP precedence value:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map policy1
Switch(config-pmap)# class class1
Switch(config-pmap-c)# set ip precedence 1
The following example shows how to configure marking to set the CoS value:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map test
Switch(config-pmap)# lass test
Switch(config-pmap-c)# set cos 1
Configuring Egress Classification
The following example shows how to create a class map:
Switch> enable
Switch# configure terminal
Switch(config)# class-map c1
Switch(config-cmap)# match qos-group 1
The following example shows how to configure priority queue at the egress:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map Test1
Switch(config-pmap)# class test
Switch(config-pmap-c)# priority 10000
Configuring Egress Bandwidth
The following example shows how to configure minimum bandwidth guarantee at the egress:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map Test
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# bandwidth 10000
Switch(config-pmap-c)# exit
Configuring Egress Shaping
The following example shows how to shape traffic on a main interface; traffic leaving interface gi36/1 is shaped at the rate of 10 Mb/s:
Switch> enable
Switch# configure terminal
Switch(config)# class-map class-interface-all
Switch(config-cmap)# match qos-group 1
Switch(config-cmap)# exit
Switch(config)# policy-map dts-interface-all-action
Switch(config-pmap)# class class-interface-all
Switch(config-pmap-c)# shape average 10000000
Switch(config-pmap-c)# exit
Switch(config)# interface gi36/1
Switch(config-if)# service-policy output dts-interface-all-action
Configuring Egress Bandwidth Remaining Ratio
The following example shows how to configure bandwidth remaining ratio at the egress:
Switch> enable
Switch# configure terminal
Switch(config)# policy-map BRR
Switch(config-pmap)# class Test1
Switch(config-pmap-c)# bandwidth remaining ratio 10
Switch(config-pmap-c)# exit
Switch(config-pmap)# class Test2
Switch(config-pmap-c)# bandwidth remaining ratio 20
Switch(config-pmap-c)# exit
Switch(config-pmap)# class Test3
Switch(config-pmap-c)# bandwidth remaining ratio 30
Switch(config-pmap-c)# exit
Switch(config-pmap)# class class-default
Switch(config-pmap-c)# bandwidth remaining ratio 40