QoS using Policy

Okapi > Traffic engineering > QoS using Policy

 

Introduction

 

QoS is implemented by defining policies for the interface. Each policy may contain many more policies defined as its child policies. Each policy may also contain several classes. There can be only one policy at the root, which is applied directly on the interface.

 

 

 

Configuration

 

Class Definition

Before classes can be attached to the qdiscs/policies, they are defined. Before the definition can be done match-all / match-any option has to be provided to specify if all or any one of the matching criteria has to be matched by this class.

The definition includes the traffic classification criteria based on the information provided by an access-list, the mac address of the source, the packet size. The match any option in the class definition can be provided to match all the traffic. 

Okapi(config)# class-map c1 match-all
Okapi(config-cmap)# match access-group 111
Okapi(config-cmap)# match packet length max 2000 min 100
Okapi(config)# class-map c2 match-any
Okapi(config-cmap)# match any
Okapi(config)# class-map c3 match-all
Okapi(config-cmap)# match any
Okapi(config)# class-map c4 match-all
Okapi(config-cmap)# match access-group 111
 
 
 
Policy Definition

Using the defined classes, we can define policies each containing one qdisc and the attached classes.  A policy can be defined to be attached directly at the root or as a child of a class. For each class attached to the qdisc, atleast one filter is attached to the qdisc for the purpose of classification of the traffic into the classes based on the matching criteria.  All the filters attached to the qdisc are maintained in a list, and sequential scanning of these filters is done while matching the traffic.

 

To define a policy p1 with an htb qdisc

Okapi(config)# policy-map p1 qdisc-type htb

 

To attach a class c1

Okapi(config-pmap)# class c1

 

Defining the priority, rate, burst bytes, and policing action to take in case the rate is exceeded

Okapi(config-pmap-c)# priority 1
Okapi(config-pmap-c)# rate 40000 40000
Okapi(config-pmap-c)# limit-action drop

Okapi(config-pmap)# class c3
Okapi(config-pmap-c)# priority 4
Okapi(config-pmap-c)# rate 10293 10293
Okapi(config-pmap-c)# limit-action continue

Okapi(config-pmap)# class c4
Okapi(config-pmap-c)# rate 10000 10000
Okapi(config-pmap-c)# limit-action drop

 

Defining class c3 as the parent of class c4

Okapi(config-pmap-c)# parent-class-name c3

Okapi(config)# policy-map p2 qdisc-type htb
Okapi(config-pmap)# class c2
Okapi(config-pmap-c)# priority 2
Okapi(config-pmap-c)# rate 10222 10222
Okapi(config-pmap-c)# ceil 40000
Okapi(config-pmap-c)# limit-action pass

 

Attaching policy p2 as the child of policy p1, attaching p2 at the class c1

Okapi(config-pmap)# parent-policy-name p1 class c1
 
 
 

Application on the interface

 After the policies have been defined, the root policy should be applied on the interface

 
Okapi(config)# interface FastEthernet 0
Okapi(config-if-eth)# service-policy output p1