QoS
Class Map
A class map is a set of rules to classify traffic.
Define Class Map
Class maps operate in two modes:
Match all modes. Requires all circumstances be fulfilled
Just matching a criterion is enough to classify the class as defined.
Define matching criteria
As said, a class map is a tool to classify traffic. so we need to define criteria.
The keyword match
is used to define a rule for matching. A packet could be matched against its source, destination, etc.
- match any
Every packet is accpeted.
- no match any
Negate match any command and remove it from criteria
- [no] match access-list ACL
Note
Only
permit
rules in ACL are considered.
- [no] match source-address A.B.C.D/M
- [no] match destination-address A.B.C.D/M
- [no] match source-address X:X::X:X/M
- [no] match destination-address X:X::X:X/M
- [no] match dscp (0-63)
Match against packet DSCP value
- [no] match protocol (0-63)
Match against packet protocol number
Example :
n1(config-cmap)# match destination-address 200.1.2.2 n1(config-cmap)# match access-list acl1
Policy Map
A policy map is a set of traffic policies attached to an interface.
Currently, the only policy available is traffic policing. Policy map uses class maps as a base and defines policies based on the class map.
Define Policy Map
Define a new policy
- class CNAME
Enter class map policy config mode
- police BPS [NORMALBURST [MAXBURST]] conform-action ACTION exceed-action ACTION [violate-action ACTION]
Define a police policy for entered class map. In the above command,
BPS
is the average bitrate of this traffic class.
NORMALBURST
andMAXBURST
are token buckets’ sizes.ACTIONs are : transmit, drop and set-dscp-transmit. and the conditions are conform, exceed and violate ( which is optional).
transmit and drop actions, work as their names suggest. The set-dscp-transmit action allows the traffic to be passed. But the DSCP value of the packet is changed.
conform condition, is when data burst, is below the NORMALBURST rate. The exceed condition is when the data burst is between NORMALBURST and MAXBURST.
violate condition, is when data burst, is over MAXBURST rate. When a violate-action is not defined, the algorithm is just a single token bucket algorithm and only conform ( below NORMALBURST) and exceed ( over NORMALBURST) occurs.
- no class CNAME
Remove all policies defined for a class map
- no police
Remove police policy defined for a class map
Example :
n1(config)# policy-map pmap1 n1(config-pmap)# class cmap1 n1(config-pmap-c)# police 100K conform-action transmit exceed-action drop n1(config-pmap)# class cmap2 n1(config-pmap-c)# police 10K conform-action transmit exceed-action set-dscp-transmit 24 violate-action drop
Apply to interface
Currently a policy map can be applied to just ingress traffic.
Show commands
- show policy-map [NAME]
Example :
n1(config)# do sh policy-map pmap1 Policy Map pmap1 Class cmap Police CIR 102400 (bps) CB 25600 (byte) EB 35840 (byte) Conform Action : Transmit Exceed Action : Drop
Debugging logs can be set in case of need.
- [no] debug qos event
log data plane installation processes and results