My Countingdown

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

Friday, December 16, 2011

Lab 5. QOS - Legacy Commited Access Rate


Let’s do practice

R1#
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0
 ip ospf 1 area 0
 no shut

R2#
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0
 ip ospf 1 area 0
 no shut

Now let test ping from R1 to 2.2.2.2 with size 512

R1#ping 2.2.2.2 rep 10 size 512
Type escape sequence to abort.
Sending 10, 512-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 12/23/56 ms

Please do make ping with size 3000 repeat 10 with success rate only 80% with CIR 24 kbp!!!

R1#
interface f0/0
  rate-limit input 24000 16000 16000 conform-action transmit exceed-action drop

Verify the rate-limit and make sure success rate only 80% as requirement

R1(config-if)#do sh int f0/0 rate-limit
FastEthernet0/0
  Input
    matches: all traffic
      params:  24000 bps, 16000 limit, 16000 extended limit
      conformed 49 packets, 29860 bytes; action: transmit
      exceeded 3 packets, 3088 bytes; action: drop
      last packet: 3692ms ago, current burst: 0 bytes
      last cleared 00:03:35 ago, conformed 1000 bps, exceeded 0 bps

R1(config-if)#do ping 2.2.2.2 rep 10 size 3000
Type escape sequence to abort.
Sending 10, 3000-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!!.!!.
Success rate is 80 percent (8/10), round-trip min/avg/max = 52/70/84 ms

Lab 4. QoS - Traffic Shaping


Let’s do practice

R1#
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0
 ip ospf 1 area 0
 no shut

R2#
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0
 ip ospf 1 area 0
 no shut

Let’s do traffic shaping on Fa0/0 in R1

R1(config)#int f0/0
R1(config-if)#traffic-shape rate ?
  <8000-100000000>  Target Bit Rate (bits per second)

R1(config-if)#traffic-shape rate 128000 ?
  <0-100000000>  bits per interval, sustained
  <cr>

R1(config-if)#traffic-shape rate 128000 8000 ?
  <0-100000000>  bits per interval, excess in first interval
  <cr>

R1(config-if)#traffic-shape rate 128000 8000 0 ?
  <0-4096>  Set buffer limit
  <cr>

R1(config-if)#traffic-shape rate 128000 8000 0 1000

Verify the traffic-shaping

R1(config-if)#do ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/39/56 ms

R1#show traffic-shape f0/0
Interface   Fa0/0
       Access Target    Byte   Sustain   Excess    Interval  Increment Adapt
VC     List   Rate      Limit  bits/int  bits/int  (ms)      (bytes)   Active
-             128000    1000   8000      0         62        1000      -

R1#show traffic-shape stat
                  Acc. Queue Packets   Bytes       Packets   Bytes     Shaping
I/F               List Depth                 Delayed   Delayed   Active
Fa0/0                   0           27        2605       0         0         no

Lab 3. QoS - RSVP


Let’s do practice

R1#
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0
 ip ospf 1 area 0
 no shut

R2#
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0
 ip ospf 1 area 0
 no shut

Let’s do activate RSVP from R1 to R2

R1#
interface FastEthernet0/0
 ip rsvp bandwidth 64 64
!
ip rsvp sender-host 2.2.2.2 1.1.1.1 tcp 23 65535 10 1

R2#
interface FastEthernet0/0
 ip rsvp bandwidth 64 64
!
ip rsvp reservation-host 2.2.2.2 1.1.1.1 tcp 23 65535 ff rate 10 1

Verify the rsvp

R1#show ip rsvp sender
To              From            Pro DPort Sport Prev Hop        I/F      BPS
2.2.2.2         1.1.1.1         TCP 23    65535 1.1.1.1                  10K

R1#show ip rsvp int f0/0
interface    allocated  i/f max  flow max sub max
Fa0/0        10K        64K      64K      0

Lab 2. QoS - Priority Queuing



Priority queuing use 4 methods:
  1. High. It’s the highest priority
  2. Medium.  This is the second priority
  3. Normal. This is the tird priority and by default traffic classified by this priority
  4. Low. It’s the lowest priority
