Networks Horizon

share

Monday 2 April 2012

Quality of Service (QoS)-Part3
Modular QoS CLI (MQC)


Cisco MQC provides a modular and highly extensible framework for deploying QoS. MQC is a three tiered system of applying QOS policy.  It looks something like this…

Class Map – Defines particular types of traffic (Classification of traffic)
Policy Map – Defines what to do with traffic defined my a Class Map (Marking of Traffic)
Service Policy – Defines the Policy Map on a particular interface in a particular direction


Old method of configuring QoS was complex and time consuming not only for the administrator but also for the router CPU. Earlier we used to apply line by line configuration on every interface where we had to apply QoS line by line. We call it CLI. There, we had to apply same set of commands on every interface. Every single interface that receive/sends packet had to re-process those set of commands.


Classification: Instead of doing par interface command, cisco introduced MQC. Cisco introduced templates or classes with a few set of command. These template or classes are called class-maps. For example class-map 1 is the set of  commands matching http and tcp traffic and similarly class-map 2 can be set of commands which is matching the citrix traffic from specific sources/clients. So class-map is used to classify the different traffic based on different and rich list of criteria.


Marking:Policy-map is the another term which is used to mark/color or limit different traffic types based on class-maps. For example, we can mark traffic defined in class-map2 and limit it to 500 kbps. Or we can mark some other kind of traffic with some other kind of marking.


Applying on Interface:Cisco defines three level of QoS. Apart from class-maps and policy-maps, service-policy is used to apply policy-map to the interface in a incoming/outgoing fashion. We can have one policy map per interface and per direction. It means, in one interface, we can apply one policy map for incoming traffic and another policy map for outgoing traffic.


Configuration-Classification,Marking and Applying


Creating a Class-map-Classifying the traffic


Router#config t

Router(config)#class-map ?
Word=======class-map name
match-all==logical AND
match-any==logical OR


Router(config)#class-map Internet-traffic
Router(config-cmap)#match ?
access-group=access-list
any=any packet
class-map
cos
destination-address
dscp
fr-de
fr-dlci
ip
mpls
   etc.
packet=packet length
precedence= IP precedence
protocol=specific protocol
source-address=source ip
                        etc.


Router(config-cmap)#match protocol ?
arp
bgp
citrix
cdp
dhcp
eigrp
ftp
gnutella
http
icmp
etc..
Router(config-cmap)#match protocol http
Router(config-cmap)#match packet length min 400 max 600   (in bytes)


Check how many class-maps are configured


Router#show class-map
Class Map match-all test (id 1)
  Match none


Class Map match-any class-default (id 0)
  Match any


Class Map match-all Internet-traffic (id 2)
  Match protocol http
  Match packet lenngth min 400 max 600


Above command shows that traffic has to match both the statements, means traffic should be http kind and should only accept of packet size between 400 and 600 bytes. So match-all statement ensures that all statements should match within that class-match.


In case we want to make it a OR criterian, we can use below command..


Router(config)#class-map match-any internet-traffic  ======>>match-all command is default


Now check again:


Router#show class-map
Class Map match-all test (id 1)
  Match none


Class Map match-any class-default (id 0)
  Match any


Class Map match-any Internet-traffic (id 2)
  Match protocol http
  Match packet length min 400 max 600


Now above output means it will accept traffic which is either http kind or have a packet size between 400 and 600 bytes.


Class Map match-any class-default (id 0) statement is for the traffic which is not explicitly defined in any class-map.


Router(config)#class-map match-any ftp-traffic
Router(config-cmap)#match protocol ftp


We can also match a access-list. e.g.


Router(config)# access-list 5 permit host 172.16.1.9
Router(config)# class-map host1
Router(config-cmap)#match access-group 5


It is to be noted that here we are not doing anything, we are just classifying different traffic pattern in separate classes or groups based on different criteria. So, we need to understand that before applying any policy on any kind of traffic, we need to classify the traffic into groups like we did already through class-maps.


Creating the policy map-Marking


Router(config)#policy-map LIMIT_http
Router(config-pmap)# class internet-traffic
Router(config-pmap-c)#?
bandwidth=setting bandwidth
compression
drop
police=policing the traffic
priority
queue-limit
set
shape
service-policy
etc.
Router(config-pmap-c)#police 500000  ====> in bits
Router(config-pmap-c-police)#? ===============>>policing criteria is not displayed here
Router(config-pmap)# class ftp-traffic
Router(config-pmap-c)#bandwidth ?
<8-2000000>
percent %
remaining %
Router(config-pmap-c)#bandwidth 500  ======> in kbps
Router(config-pmap)# class class-default
Router(config-pmap-c)#random-detect
Router(config-pmap-c)#fair-queuing


Check how traffic is marked with policy-map


Router#show policy-map
Policy Map LIMIT_http
Class internet-traffic
  police cir 500000 bc 15625
confirm-action transmit
exceed-action drop
        Class ftp-traffic
  bandwidth 500(kbps) max threshhold 64


Applying Policy Map to an Interface


Router(config)# in s/0/0.1
Router(config-if)#service-policy ?
input==for incoming traffic
output=for outgoing traffic
Router(config-if)#service-policy input Limit_http=============>>applying policy-map


Please remember policy-map can be applied per interface/per direction, therefore, we should try to group different class-map in a single policy-map because we cannot apply two policy-maps in a single interface single direction(input or output).



No comments:

Post a Comment