Shaping Terminology
Routers can accelerate $.25 out an interface alone at the concrete alarm rate. To boilerplate sending at a lower
rate, the router has to alternating amid sending packets and actuality silent. For instance, to average
sending at a packet bulk of bisected the concrete articulation speed, the router should accelerate packets bisected of the
time, and not accelerate packets the added bisected of the time. Over time, it looks like a staccato alternation of
sending and silence. Figure 14-1 shows a blueprint of what happens back a router has a articulation with a
clock bulk of 128 kbps and a shaper configured to appearance cartage to 64 kbps.
Figure 14-1 shows the sending bulk and implies absolutely a bit about how Cisco IOS implements
shaping. A shaper sets a changeless time interval, alleged Tc. Then, it calculates the cardinal of $.25 that
can be beatific in the Tc breach such that, over time, the cardinal of bits/second beatific matches the
shaping rate.
474 Affiliate 14: Abstraction and Policing
Figure 14-1 Mechanics of Cartage Shaping—128-kbps Admission Rate, 64-kbps Shaped Rate
The cardinal of $.25 that can be beatific in anniversary Tc is alleged the committed admission (Bc). In Figure 14-1,
an 8000-bit Bc can be beatific in every 125-ms Tc to accomplish a 64-kbps boilerplate rate. In added words,
with a Tc of 125 ms, there will be eight Tc intervals per second. If Bc $.25 (8000) are beatific anniversary Tc,
then eight sets of 8000 $.25 will be beatific anniversary second, consistent in a bulk of 64,000 bps.
Because the $.25 charge be encoded on the articulation at the alarm rate, the 8000 $.25 in anniversary breach require
only 62.5 ms (8000/128,000) to avenue the interface assimilate the link. The blueprint shows the results: the
interface sends at the band bulk (access rate) for 62.5 ms, and afresh waits for 62.5 ms, while packets
sit in the abstraction queue.
Table 14-2 lists the analogue accompanying to this abstraction model. Agenda in accurate that the appellation CIR
refers to the cartage bulk for a VC based on a business contract, and abstraction bulk refers to the rate
configured for a shaper on a router.
Table 14-2 Abstraction Terminology
Term Definition
Tc Time interval, abstinent in milliseconds, over which the committed admission (Bc) can be
sent. With abounding abstraction tools, Tc = Bc/CIR.
Bc Committed admission size, abstinent in bits. This is the bulk of cartage that can be sent
during the Tc interval. About authentic in the cartage contract.
CIR Committed advice rate, in $.25 per second, which defines the bulk of a VC according
to the business contract.
Shaped
rate
The rate, in $.25 per second, to which a accurate agreement wants to appearance the traffic.
It may or may not be set to the CIR.
Be Balance admission size, in bits. This is the cardinal of $.25 above Bc that can be beatific afterwards a
period of inactivity.
Sending Rate
Time
(Ms)
128 kbps
0 kbps
0 125 250 375 500 625 750 875 1000
Send packets for 62.5 ms per Breach (1/2 the time) in Adjustment to Boilerplate 64 kbps
So Bc = 8000 $.25 (1000 bytes)
Traffic-Shaping Concepts 475
Shaping with an Balance Burst
To board bursty abstracts traffic, shapers apparatus a abstraction by which, afterwards a aeon in
which an interface sends almost little abstracts compared to its CIR, added than Bc $.25 can be sent
in one or added time intervals. This abstraction is alleged balance admission (Be). Back application a Be, the shaper
can allow, in accession to the Bc $.25 per Tc, Be added $.25 to be sent. Depending on the settings,
it may booty one time breach to accelerate the added bits, or it may crave assorted time intervals.
Figure 14-2 shows a blueprint of the aforementioned archetype in Figure 14-1, but with a Be additionally according to 8000 bits.
In this case, the Be added $.25 are all beatific in the aboriginal time breach afterwards the about inactivity.
Figure 14-2 Bc and Be, Afterwards a Aeon of Inactivity
In the aboriginal interval, cartage abstraction can accelerate a absolute of 16,000 $.25 (Bc + Be bits). On a 128-kbps
link, bold a 125-ms Tc, all 125 ms is adapted to accelerate 16,000 bits. In this accurate case, after
a aeon of inactivity, R1 sends continuously for the absolute aboriginal interval. In the additional interval,
the shaper allows the accepted Bc $.25 to be sent. In effect, with these settings, the shaper allows
192.5 ms of afterwards sending afterwards a aeon of low activity.
Underlying Mechanics of Shaping
Shapers administer a simple blueprint to the Tc, Bc, and abstraction bulk parameters:
Tc = Bc/shaping rate
For example, in Figures 14-1 and 14-2, if the abstraction bulk (64 kbps) and the Bc (8000 bits) were
both configured, the shaper would afresh account the Tc as 8000/64,000 = 0.125 seconds.
Alternatively, if the bulk and Tc had been configured, the shaper would accept affected Bc as Bc =
rate * Tc (a simple ancestry of the blueprint listed earlier), or 64 kbps * 0.125 ms = 8000 bits.
(Both CB Abstraction and FRTS use absence ethics in some cases, as declared in the configuration
sections of this chapter.)
Sending Rate
Time
(Ms)
128 kbps
0 kbps
0 125 250 375 500 625 750 875 1000
Bc = 8000, Be = 8000
Send 16,000 $.25 in aboriginal interval
Bc = 8000, Be = 0
Send 16,000 $.25 in each
interval, until Be can
accumulate
Period of cessation — Be
re-fills in 1 distinct totally
dormant Tc in this example
476 Affiliate 14: Abstraction and Policing
Traffic abstraction uses a badge brazier archetypal to administer the abstraction process. First, accede the case
in which the shaper is not application Be. Imagine a brazier of admeasurement Bc, with the brazier abounding with tokens
at the alpha of anniversary Tc. Anniversary badge lets the shaper buy the adapted to accelerate 1 bit. So, at the
beginning of anniversary Tc, the shaper has the adeptness to absolution Bc account of bits.
Shapers accomplish two capital accomplishments accompanying to the bucket:
1. Refill the brazier with new tokens at the alpha of anniversary Tc.
2. Spend tokens to accretion the adapted to advanced packets.
Step 1 describes how the brazier is abounding with Bc tokens to alpha anniversary interval. Figure 14-3 shows
a beheld representation of the process. Agenda that if some of the tokens from the antecedent time
interval are still in the bucket, some of the new tokens discharge over the ancillary of the brazier and are
wasted.
Figure 14-3 Mechanics of Filling the Abstraction Badge Bucket
Step 2 describes how the shaper spends the tokens. The shaper has to booty tokens from the bucket
equal to the cardinal of $.25 in a packet in adjustment to absolution that packet for transmission. For example,
if the packet is 1000 $.25 long, the shaper charge abolish 1000 tokens from the brazier to accelerate that
packet. Back cartage abstraction tries to accelerate a packet, and the brazier does not accept abundant tokens in
it to buy the adapted to accelerate the packet, cartage abstraction charge delay until the abutting interval, back the
token brazier is refilled.
Traffic abstraction accouterments Be by authoritative the distinct badge brazier bigger, with no added changes
to the token-bucket model. In added words, alone Bc tokens are added anniversary Tc, and tokens charge still
be captivated in adjustment to accelerate packets. The key aberration application Be (versus not application Be) is that
when some of the tokens are larboard in the brazier at the end of the time interval, and Bc tokens are
added at the alpha of the abutting interval, added than Bc tokens are in the bucket—therefore
allowing a beyond admission of $.25 in this new interval.
Bucket1
Size: Bc
Spillage
Wasted $.25
Token
Token Generator:
Shapter Creates New Tokens,
Refills with Bc Tokens Every Tc
$.25
Token
$.25
Token
$.25
Token
$.25
Token
$.25
Token
$.25
Token
Class-Based Abstraction Agreement 477
Traffic-Shaping Adaptation on Anatomy Relay Networks
A shaper acclimated with Anatomy Relay can be configured to alter the abstraction bulk over time based on the
presence or absence of congestion. Back there is no congestion, the shaper uses the abstraction rate,
but back bottleneck occurs, it lowers the abstraction rate, eventually extensive a minimum shaping
rate. The minimum bulk can be configured, or absence to 50 percent of the abstraction rate. This lower
rate is about alleged either the minimum advice bulk (MIR) or the mincir.
To lower the rate, shapers charge apprehension bottleneck via one of two methods:
■ Receipt of a anatomy with the Backward Explicit Bottleneck Notification (BECN) bit set
■ Receipt of a Cisco-proprietary ForeSight bottleneck message
Each time a BECN or ForeSight bulletin is received, the shaper slows bottomward by 25 percent of
the best rate. To apathetic down, CB Abstraction artlessly decreases Bc and Be by 25 percent,
keeping the Tc amount the same. If added BECNs or ForeSight letters are received, the Bc and
Be settings are ratcheted bottomward accession 25 percent, until they basal out at ethics that match
the mincir. The bulk grows afresh afterwards 16 afterwards Tc ethics afterwards a BECN or ForeSight
congestion message. At that point, the abstraction bulk grows by of the abstraction bulk during each
Tc, in this case by accretion the absolute Bc and Be ethics used, until the best bulk is
reached again.
Class-Based Abstraction Configuration
Class-Based Abstraction (CB Shaping) accouterments all the amount concepts declared so far in this
chapter, additional several added important features. First, it allows for several Cisco IOS queuing
tools to be activated to the packets delayed by the abstraction process. At the aforementioned time, it allows
for adorned queuing accoutrement to be acclimated on the interface software queues. It additionally allows for
classification of packets, so that some types of packets can be shaped at one rate, a additional type
of packet can be shaped at accession rate, while acceptance a third chic of packets to not be shaped
at all.
The alone new MQC command adapted to configure CB Abstraction is the appearance command. The
“Foundation Summary” area provides a CB Abstraction command reference, in Table 14-9:
shape [average | peak] mean-rate [[burst-size] [excess-burst-size]]
CB Abstraction can be implemented for achievement packets only, and it can be associated with either a
physical interface or a subinterface.
To accredit CB Shaping, the service-policy achievement command is configured beneath either the
interface or the subinterface, with the referenced action map including the appearance command.
1
16
-------
478 Affiliate 14: Abstraction and Policing
Example 14-1 shows a simple CB Abstraction agreement that uses the afterward criteria:
■ Interface alarm bulk is 128 kbps.
■ Appearance all cartage at a 64-kbps rate.
■ Use the absence ambience for Tc.
■ Appearance cartage departure subinterface s0/0.1.
■ The software queuing on s0/0 will use WFQ (the default).
■ The abstraction chain will use FIFO (the default).
Example 14-1 CB Abstraction of All Cartage Departure S0/0.1 at 64 kbps
! Action map shape-all places all cartage into the class-default class, matching
! all packets. All packets will be shaped to an boilerplate of 64 kbps. Agenda the
! units are in bits/second, so 64000 agency 64 kbps.
policy-map shape-all
class class-default
shape boilerplate 64000
! The concrete interface will not appearance the fair-queue command, but it is
! configured by default, implementing WFQ for interface s0/0 software queuing.
interface serial0/0
bandwidth 128
! Below, CB Abstraction has been enabled for all packets forwarded out s0/0.1.
interface serial0/0.1
service-policy achievement shape-all
! Refer to the argument afterwards this archetype for added explanations of this abutting command.
R3# appearance policy-map interface s0/0.1
Serial0/0.1
Service-policy output: shape-all
Class-map: class-default (match-any)
7718 packets, 837830 bytes
30 additional offered bulk 69000 bps, bead bulk 5000 bps
Match: any
Traffic Shaping
Target/Average Byte Sustain Balance Breach Increment
Rate Limit bits/int bits/int (ms) (bytes)
64000/64000 2000 8000 8000 125 1000
Adapt Chain Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
— 56 6393 692696 6335 684964 yes
Class-Based Abstraction Agreement 479
The agreement itself is almost straightforward. The shape-all action map matches all
packets in a distinct chic (class-default) and is enabled on s0/0.1. So, all packets departure s0/0.1 will
be shaped to the authentic bulk of 64 kbps.
The achievement of the appearance policy-map interface s0/0.1 command shows the settings for all the
familiar abstraction concepts, but it uses hardly altered terminology. CB Abstraction defaults to a Bc
and Be of 8000 $.25 each, listed beneath the columns Sustain bits/int (with “int” acceptation “interval,”
or Tc) and Balance bits/int, respectively. The branch Byte Limit represents the admeasurement of the token
bucket—the sum of Bc and Be, but listed as a cardinal of bytes (2000 bytes in this case) instead of
bits. The aftermost cavalcade in that aforementioned allotment of the command output, Increment (bytes), indicates how
many bytes’ account of tokens are replenished anniversary Tc. This amount is according to Bc (8000 bits), but the
output is listed as a cardinal of bytes (1000 bytes).
The CB Abstraction appearance command requires the abstraction bulk to be set. However, Bc and Be can be
omitted, and Tc cannot be set directly. As a result, CB Abstraction calculates some or all of these
settings. CB Abstraction calculates the ethics abnormally based on whether the abstraction bulk exceeds
320 kbps. Table 14-3 summarizes the rules.
Tuning Abstraction for Articulation Application LLQ and a Baby Tc
Example 14-1 in the antecedent area shows absence settings for queuing for the interface software
queues (WFQ) and for the abstraction chain (FIFO). Archetype 14-2 shows an addition configuration
that works bigger for articulation cartage by application LLQ for the shaped traffic. Also, the configuration
forces the Tc bottomward to 10 ms, which agency that anniversary packet will acquaintance alone a abbreviate delay
waiting for the alpha of the abutting Tc. By befitting Tc to a baby value, the LLQ argumentation activated to
the shaped packets does not accept to delay about as continued to absolution packets from the PQ, as
compared with the absence Tc settings.
The revised requirements, as compared with Archetype 14-1, are as follows:
■ Accredit LLQ to abutment a distinct G.729 articulation call.
■ Appearance to 96 kbps—less than the alarm bulk (128 kbps), but added than the CIR of the VC.
■ Tune Tc to 10 ms.
Table 14-3 CB Abstraction Calculation of Absence Variable Settings
Variable Bulk <= 320 kbps Bulk > 320 kbps
Bc 8000 $.25 Bc = abstraction bulk * Tc
Be Be = Bc = 8000 Be = Bc
Tc Tc = Bc/shaping bulk 25 ms
480 Affiliate 14: Abstraction and Policing
Example 14-2 CB Abstraction on R3, 96-kbps Appearance Rate, with LLQ for Abstraction Queues
class-map match-all voip-rtp
match ip rtp 16384 16383
! queue-voip accouterments a PQ for VoIP traffic, and uses WFQ in the absence class.
policy-map queue-voip
class voip-rtp
priority 32
class class-default
fair-queue
! shape-all shapes all cartage to 96 kbps, with Bc of 960. Tc is affected as
! 960/96000 or 10 ms. Additionally agenda the service-policy queue-voip command. This applies
! action map queue-voip to all packets shaped by the appearance command.
policy-map shape-all
class class-default
shape boilerplate 96000 960
service-policy queue-voip
!
interface serial0/0.1
service-policy achievement shape-all
! Agenda the Breach is now listed as 10 ms. Also, agenda the abundant stats for LLQ
! are additionally listed at the end of the command.
R3# appearance policy-map interface consecutive 0/0.1
Serial0/0.1
Service-policy output: shape-all
Class-map: class-default (match-any)
5189 packets, 927835 bytes
30 additional offered bulk 91000 bps, bead bulk 0 bps
Match: any
Traffic Shaping
Target/Average Byte Sustain Balance Breach Increment
Rate Limit bits/int bits/int (ms) (bytes)
96000/96000 1200 960 960 10 120
Adapt Chain Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
— 17 5172 910975 4002 831630 yes
Service-policy : queue-voip
Class-map: voip-rtp (match-all)
4623 packets, 295872 bytes
30 additional offered bulk 25000 bps, bead bulk 0 bps
Match: ip rtp 16384 16383
Weighted Fair Queueing
Strict Priority
Output Queue: Conversation 24
Bandwidth 32 (kbps) Admission 800 (Bytes)
Class-Based Abstraction Agreement 481
Example 14-2 shows how to use LLQ adjoin the packets shaped by CB Abstraction by calling an
LLQ action map with the service-policy command. Agenda the command syntax (service-policy
queue-voip) does not accommodate the achievement keyword; the achievement administration is implied. Figure 14-4
shows the accepted abstraction abaft what is accident in the configuration.
Figure 14-4 Interaction Amid Abstraction Action Map shape-all and Queuing Action Map queue-voip
Scanning Figure 14-4 from larboard to right, CB Abstraction charge accomplish the aboriginal accommodation afterwards a packet has
been baffled out the subinterface. CB Abstraction aboriginal needs to adjudge if abstraction is active; if it is, CB
Shaping should put the packet into a abstraction queue. If it is not active, the packet can move adapted on
to the adapted interface software queue. Abstraction becomes alive back a distinct packet exceeds
the cartage contract; abstraction alone becomes abeyant afresh back all the abstraction queues are drained.
Assuming that a packet needs to be delayed by CB Shaping, the LLQ argumentation of policy-map
queue-voip determines into which of the two abstraction queues the packet should be placed. Later,
when CB Abstraction decides to absolution the abutting packet (typically back the abutting Tc begins), LLQ
(pkts matched/bytes matched) 3528/225792
(total drops/bytes drops) 0/0
Class-map: class-default (match-any)
566 packets, 631963 bytes
30 additional offered bulk 65000 bps, bead bulk 0 bps
Match: any
Weighted Fair Queueing
Flow Based Fair Queueing
Maximum Cardinal of Hashed Queues 16
(total queued/total drops/no-buffer drops) 17/0/0
Example 14-2 CB Abstraction on R3, 96-kbps Appearance Rate, with LLQ for Abstraction Queues (Continued)
Voice Payload –
Class voip-rtp
LLQ of 32 kbps
All Added cartage –
class class-default
WFQ All Other
Traffic
Hardware
Queue
Interface
Software Chain AR 128 kbps
Packet
Routed
Out This
Interface :
No
Yes
Drain at 96
kbps
Defined by policy-map queue-voip
Defined by policymap
shape-all
Shaping
Active?
Toggles Based on
Rules Apparent in
the Text
Bit Rate
Limit
x bps
Slow Down
Bit Rate
Limit
x bps
Slow Down
482 Affiliate 14: Abstraction and Policing
determines which packets are taken next. This archetype has alone two queues, one of which is an
LLQ, so packets are consistently taken from the LLQ if any are present in that queue.
When a packet leaves one of the two abstraction queues, it drains into the interface software queues. For
routers with abounding VCs on the aforementioned concrete interface, the VCs attempt for the accessible interface
bandwidth. Examples 14-1 and 14-2 both defaulted to use WFQ on the interface. However, LLQ or
CBWFQ could accept been acclimated on the interface in accession to its use on the abstraction function, simply
by abacus a service-policy achievement policy-map-name command beneath s0/0.
Configuring Abstraction by Bandwidth Percent
The appearance command allows the abstraction bulk to be declared as a allotment of the ambience of the interface
or subinterface bandwidth setting. Configuring based on a simple allotment of the bandwidth
command ambience seems accessible at first. However, you should accumulate in apperception the afterward facts when
configuring the appearance command based on allotment of interface bandwidth:
■ The appearance percent command uses the bandwidth of the interface or subinterface beneath which
it is enabled.
■ Subinterfaces do not accede the bandwidth ambience of the concrete interface, so if it not set via
the bandwidth command, it defaults to 1544.
■ The Bc and Be ethics are configured as a cardinal of milliseconds; the ethics are affected as
the cardinal of $.25 that can be beatific at the configured abstraction rate, in the configured time period.
■ Tc is set to the configured Bc value, which is in milliseconds.
Example 14-3 shows a abrupt archetype of CB Abstraction agreement application percentages, including
explanations of the credibility from the above-mentioned list.
NOTE Back one action map refers to another, as in Archetype 14-2, the configurations are
sometimes alleged “hierarchical” action maps. Added times, they are alleged “nested” action maps.
Or, you can aloof anticipate of it as how CBWFQ and LLQ can be configured for the abstraction queues.
Example 14-3 Abstraction Based on Percent
! With s0/0.1 bandwidth of 128, the bulk is 50% * 128, or 64 kbps. At 64 kbps, 8000
! $.25 can be beatific in the configured 125-ms time breach (64000 * 0.125 = 8000).
! Agenda that the ms constant in the appearance command is adapted afterwards the Bc
! (shown) or Be (not shown), contrarily the command is rejected. Not shown: The
! Tc was set to 125 ms, the exact amount configured for Bc.
policy-map percent-test
class class-default
shape boilerplate percent 50 125 ms
interface Serial0/1
bandwidth 128
service-policy achievement percent-test