Let’s do practice

R1#
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0
 ip ospf 1 area 0
 no shut

R2#
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0
 ip ospf 1 area 0
 no shut

Let’s make example.
  • All telnet will be set as high queue
  • All http traffic will be set as medium queue
  • All ping traffic will be set as normal queue
  • Default traffic will be set as low queue

R1#
priority-list 1 protocol ip high tcp 23
priority-list 1 protocol ip medium tcp 80
priority-list 1 protocol ip normal list 100
priority-list 1 default low
!
access-list 100 permit icmp any any echo
access-list 100 permit icmp any any echo-reply
!
interface fa0/0
 priority-group 1

Verify the queuing priority

R1#show queueing priority
Current DLCI priority queue configuration:
Current priority queue configuration:

List   Queue  Args
1      low    default
1      high   protocol ip          tcp port telnet
1      medium protocol ip          tcp port www
1      normal protocol ip          list 100

Let’s debug if we already assign to right priority or not.
To avoid appear a lot of messages, let’s deactivate debug for cdp and keepalive

R1#
no cdp run
!
int f0/0
  no keepalive

Let’s do debug priority

R1(config-if)#do debug priority

Let’s test ping. It shoul go to normal priority

R1(config-if)#do ping 2.2.2.2 sour 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/40/56 ms
R1(config-if)#
*Mar  1 00:21:23.923: PQ: FastEthernet0/0: ip (s=1.1.1.1, d=2.2.2.2) -> normal
*Mar  1 00:21:23.923: PQ: FastEthernet0/0 output (Pk size/Q 114/2)
*Mar  1 00:21:23.979: PQ: FastEthernet0/0: ip (s=1.1.1.1, d=2.2.2.2) -> normal
*Mar  1 00:21:23.979: PQ: FastEthernet0/0 output (Pk size/Q 114/2)
*Mar  1 00:21:24.019: PQ: FastEthernet0/0: ip (s=1.1.1.1, d=2.2.2.2) -> normal
*Mar  1 00:21:24.019: PQ: FastEthernet0/0 output (Pk size/Q 114/2)
*Mar  1 00:21:24.051: PQ: FastEthernet0/0: ip (s=1.1.1.1, d=2.2.2.2) -> normal
*Mar  1 00:21:24.055: PQ: FastEthernet0/0 output (Pk size/Q 114/2)
*Mar  1 00:21:24.099: PQ: FastEthernet0/0: ip (s=1.1.1.1, d=2.2.2.2) -> normal
R1(config-if)#
*Mar  1 00:21:24.099: PQ: FastEthernet0/0 output (Pk size/Q 114/2)

Let’s do telnet. It should go to high priority

R1(config-if)#do telnet 2.2.2.2
Trying 2.2.2.2 ... Open

*Mar  1 00:23:57.191: PQ: FastEthernet0/0: ip (tcp 23) -> high
*Mar  1 00:23:57.195: PQ: FastEthernet0/0 output (Pk size/Q 60/0)
*Mar  1 00:23:57.275: PQ: FastEthernet0/0: ip (tcp 23) -> high
*Mar  1 00:23:57.275: PQ: FastEthernet0/0 output (Pk size/Q 60/0)
*Mar  1 00:23:57.279: PQ: FastEthernet0/0: ip (tcp 23) -> high
*Mar  1 00:23:57.283: PQ: FastEthernet0/0 output (Pk size/Q 63/0)
*Mar  1 00:23:57.287: PQ: FastEthernet0/0: ip (tcp 23) -> high
*Mar  1 00:23:57.287: PQ: FastEthernet0/0 output (Pk size/Q 60/0)

Lab 1. QOS - Match IP Precedence


