Showing posts with label QoS. Show all posts
Showing posts with label QoS. Show all posts

Thursday, 12 April 2012

QoS Shaping Calculations

Cisco IOS has some default for shaping and policing. These are defaults are based on the CIR.

Committed Information Rate (CIR) (the shaping rate)
Committed Rate Measurement Interval (Tc)
Committed Burst (Bc)
Excess Burst (Be) 

Generic Traffic Shaping (GTS) & CB shaping default var settings:

  • Bc: 8000 bits if rate <= 320kbps, Bc=shaping rate*Tc if > 320 kbps
  • Be: Be=Bc= 8000 bits if rate <= 320kbps, Be=Bc if > 320 kbps
  • Tc: Tc = Bc/shaping rate if rate <=320 kbps, Tc=25ms if > 320kbps

You can simplify this as follows

If Rate <=320kbs
  • Bc = 8000 bits
  • Be = 8000 bits
  • Tc = 8000/shaping rate

If Rate >320kbps
  • Bc = shaping rate * 0.025
  • Be = Bc
  • Tc = 0.025

When manually setting the Bc & Be parameters, a big deciding factor is the most used/important application. For data applications doing large file transfers, a larger Tc is generally recommended. For voice you want the smallest possible Tc, to avoid voice packets having to wait a large amount of milliseconds for the next interval before being sent.


--------


A router is connected to an HDLC circuit via a T1 physical interface. The SLA for this link only allows for a sustained rate of 768 kb/s. Bursts are allowed for up to 30 seconds at up to line rate, with a window Tc of 125 ms.
What should the Be and Be setting be when using generic traffic shaping?

the sustained rate is the CIR = 768kb/s
From the formula Tc=Bc/CIR => Bc = Tc * CIR = 125ms * 768kb/s = 96000 bits
(In fact you should calculate with the default units, that is 0.125s * 768000b/s)

The T1 speed is 1.544 Mbps = 1544000bps. “Bursts are allowed for up to 30 seconds at up to line rate” ->Be = 1544000bps * 30 = 46320000 bits.

Terminologies:

  • The term CIR refers to the traffic rate for a VC based on a business contract.
  • Tc is a static time interval, set by the shaper.
  • Committed burst (Bc) is the number of bits that can be sent in each Tc.
  • Be is the excess burst size, in bits. This is the number of bits beyond Bc that can be sent after a period of inactivity.



Saturday, 10 March 2012

QoS for IPv6

To implement QoS in networks running IPv6, follow the same steps that you would follow to implement QoS in networks running only IPv4.  

Create classes based on the criteria you establish for your network. In particular, if the same network is also carrying IPv4 traffic along with IPv6, decide if you want to treat both of them the same way or treat them separately and specify match criteria accordingly. If you want to treat them the same, use match statements such as match precedence, match dscp, set precedence, and set dscp. If you want to treat them separately, add match criteria such as match protocol ip and match protocol ipv6 in a match-all class map. 

Except for the modifications to the match dscp and match precedence commands and the addition of the IPv6-specific match access-group name command, the functionality of all of the match commands is the same for both IPv4 and IPv6.  

















Source: here



Monday, 6 February 2012

QoS Queuing Methods

Queuing in Cisco routers has been around for quite some time. Back then the command's were not standardised and using some of the older methods requires that you memorise some really arcane commands. The new Modular Quality of service (MQC) makes life much easier. This is also sometimes referred to as Class Based Queuing.


FIFO - First in First Out
  • the most simplest
  • to configure
    • Just unconfigure all other methods
  • use "show int x/y | i que" to check method
  • change que length: hold-queue x out
PQ - Priority Queuing
  • not MQC enabled
  • good for low latency requirements
  • 4 queues - High, Medium, Normal, Low
  • always serve the high first, if empty then medium and so on
  • to configure
    • 1) create a priority list: (config)# priority-list x ....
    • 2) apply to interface: (config-if)# priority-group x

CQ - Custom Queuing
  • not MQC enabled
  • good for reserving bandwidth. There are some corner cases where this does not work. (See ODOM)
  • 16 queues - labelled 1 to 16
  • set to bytes to transmit per queue
  • service all queues in round robin fashion
  • this guarantees minimum bandwidth per queue
  • to configure
    • 1) create que list: (config)# queue-list x que y (where x is list number and y is que number)
    • 2) apply to interface: (config-if)# custom-que-list x
 MDRR - Modified Deficit Round Robin
  •  8 queues - labelled 0 -7
  • exactly like CQ but provides better bandwidth control
  • only available on GSRs (ie 12000 routers)
WFQ - Weighted Fair Queuing
  • default option
  • good for low volume flows
  • not MQC enabled
  • 4096 queues (unconfigurable)
  • based on classifying flows automatically
  • provides all flows with equal bandwidth
  • uses modified tail drop
  • to configure:
    • 1) no need to create anything
    • 2) apply to interface: (config-if)# fair-queue
CBWFQ - Class Based Weighted Fair Queuing
  • MQC enabled
  • 64 queues - each one is reference with a class statement in MQC speak
  • does not have the bandwidth issues like CQ
  • like CQ in that you can reserve bandwidth but in % not in bytes
  • only within the default queue you can use WFQ but all the rest use FIFO
  • the default queue can use tail drop or WRED. All other queues use tail drop. If you end up using WFQ then you will use modified tail drop.
  • to configure
    • create policy
      • (config)# class-map match-all x
      • (config)# policy-map xxx 
          • class x
            • bw percent 50 (% of the number configured on the interface using the bw command)
          • class default
            • fair-que
    • apply to interface: (config-if)# service-policy out xxxx
