To configure class-based QoS (CBQoS) on a Cisco device, perform the following tasks:
class-map
commandpolicy-map
command service-policy
command.Note: The following procedures illustrate how to create a traffic class, how to create a traffic policy and how to attach the policy to an interface. The specific commands used to illustrate how these steps may be accomplished on a Cisco router are only for the purposes of this example. For more detailed information on how to implement QoS for your network, see Creating a Traffic Policy in the Cisco IOS Quality of Service Solutions Configuration Guide.
To create a traffic class:
Router> enable
Router# configure terminal
Router(config)# class-map match-any NMclass
Note: The match-any
keyword is used when all of the match criteria in the traffic class must be met in order for a packet to be placed in the specified traffic class.
Router(config-cmap)# match protocol snmp
Router(config-cmap)# match protocol icmp
Note: You can repeat the steps that create a class name and specify the match criteria to create as many classes as are needed to define the policy you want to apply to the interface.
Router(config-cmap)# exit
Example: Class Map configuration
The following is an example of a class map configuration.
class-map match-any nm
match protocol snmp
match protocol icmp
class-map match-any p2p
match protocol kazaa2
match protocol gnutella
match protocol edonkey
match protocol bittorrent
match protocol fasttrack
match protocol directconnect
match protocol winmx
class-map match-all FTP
match protocol ftp
class-map match-any web
match protocol http
class-map match-any utube
match protocol http s-header-box "*http://www.youtube.com/*"
To create a traffic policy:
config
).Router> enable
Router# configure terminal
config-pmap
).Router(config)# policy-map newPolicy
config-pmap-c
).Note: In the policy-map class configuration mode you can define one or more QoS features which supply services supporting dedicated bandwidth, improving loss characteristics, managing network congestion, traffic shaping and setting traffic priorities. For more information see Creating a Traffic Policy in the Cisco IOS Quality of Service Solutions Configuration Guide.
Router(config-pmap)# class NMclass
Router(config-pmap-c)# drop
Note: You can repeat the steps associating a class with the policy and defining the QoS features to apply to the class as many times as is necessary to create a policy that establishes services for all of the defined classes.
Router(config-pmap-c)# exit
Example: Traffic policy
The following is an example of a traffic policy:
policy-map crTest2
class p2p
drop
class FTP
drop
class nm
set dscp af43
class web
set dscp af12
class utube
set dscp af43
To associate a policy with an interface:
config
).Router> enable
Router# configure terminal
Router(config)# interface GigabitEthernet0/0
Router(config-if)# service-policy output input newPolicy
Router(config-if)# exit
Note: For more information on associating a policy with an interface, see Attaching a Traffic policy to an Interface in the Cisco IOS Quality of Service Solutions Configuration Guide.