From: Sila Moni (silamoni@yahoo.com)
Date: Fri Jul 01 2005 - 14:40:54 GMT-3
Simon,
Thanks for the example.  This is one of my weakness as
well.  I'm still confused on how you calculate Bc and
Be.  Normally, I would take 64000 * .125 (default 
Tc).  That'll give me 8000.  That is my Bc.  Then, I
divide 8000 by 8 or 1000.  That would be my Bc.  
1. Is that how the arithmetic being done?  Please
correct me if I am wrong.
2. How do you determine how many interval to police or
shape?
Lets say you're asked to police 2Mb on r1e0.  Based on
what I learn here, I would do the following.
class-map R1E0
 match input-interface e0
!
policy-map RATE-LIMIT
 bandwidth 2000  <-- need this or fair-queue
 random-detect
 police 2000000 250000 31250 conform-action transmit \
                    exceed-action drop
!
int e0
 service-policy output RATE-LIMIT
TIA
Sila
--- SIMON HART <simon.hart@btinternet.com> wrote:
> Hi Gladston,
> 
> CB Policing without violate action is valid.  Your
> configs below, however, do not make a great deal of
> sense.  I shall try and explain.
> 
> Police cir 64000 bc 8000 be 1000
> 
> Now this statement dictates that we can transmit
> conforming bits at a rate of 64000 bits (8000bytes)
> every second.  So our Tc is 1 second.  The statement
> also suggests that during any Tc interval of 1
> second
> we can send an additional 8000 bits (1000bytes), if
> the be bucket has not been used up.
> 
> Now in order to explore this further we need to make
> some assumptions.  Firstly lets assume that the
> packets offered are 1000bytes (8000 bits).
> 
> Therefore for each Tc we can transmit 64000/8000 = 8
> packets that conform.
> 
> We need to determine the actions for conforming and
> non-conforming traffic
> 
> so in your config:
> 
> conform-action transmit
> exceed-action drop
> violate-action drop
> 
> 
> Example 1
> 
> Now look at what happens as packets are offered
> 
> At Tc0
> 
> Bc = 8 packets
> Be = 1 packet
> 
> At Tc1 (end of first period)
> Offered packets 9
> In contract first 8 packets - transmit
> Remaining 1 packet - try and use Be
> Decrement Be by 1 token
> Take action on Be - in this case drop, therefore
> packet is dropped.
> 
> At Tc2
> Offered packets 10
> In contract first 8 packets - transmit
> Remaining 2 packets - try and use Be
> Be = 0
> therefore take Violate action - which is drop
> remaining packets
> 
> At Tc3
> Offered packets 5
> In contract first 5 packets - transmit
> Because Bc has not been fully used (3 tokens spare)
> We can now add 1 token to Be
> 
> At Tc4
> Offered packets 10
> In contract first 8 packets - transmit 
> Remaining 2 packets - try and use Be
> Decrement Be by 1 token
> Take exceed action on Be - in this case drop,
> therefore packet is dropped.
> 1 packet now violates - take violate action -
> therefore drop this packet.
> 
> Hopefully from the above example you can see that Be
> is not really being used for any purpose. This is
> because the Be action is the same as the violate
> action, and hence any non-conforming packets will be
> dropped.
> 
> 
> Example 2
> 
> Now see what happens when we remove the violate
> action
> on the previous example.
> 
> At Tc0
> 
> Bc = 8 packets
> Be = 1 packet
> 
> At Tc1 (end of first period)
> Offered packets 9
> In contract first 8 packets - transmit
> Remaining 1 packet - try and use Be
> Decrement Be by 1 token
> Take action on Be - in this case drop, therefore
> packet is dropped.
> 
> At Tc2
> Offered packets 10
> In contract first 8 packets - transmit
> Remaining 2 packets - try and use Be
> Be = 0
> No violate action - however therefore take Be action
> -
> drop packets
> 
> At Tc3
> Offered packets 5
> In contract first 5 packets - transmit
> Because Bc has not been fully used (3 tokens spare)
> We can now add 1 token to Be
> 
> At Tc4
> Offered packets 10
> In contract first 8 packets - transmit 
> Remaining 2 packets - try and use Be
> Decrement Be by 1 token
> Take exceed  action on Be - in this case drop,
> therefore packet is dropped.
> No violate action, therefore take exceed action -
> which is drop the remaining packet.
> 
> 
> Example 3
> 
> This time we have no violate action and the exceed
> action is set-dscp to af13
> 
> exceed-action set-dscp-transmit af13
> 
> At Tc0
> 
> Bc = 8 packets
> Be = 1 packet
> 
> At Tc1 (end of first period)
> Offered packets 9
> In contract first 8 packets - transmit
> Remaining 1 packet - try and use Be
> Decrement Be by 1 token
> Take action on Be - transmit with dscp of af13
> 
> At Tc2
> Offered packets 10
> In contract first 8 packets - transmit
> Remaining 2 packets - try and use Be
> Be = 0
> No violate action - however therefore take Be action
> -
> transmit with dscp of af13 
> 
> At Tc3
> Offered packets 5
> In contract first 5 packets - transmit
> Because Bc has not been fully used (3 tokens spare)
> We can now add 1 token to Be
> 
> At Tc4
> Offered packets 10
> In contract first 8 packets - transmit 
> Remaining 2 packets - try and use Be
> Decrement Be by 1 token
> Take exceed  action on Be - set dscp of af13
> No violate action, therefore take exceed action -
> which is transmit with dscp of af13
> 
> In this example it should be clear that the class is
> no longer policed as all traffic is transmitted,
> however the out of contract traffic (everything
> above
> cir) will be marked as af13.
> 
> 
> Example 4
> 
> One final example to round this off.
> 
> We shall use an exceed action that sets dscp and a
> violate action that drops packets
> 
> exceed-action set-dscp-transmit af13
> violate-action drop
> 
> At Tc0
> 
> Bc = 8 packets
> Be = 1 packet
> 
> At Tc1 (end of first period)
> Offered packets 9
> In contract first 8 packets - transmit
> Remaining 1 packet - try and use Be
> Decrement Be by 1 token
> Take action on Be - transmit with dscp of af13
> 
> At Tc2
> Offered packets 10
> In contract first 8 packets - transmit
> 
=== message truncated ===
This archive was generated by hypermail 2.1.4 : Sun Sep 04 2005 - 17:00:29 GMT-3