HQoS
From Internetworkpro
Contents |
[edit] Synopsis
When doing QoS on a interface that's connected to a device that's restricted downstream, a tiered approach to QoS is necessary to instruct IOS that there is a limit downstream (think of an Ethernet segment that's connecting to a modem or T1 mux). Since IOS sees the Ethernet segment is a 100MB interface, QoS doesn't engage before your downstream bandwidth is used up, making it in effective.
To set this up, you need 2 policy-maps: one that prioritizes your traffic normally (a standard looking policy-map), and a second "parent" policy-map that sets an artificial backpressure limit on the interface so QoS engages at the right time.
[edit] Example
A HQoS policy-map applied to an interface, shaping traffic down to 1.5M (T1 speed):
class-map match-all voice-sig
match protocol sip
class-map match-all voice-rtp
match protocol rtp
!
!
policy-map PrioritizeVoice
class voice-rtp
priority percent 33
class voice-sig
priority percent 20
class class-default
policy-map Shaper1.5M
class class-default
shape average 1500000
service-policy PrioritizeVoice
!
!
interface FastEthernet0/1
description EthernetSegment-ToMux
ip address 10.254.254.1 255.255.255.252
load-interval 30
speed 100
full-duplex
service-policy output Shaper1.5M
!
This configuration will shape traffic down to 1500000 bits (1.5Mb) first, then apply the second/child policy-map and queue accordingly.
[edit] HQF / IOS 12.4(20)T Caveats
IOS versions with the new "HQF" framework (IOS 12.4(20)T train and above) may not choose the correct Bc and Be values for your shaping, thus causing bottlenecks with your traffic.
Example:
C1841-Lab01#sh ver | inc IOS
Cisco IOS Software, 1841 Software (C1841-IPBASEK9-M), Version 12.4(24)T2, RELEASE SOFTWARE (fc2)
C1841-Lab01#sh policy-map int fa0/1
FastEthernet0/1
Service-policy output: Shaper1.5M
Class-map: class-default (match-any)
226 packets, 95388 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 226/95388
shape (average) cir 1500000, bc 6000, be 6000
target shape rate 1500000
Service-policy : PrioritizeVoice
queue stats for all priority classes:
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 12/6087
Class-map: voice-rtp (match-all)
0 packets, 0 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: protocol rtp
Priority: 33% (495 kbps), burst bytes 12350, b/w exceed drops: 0
Class-map: voice-sig (match-all)
12 packets, 6087 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: protocol sip
Priority: 20% (300 kbps), burst bytes 7500, b/w exceed drops: 0
Class-map: class-default (match-any)
214 packets, 89301 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 214/89301
C1841-Lab01#
In our example, the Bc and Be values (sustained bits per interval and excess bits per interval) are set to 6k. This is what IOS chose for us from our command "shape average 1500000". These values are insufficient for 1.5M service, and will throttle us around 450-500kbps on the circuit. These values in this case must be manually increased to get the bandwidth we're looking for.
Using the values that IOS 12.4(25c) mainline generates (which are 36000 for each), we can specify these in the policy-map:
C1841-Lab01#conf t
Enter configuration commands, one per line. End with CNTL/Z.
C1841-Lab01(config)#policy-map Shaper1.5M
C1841-Lab01(config-pmap)#class class-default
C1841-Lab01(config-pmap-c)#shape average 1500000 ?
WORD bits per interval, sustained. Recommend not to configure it, the
algorithm will find out the best value
<cr>
C1841-Lab01(config-pmap-c)#shape average 1500000 36000 ?
WORD bits per interval, excess.
<cr>
C1841-Lab01(config-pmap-c)#shape average 1500000 36000 36000
C1841-Lab01(config-pmap-c)#end
C1841-Lab01#
*Mar 10 05:46:01.192: %SYS-5-CONFIG_I: Configured from console by console
C1841-Lab01#sh policy-map int fa0/1
FastEthernet0/1
Service-policy output: Shaper1.5M
Class-map: class-default (match-any)
360 packets, 123065 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 360/123065
shape (average) cir 1500000, bc 36000, be 36000
target shape rate 1500000
Service-policy : PrioritizeVoice
queue stats for all priority classes:
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 1/228
Class-map: voice-rtp (match-all)
1 packets, 228 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: protocol rtp
Priority: 33% (495 kbps), burst bytes 12350, b/w exceed drops: 0
Class-map: voice-sig (match-all)
24 packets, 13065 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: protocol sip
Priority: 20% (300 kbps), burst bytes 7500, b/w exceed drops: 0
Class-map: class-default (match-any)
335 packets, 109772 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 335/109772
C1841-Lab01#
You may need to play with the values to get the speeds you're looking for. This example was based off of the values chosen by IOS 12.4(25c) mainline, and worked in this case for this speed.
[edit] Possible Caveats?
An additional issue that may be worth noting - when a heavy traffic stream starts, if the queue-limit is exceeded while the shaper is trying to shape your traffic down to your configured rate, you may occasionally see drops in the parent/top class-default queue where your traffic is being shaped, before your traffic gets down to the child/secondary queue where the actual prioritization occurs. If your traffic that you're trying to prioritize is mission-critical traffic (e.g: VoIP), there is the chance that you may experience drops in the parent class-default.
A potential workaround is using precedence and random-detect queueing. With random-detect queueing, you'll now get 8 precedence-based queues in the class-default queue, and IOS *should* drop traffic from queue 0 (best effort) before it drops your higher-marked traffic, if you can mark it before it gets there. You may not drop any traffic at all, or you may see short bursts of drops as streams start (I saw the latter in the lab), but this may be a workaround for it.
C1841-Lab01# conf t
Enter configuration commands, one per line. End with CNTL/Z.
C1841-Lab01(config)#policy-map Shaper1.5M
C1841-Lab01(config-pmap)#class class-default
C1841-Lab01(config-pmap-c)#random-detect
C1841-Lab01(config-pmap-c)#end
*Mar 10 05:58:31.780: %SYS-5-CONFIG_I: Configured from console by console
C1841-Lab01#sh policy-map interface fastEthernet 0/1
FastEthernet0/1
Service-policy output: Shaper1.5M
Class-map: class-default (match-any)
908 packets, 367697 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 908/367697
shape (average) cir 1500000, bc 36000, be 36000
target shape rate 1500000
Exp-weight-constant: 9 (1/512)
Mean queue depth: 0 packets
class Transmitted Random drop Tail drop Minimum Maximum Mark
pkts/bytes pkts/bytes pkts/bytes thresh thresh prob
0 142/60129 0/0 0/0 20 40 1/10
1 0/0 0/0 0/0 22 40 1/10
2 0/0 0/0 0/0 24 40 1/10
3 0/0 0/0 0/0 26 40 1/10
4 0/0 0/0 0/0 28 40 1/10
5 3/1233 0/0 0/0 30 40 1/10
6 0/0 0/0 0/0 32 40 1/10
7 0/0 0/0 0/0 34 40 1/10
Service-policy : PrioritizeVoice
queue stats for all priority classes:
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 3/890
Class-map: voice-rtp (match-all)
3 packets, 890 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: protocol rtp
Priority: 33% (495 kbps), burst bytes 12350, b/w exceed drops: 0
Class-map: voice-sig (match-all)
60 packets, 32686 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: protocol sip
Priority: 20% (300 kbps), burst bytes 7500, b/w exceed drops: 0
Class-map: class-default (match-any)
845 packets, 334121 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 845/334121
C1841-Lab01#
[edit] References
QoS Guide - HQF/Hierarchical Queueing Framework (IOS 12.4(20)T+)