QOS is my weakness I guess :( Maybe because I never do all labs. So let’s study QoS…
For more summary about QoS please refer to http://pursuingmydestiny.blogspot.com/2011/12/qos-summary.html.

What is IP Precedence??? Please have a look again my QoS summary that may help you.
Now let’s do lab to match IP Precedence…

R1#
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0

R2#
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0

As you know, there are 3 step in creating QoS using MQC:
  1. Configure class-map
  2. Configure policy-map
  3. Then assign the QoS in interface by using service-policy
Let’s create class-map for classification:

R1#
class-map match-all QOS7
 match ip precedence 7

class-map match-all QOS6
 match ip precedence 6

class-map match-all QOS5
 match ip precedence 5

class-map match-all QOS4
 match ip precedence 4

class-map match-all QOS3
 match ip precedence 3

class-map match-all QOS2
 match ip precedence 2

class-map match-all QOS1
 match ip precedence 1

class-map match-all QOS0
 match ip precedence 0

Then let’s make policy

R1#
policy-map EXCERCISE
 class QOS0
 class QOS1
 class QOS2
 class QOS3
 class QOS4
 class QOS5
 class QOS6
 class QOS7

After that let’s assign the policy to the interface

R1#
interface FastEthernet0/0
service-policy input EXCERCISE

IP Precedence use 8 bit but we use only the first 3 bits of IP TOS field

?
?
?





Note -> IP Precedence begin from 5th bit

Here the mapping from binary to decimal:

Level
Precedence
Binary
Decimal
TOS Level
0
Routine
20
0
0-31
1
Priority
25
32
32-63
2
Immediate
26
64
64-95
3
Flash
26+25
96
96-127
4
Flash override
27
128
128-159
5
Critical
27+25
160
160-191
6
Internetwork control
27+26
192
192-223
7
Network control
27+26+26
224
224-255

Now let’s do test the QoS using ping extended by setting Type of service (TOS).

R2#ping
Protocol [ip]:
Target IP address: 12.12.12.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]: 165
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/30/48 ms

Based on diagram it should be in IP Precedence critical (QOS5). Let’s verify the policy-map in interface fa0/0.

R1(config)#do sh policy-map int f0/0
 FastEthernet0/0

  Service-policy input: EXCERCISE

    Class-map: QOS0 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 0

    Class-map: QOS1 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 1

    Class-map: QOS2 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 2

    Class-map: QOS3 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 3

    Class-map: QOS4 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 4

    Class-map: QOS5 (match-all)
      5 packets, 570 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 5

    Class-map: QOS6 (match-all)
      829 packets, 61362 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 6

    Class-map: QOS7 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 7

    Class-map: class-default (match-any)
      0 packets, 0 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: any

Friday, December 9, 2011

QoS Summary

There are 3 model types of QoS:

  1. Best Effort. It's default. No QoS at all
  2. Integrated Service (IntServ). The service in this type is dedicated so need bandwidth reservation in the path. The protocol used in IntServ is RSVP
  3. Differentiated Service (DiffServ). In the DIffServ various packets can be differentiated. The typical using DiffDerv there are classification and marking and policy for what need to do with the packet.



Layer 2 QoS Marking:

  1. Ethernet. The marking use Class of Service (CoS). It's use 3-bit 802.1p field in 802.1Q header
  2. Frame Relay. The marking use Discard Eligibility (DE), 1-bit drop eligibility flag
  3. ATM. The marking is Cell Loss Priority (CLP), 1-bit drop eligibility flag
  4. MPLS, the marking use Traffic Class (TC), 3-bit field compatibe with 802.1p



Layer 3 QoS Marking:

  1. IP Precedence. The first 3 bits of the IP TOS field. There are 8 IP Precedence but we can only use from IP precedence 0 to 5. IP precedence 0 is best effort and IP precedence 5 is the critical data such as video conference, voice, etc.
  2. Differentiated Service Code Point (DSCP). It use 8 bit which the first 6 bit use for classication. It's backward compatible with IP precedence. There are BE for best effort, CS (Class Selector) which backward-compatible with IP precedence, Assured Forwarding (AF) which have 4 classes with variable drop preferences, and Expedited Forwarding (EF) which use for priority queuing for delay-sensitive traffic.



The default for ethernet (<2Mbps) is FIFO and default for serial is WFQ.