Modular QoS CLI 有以下三种形式:
Class map—How you define what traffic you're interested in
Policy map—What you do to the traffic defined in a class map
Service policy—How you enable a policy map on an interface
定义Class Map
The first step in using MQC is to build a class map. Not surprisingly, you do this with the class-map command:
vxr12(config)#class-map ?
WORD class-map name
match-all Logical-AND all matching statements under this classmap
match-any Logical-OR all matching statements under this classmapm
The match-all and match-any keywords let you specify whether traffic matches this class, if it matches all the rules in this class or any of them, respectively. The default is match-all.
You create a class by giving it a name. This puts you in a submode called config-cmap:
vxr12(config)#class-map voice
vxr12(config-cmap)#?
QoS class-map configuration commands:
description Class-Map description
exit Exit from QoS class-map configuration mode
match classification criteria
no Negate or set default values of a command
rename Rename this class-mapm
The most useful option under config-cmap is match, which lets you define the traffic you want to match with this class map. Its options are as follows:
vxr12(config-cmap)#match ?
aclearcase/" target="_blank" >ccess-group Access group
any Any packets
class-map Class map
cos IEEE 802.1Q/ISL class of service/user priority values
destination-address Destination address
fr-de Match on Frame-relay DE bit
input-interface Select an input interface to match
ip IP specific values
mpls Multi Protocol Label Switching specific values
not Negate this match result
protocol Protocol
qos-group Qos-group
source-address Source addressm
举例
class-map match-all voice
match mpls experimental 5
policy-map llq
class voice
priority percent 30
This defines a class that matches any MPLS traffic that has the EXP bits set to 5 and then defines a policy for that traffic that gives the traffic 30 percent of a link's bandwidth. The policy map hasn't been enabled on an interface yet; you'll see that in a minute.
You can match multiple values with the same line using the following command sequence:
class-map match-any bronze-service
match mpls experimental 0 1
This matches any packets that have an MPLS EXP of 0 or 1. As with route maps, multiple values specified within the same match clause (such as match mpls experimental 0 1) are implicitly ORed together; a packet can't have both EXP 0 and EXP 1, so this implicit ORing makes sense.
You can also match more than one criteria within a class, and you can use the match-any and match-all statements to decide how you want to match traffic. For example, the following policy matches traffic that has MPLS EXP 5 or traffic that entered the router on interface POS3/0:
class-map match-any gold
match mpls experimental 5
match input-interface POS3/0
The following policy matches any traffic that has MPLS EXP 5 and that came in on interface POS3/0:
class-map match-all gold
match mpls experimental 5
match input-interface POS3/0
vxr12#show class-map
Class Map match-all gold (id 2)
Match mpls experimental 5
Match input-interface POS3/0
Class Map match-any class-default (id 0)
Match any
Class Map match-all voice (id 3)
Match mpls experimental 5
Policy Map
After you define the class maps you want to match, you need to associate the class of traffic with a behavior. You create the behavior with the policy-map command, which, like class-map, puts you in a special submode:
vxr12(config)#policy-map ?
WORD policy-map name
vxr12(config)#policy-map llq
vxr12(config-pmap)#?
QoS policy-map configuration commands:
class policy criteria
description Policy-Map description
exit Exit from QoS policy-map configuration mode
no Negate or set default values of a command
rename Rename this policy-map
Under the config-pmap submode, you specify the class you want to match. This puts you in the config-pmap-c submode:
vxr12(config)#policy-map llq
vxr12(config-pmap)#class voice
vxr12(config-pmap-c)#?
QoS policy-map class configuration commands:
bandwidth Bandwidth
exit Exit from QoS class action configuration mode
no Negate or set default values of a command
police Police
priority Strict Scheduling Priority for this Class
queue-limit Queue Max Threshold for Tail Drop
random-detect Enable Random Early Detection as drop policy
service-policy Configure QoS Service Policy
set Set QoS values
shape Traffic Shaping
class-map match-any voice
match mpls experimental 5
policy-map llq
class voice
priority percent 30
class-map match-all business
match mpls experimental 3 4
class-map match-all voice
match mpls experimental 5
policy-map business-and-voice
class voice
priority percent 30
class business
bandwidth percent 60
class class-default
bandwidth percent 10
Service Policy
vxr12(config-if)#service-policy ?
history Keep history of QoS metrics
input Assign policy-map to the input of an interface
output Assign policy-map to the output of an interface
vxr12(config-if)#service-policy out
vxr12(config-if)#service-policy output ?
WORD policy-map name
vxr12(config-if)#service-policy output llq
##############################
vxr12#show policy-map interface pos3/0
POS3/0
Service-policy output: llq
Class-map: voice (match-all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: mpls experimental 5
Weighted Fair Queuing
Strict Priority
Output Queue: Conversation 264
Bandwidth 30 (%)
Bandwidth 46500 (kbps) Burst 1162500 (Bytes)
(pkts matched/bytes matched) 0/0
(total drops/bytes drops) 0/0
Class-map: class-default (match-any)
21 packets, 15744 bytes
5 minute offered rate 3000 bps, drop rate 0 bps
Match: any