LLQ - Low Latency Queuing
  • MQC enabled
  • this is just CBWFQ with the priority command turn on in one class
  • to configure
    • create policy
      • (config)# class-map match-all x
      • (config)# policy-map xxx 
          • class x
            • priority bw (maximum bandwidth in kbps)
            • or priority percent 50 (% of the interface BW or based on the interfaces bw command)
          • class default
            • fair-que
    • apply to interface: (config-if)# service-policy out xxxx

Further details about bandwidth vs priority command can be found here.

Sunday, 5 February 2012

QoS - The Basic Steps

With any QoS configuration on a Cisco router there are only 5 steps involved. In any deployment a combination of these basic five steps can be used.

The most important thing to note is that QoS only comes into play in two situations:
  1. Slow speed links (ie less 2mbits) (like the edges of your network)
  2. Links that are reaching congestion
 In all other cases the configuration below does not really help.

Step 1 - Classification and Marking

Classification involves selecting some specific interesting traffic on which we can perform some actions.  The following methods can be used to classify traffic:
  • ACL's
  • NBAR
  • IP Addresses
  • MAC Addresses
  • Input interface
Marking means that you tag this traffic such that other downstream devices can also perform any actions they need to. Tagging can be done either at the layer three level (ie modifying the IP Packet) or at the layer two level (ie modifying the frame).
  • Layer 3 Tagging
    • IP Precedence
    • DSCP
  • Layer 2 Tagging
    • 802.1p Class of Service (COS) - Vlan Ethernet frames
    • ISL
    • ATM Cell Loss Priority (CLP)
    • Frame Relay Discard Eligible (DE) bit
    • MPLS Experimental bits
Step 2 - Congestion Management (ie Queuing or Scheduling)
In this step you basically stuff the classified and/or marked traffic into various queues so that you can select the traffic you want to send first while everything else waits. The follow types of queuing methods are available:
  •  Priority Queuing (PQ) - provides 4 queues
  • Custom Queuing (CQ) - provides 16 queues
  • Weighted Fair Queuing (WFQ) - provides 4096 queues (all managed automatically)
  • Class based WFQ (CBWFQ) - provides 64 queues
  • Low Latency Queuing (LLQ) - provides 64 queues same as CBWFQ
  • Modified Deficit Round Robin Queuing - provides 8 queues
Step 3 - Shaping and Policing
If you indeed have more traffic that the link can handled then you need to decide what to do with this.
  • Class Based Policing - At what threshold you need to start dropping traffic
  • Class Based Shaping - Buffer the traffic so that you can try move the peak traffic into gaps
Step 4 - Congestion Avoidance
These set of tools try to avoid congestion happening in the first place by automagically dropping traffic earlier so that congestion is never hit or sending messages back to the source to slow down
  • .Weighted Random Early Detect (WRED)
  • Explicit Congestion Notification
Step 5 - Link Efficiency
How you can squeeze more out of you the link you have.
  • Payload compression
  • RTP Header Compression (Class based)
  • TCP Header Compression
  • MLPPP Fragmentation and Interleaving (reducing transmit times for small packets)
  • Frame Relay and ATM Fragmentation and Interleaving





Monday, 15 August 2011

QoS Field Marking


Layer 3 Marking (IP Header)

There is only one field in the IP header which been overloaded so may times for various protocols. Its the perfect opportunity for asking confusing questions. The diagram below shows two ways of breaking up the field.

In IPv4 this byte is generally referred to as the Type of Service (TOS) field. In IPv6 this byte is called the Traffic Class field.

DiffServe (Differentiated Services Control Point - DSCP) and IP Precedence (IP Prec)


The original way includes IP Prec + TOS + ECN and the new way is DiffServ + ECN.

ECN or Explicit Congestion Notification allows end-to-end notification of network congestion without dropping packets. ECN is an optional feature that is only used when both endpoints support it and are willing to use it. It is only effective when supported by the underlying network.

The mapping between the two methods is shown in the table below. The DiffServe method is probably the most important method of marking a packet. See below for other methods

AFxy = assured forwarding class X, drop priority Y
EF = Expedited Forwarding
CS = Class Selector






To convert IP Precedence to DSCP , just multiply by 8.
 DSCP = 8 * IP Prec

For IP Prec of Critical this is:
8*5 = DSCP 40

To convert Per Hop Behaviour (AFxy) to DSCP use the following:
DSCP = (8*x)+(2*y)

For AF13 This becomes

(8*1)+(2*3) = DSCP 14

The reverse equation is
x = int(DSCP / 8 )
y = remainder(DSCP/8)/2

The mnemonic to remember the order of IP Prec is "NIC F FIPR".

Integrated Services (IntServ)

This uses RSVP to allocate end-to-end bandwidth and does not scale well.

MPLS Experimental QOS
This 3 bit field included in the header



Layer 2 Markings

LAN

Ethernet - Class of Service (CoS or 802.1p)
This 3 bit field is included in the .1Q or ISL frames only. As a resut is only important on a trunked link. All other links dont use use this framing!

WAN

Frame Relay - Discard Eligibility (DE)
Single bit field, when set means that the frame can be dropped in preference to other frames.



ATM - Cell Loss Priority (CLP)
Single bit field, when set means that the frame can be dropped in preference to other frames.