Here is my topology:
R1----R3----[LAN with R4 and R5]
R4 and R5 are sending traffic to R1's loopback 1.1.1.1
R3 has the following configuration:
! ACLs to match R4 and R5:
!
access-list 4 permit 172.12.34.4
access-list 5 permit 172.12.34.5
!
! Classes that match R4 and R5:
!
class-map match-all R4
match access-group 4
class-map match-all R5
match access-group 5
!
! Policy that uses "peak" for R5, "average" for R4
!
policy-map SHAPER
class R5
bandwidth 100
shape peak 128000
class R4
bandwidth 100
shape average 128000
!
! Policy applied outbound toward R1
!
interface FastEthernet0/0
ip address 172.12.123.3 255.255.255.0
load-interval 30
speed 100
full-duplex
service-policy output SHAPER
This has been running for about 10-15 minutes. R4 seems to be shaped as normal around 128k. R5 though is hitting 180k.
R3#show policy-map interface
FastEthernet0/0
Service-policy output: SHAPER
Class-map: R5 (match-all)
14826 packets, 20963964 bytes
30 second offered rate 181000 bps, drop rate 0 bps
Match: access-group 5
Queueing
Output Queue: Conversation 265
Bandwidth 100 (kbps)Max Threshold 64 (packets)
(pkts matched/bytes matched) 833/1177862
(depth/total drops/no-buffer drops) 0/0/0
Traffic Shaping
Target/Average Byte Sustain Excess Interval Increment
Rate Limit bits/int bits/int (ms) (bytes)
256000/128000 1984 7936 7936 62 1984
Adapt Queue Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
- 0 14826 20963964 831 1175034 no
Class-map: R4 (match-all)
10214 packets, 14442596 bytes
30 second offered rate 124000 bps, drop rate 0 bps
Match: access-group 4
Queueing
Output Queue: Conversation 266
Bandwidth 100 (kbps)Max Threshold 64 (packets)
(pkts matched/bytes matched) 5221/7382494
(depth/total drops/no-buffer drops) 0/0/0
Traffic Shaping
Target/Average Byte Sustain Excess Interval Increment
Rate Limit bits/int bits/int (ms) (bytes)
128000/128000 1984 7936 7936 62 992
Adapt Queue Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
- 1 10213 14441182 5221 7382494 yes
Class-map: class-default (match-any)
226 packets, 22043 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
But if you look in the output above you can see that the Target/Average rate for R5 is set to 256000/128000. Nowhere did I specify 256000. By using shape peak 128000, this was configured for me. What's more is that my traffic rate never reaches 256000. This is because there is congestion on the interface and R4 is also sending traffic. If I stop R4 from sending this is what I will have:
R3#show policy-map interface
FastEthernet0/0
Service-policy output: SHAPER
Class-map: R5 (match-all)
23779 packets, 33623506 bytes
30 second offered rate 241000 bps, drop rate 0 bps
Match: access-group 5
Queueing
Output Queue: Conversation 265
Bandwidth 100 (kbps)Max Threshold 64 (packets)
(pkts matched/bytes matched) 2859/4042626
(depth/total drops/no-buffer drops) 0/0/0
Traffic Shaping
Target/Average Byte Sustain Excess Interval Increment
Rate Limit bits/int bits/int (ms) (bytes)
256000/128000 1984 7936 7936 62 1984
Adapt Queue Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
- 0 23779 33623506 2853 4034142 yes
Class-map: R4 (match-all)
12499 packets, 17673586 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: access-group 4
Queueing
Output Queue: Conversation 266
Bandwidth 100 (kbps)Max Threshold 64 (packets)
(pkts matched/bytes matched) 6393/9039702
(depth/total drops/no-buffer drops) 0/0/0
Traffic Shaping
Target/Average Byte Sustain Excess Interval Increment
Rate Limit bits/int bits/int (ms) (bytes)
128000/128000 1984 7936 7936 62 992
Adapt Queue Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
- 0 12499 17673586 6392 9038288 no
Class-map: class-default (match-any)
328 packets, 32056 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any
I never quite reach 256000, but I am getting close and hover around 241000 to 246000 consistently.
Still researching why the target rate is 256000...if anyone knows, please leave comment!
* * * * * U P D A T E ! ! ! * * * * *
This is a flash update, I think I have a better understanding of this now. For some reason I was thinking the values after "peak" was different than the value after "average". They are both CIR! This will always be the "average rate". You target rate will be set using default values if you do not specify a Be. And it appears Be = Bc by default.
R3(config-pmap-c)#shape ?
average configure token bucket: CIR (bps) [Bc (bits) [Be (bits)]], send out Bc only per interval
peak configure token bucket: CIR (bps) [Bc (bits) [Be (bits)]], send out Bc+Be per interval
So if you want a peak rate of 512000, there are multiple things you can configure since you are sending Bc+Be every interval. In fact you can:
1) set peak to 512000, Bc to 5120, Be of 0
2) set peak to 384000, Bc to 3840, Be to 1280
3) set peak to 256000, Bc to 2560, Be to 2560
All of these (and many more combinations) set target rate to 512000.
Saturday, November 22, 2008
Subscribe to:
Post Comments (Atom)
Hello
ReplyDeleteI think there may be a mistake on the Bc & Be calculation:
As rate is >320bps Default interval (Tc) is 25ms not 10ms so Bc and be sould be
1) set peak to 512000, Bc to 512000*0,25=12800, Be of 0
2) set peak to 384000, Bc to 384000*0,25, Be to 128000*0,25
etc...
Thanks for your usefull blog
Hi, I am not sure I follow you. We are manually setting the Bc here, so the Tc is set 10ms.
ReplyDeleteR2(config-pmap-c)#shape peak 512000 5120 0
This will also give a target rate of 512000.
R2(config-pmap-c)#shape peak 384000 3840 1280
This will give you a target rate of 512000, however your average rate will be 384000.
Do you see what I mean?
Ok, that's clear.
ReplyDeleteMy mistake was that for me Tc was a fixed value but fixing Bc and mean rate fix the Tc value with the formula :
mean rate = Bc/Tc
So in your case 10ms.
Thanks