QoS - jibingl/CCNA-CCNP GitHub Wiki

Quality of Service

TRUST_BOUNDARY           CLASSIFICATION  POLICING     QUEUING          SCHEDULING                SHAPING
                                         β”Œβ”€rate─┐     (FIFO)          (round-robin)
     ┆                .─ Vo Vo Vo Vo Vo  β”‚      β”‚ -- Vo3 Vo2 Vo1 -----LLQ/SPQ--10%--------.
     ┆               / ─ Vi Vi Vi Vi Vi  β”‚ Drop β”‚ -- Vi3 Vi2 Vi1 -----CBWFQ----20%---|--\  \    β”Œβ”€β”€β”€rate───┐
  Ingress--Routing---- ─ Vis Vis Vis Vis β”‚  or  β”‚ -- Vis3 Vis2 Vis1 --CBWFQ----15%---|----------β”‚Buffering β”‚---Egress
     ┆               \ ─ Hd Hd Hd Hd Hd  β”‚Remarkβ”‚ -- Hd3 Hd2 Hd1 -----CBWFQ----15%---|--/       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     ┆                `─ Da Da Da Da Da  β”‚      β”‚ -- Da3 Da2 Da1 -----CBWFQ----40%---|/  
                                         β””β”€β”€β”€β”€β”€β”€β”˜     (WRED)                (Bandwidth)
  • Any packets arriving from outside the trust boundary should have any QoS marking ignored and cleared.

Classification

Classification gives priority to certain types of traffic over others.

1. Identifying traffic

  • ACLs
  • NBAR (Network Based Application Recognition) inspects layer 3, layer 4, and up to layer 7.

2. Prioritizing traffic

  • PCP/CoS (Priority Code Point/Class of Service) of 802.1q tag (layer 2).

    PCP Value Priority Traffic Types
    0 (000) 1 (default) Best effort
    1 (001) 0 (lowest) Background
    2 (002) 2 Excellent effort
    3 (003) 3 Critical applications
    4 (004) 4 Video
    5 (005) 5 Voice
    6 (006) 6 Internetwork control
    7 (007) 7 (highest) Network control
  • DSCP (Differentiated Service Code Point) of IP header (layer 3).

    Traffic-types DSCP-value Description
    DF(Default Forwarding) 0 (000000) Best effort
    EF(Expedited Forwarding) 46 (101110) Low loss/latency/jitter; Voice traffic
    AF(Assured Forwarding) 12-values (bbbbb0) 4-class priority with 3-level drop-precedence; Interactive video AF4x; Streaming video AF3x; High priority data AF2x
    CS(Class Selector) 8-values (bbb000) Backward compatible to IPP
                     Lowest---DROP_PRECEDENCE--Highest       Value-Converting Diagrams
            Highest  ---------------------------------       0d-  32 16 8  4  2  1   (DSCP-cal-values)
               |       AF41(34)   AF42(36)   AF43(38)            +--+--+--+--+--+--+        |
            PRIORITY   AF31(26)   AF32(28)   AF33(30)        0b- |x  x  x |y  y  0 | (formula 8x + 2y)
               |       AF21(18)   AF22(20)   AF23(22)            +--+--+--+--+--+--+        |
            Lowest     AF11(10)   AF12(12)   AF13(14)        0d-  4  2  1  2  1      (AF-cal-values)
    
                     Lowest-----PRECEDENCE-----Highest
            -----    ---------------------------------       0d-  32 16 8  4  2  1 (DSCP-cal-values)
            IPP       0   1   2   3   4   5   6   7          0b-  x  x  x  0  0  0 (formula 8x)
            CS        CS0 CS1 CS2 CS3 CS4 CS5 CS6 CS7        0d-  4  2  1          (CS-cal-values)
            DSCP      0   8   16  24  32  40  48  56
    

Queuing

When a device receives messages faster than forwards them out, new messages are placed in a queue and taken by a Scheduler later to transmit.
Classified packets are queued in different queues.
By default, queued messages will be forwarded in FIFO (First In First Out) manner.
When a queue is full, new arriving packets will be dropped. This is called tail drop.

                          QUEUE (FIFO)
           Dropped   β”Œβ”€β”€β”€(queue is full)───┐
          β”Œ--┐ β”Œ--┐  β”‚ β”Œ--┬--┬--┬--┬--┬--┐ β”‚
          |Pa| |Pa|  β”‚ |Pa|Pa|Pa|Pa|Pa|Pa| β”‚
          |ck| |ck|  β”‚ |ck|ck|ck|ck|ck|ck| β”‚
          |et| |et|  β”‚ |et|et|et|et|et|et| β”‚
          β””--β”˜ β””--β”˜  β”‚ β””--β”΄--β”΄--β”΄--β”΄--β”΄--β”˜ β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                (Tail Drop)

Tail drop is harmful because it can lead to TCP global synchronization.
RED (Random Early Detection) is introduced to prevent tail drop and TCP global synchronization.
WRED (Weighted Random Early Detection) is an improved version, allows to control which packets are dropped depending on the traffic class.

Scheduling

Theoretically, a scheduler decides which queue traffic is forwarded next.

Method of Scheduling Description
Round-robin Packets are taken from each queue in order cyclically;
Weighted Round-robin More data is taken from high priority queues each time the scheduler reaches that queue;
CBWFQ Class-Based Weighted Fair Queuing, guaranteeing each queue a certain percentage of the interface's bandwidth. Not ideal for voice/video because even the highest priority queues have to wait their turn in the scheduler, which adds delay & jitter.
LLQ Low Latency Queue, designating one or more queues as strict priority queues (SPQ); SPQ queues will be always taken the next packet until it is empty. Best for voice/video traffic.

Policing

Drops or remark packets if the traffic rate goes over the configured rate.
Solve the downside of LLQ where schedulers are starving if there is always traffic in the designated SPQ.
ISPs use policing to comply a rate/speed with a WAN service contract.

Shaping

Buffers traffic in a queue if the traffic rate goes over the configured rate.
Shaping optimize delay of some traffic by delaying others.
Companies may deploy shaping on source traffic (customer-edge-router) to ensure the traffic they send complies with a contract (limited service rate/speed) which may be enforced in ISPs network by traffic policing.

Quality Measurement

Acceptable quality Bandwidth Delay Jitter Loss
Audio 30-128Kbps one-way delay =< 150ms jitter =< 30ms loss =< 1%
Video 384K-20Mbps one-way delay =< 200-400ms jitter =< 30-50ms loss =< 0.1-1%

Cisco Unified Wireless Network QoS

Class Traffic
Platinum Voice
Golden Video
Silver Best effort (default)
Bronze Background

Configuration

  1. Identifying traffic via Class Map
! Create an Access List to identify VoIP traffic
Router(config)# ip access-list extended VOIP_TRAFFIC
Router(config-ext-nacl)# permit udp any any range 16384 32767

! Map the VoIP traffic inside a Class Map
Router(config)# class-map match-all CLASS_VOIP
Router(config-cmap)# match access-group name VOIP_TRAFFIC

! Create another Class Map for web traffic using built-in protocol recognition
Router(config)# class-map match-any CLASS_WEB
Router(config-cmap)# match protocol http
Router(config-cmap)# match protocol https
  1. Prioritizing traffic and guaranteeing a bandwidth via Policy Map
Router(config)# policy-map WAN_QOS_POLICY

! Assign strict priority (SPQ) 10% bandwidth and mark voice traffic with DSCP EF (Expedited Forwarding)
Router(config-pmap)# class CLASS_VOIP
Router(config-pmap-c)# priority percent 10
Router(config-pmap-c)# set ip dscp ef

! Assign standard bandwidth (CBWFQ) 20% and mark web traffic with DSCP AF21
Router(config-pmap)# class CLASS_WEB
Router(config-pmap-c)# bandwidth percent 20
Router(config-pmap-c)# set ip dscp af21

! All remaining traffic falls into class-default and assign 70% remaining bandwidth (CBWFQ)
Router(config-pmap)# class class-default
Router(config-pmap-c)# bandwidth percent 70
  1. Applying on an interface for outbound/inbound traffic via Service Policy
Router(config)# interface GigabitEthernet0/0/0
Router(config-if)# service-policy output WAN_QOS_POLICY