Class of Service
Class of Service
ISP Network
Terminology 3
Each router in the network needs to be configured to support this macro CoS environment.
This generally requires each router to examine the packets that enter it to determine their par-
ticular CoS settings. These settings then dictate which packets are first transmitted to the next
downstream router. In addition, the routers at the edges of the network also may be required
to alter the CoS settings of the packets that enter the network from the customers or peers.
Figure A.2 shows this micro view of the network, where the Sherry router is receiving traffic
from a customer network. As each packet enters the router, Sherry examines its current CoS set-
tings and classifies the traffic into one of the groupings defined by the ISP. This definition allows
Sherry to prioritize its resources for servicing the traffic streams it’s receiving. In addition, Sherry
may alter the CoS settings of the packets to better match the ISP’s traffic groups. When the packets
are received by Chianti, it simply examines the CoS settings, determines the appropriate traffic
group, and processes the packet according to those settings. It then transmits the packets to the
Merlot router, which performs the same actions. The last router in the path, Chardonnay, also
examines the packets and determines the appropriate group. Because it sits at the far end of the
network, the ISP may decide to once again alter the CoS settings of the packets before Chardonnay
transmits them to the neighboring network.
Terminology
As with all networking topics, we have specialized terms that we use to discuss CoS. Some of these
terms are used directly within the JUNOS software, whereas others are referred to by different
names. In this section, we focus solely on the major terminology. We discuss references to specific
JUNOS software nomenclature in the “Class of Service Associations” section later in the chapter.
Classification Classification refers to the examination of an incoming packet. This function
often associates the packet with a particular CoS servicing level.
Behavior aggregate A behavior aggregate (BA) is a method of classification that operates on
a packet as it enters the router. The packet header contents are examined, and this single field
determines the CoS settings applied to the packet.
Multi-field classifier A multi-field (MF) classifier is a second method for classifying traffic
flows. Unlike a behavior aggregate, an MF classifier has the ability to examine multiple fields
in the packet for applying CoS settings. Examples of some fields that an MF classifier may
examine include the source and destination address of the packet as well as the source and des-
tination port numbers of the packet.
4 Bonus A Class of Service
Queuing After a packet is sent to the outgoing interface on a router, it is queued for transmission
on the physical media. The amount of time a packet is queued on the router is determined by the
availability of the outgoing physical media as well as the amount of traffic using the interface.
Scheduling An individual router interface may have multiple queues assigned to store packets. The
router then decides which queue to service based on a particular method of scheduling. This process
often involves a determination of which type of packet should be transmitted before another.
Rewrite Rules A rewrite rule sets the appropriate CoS bits in the outgoing packet. This allows
the next downstream router to classify the packet into the appropriate service group.
Packet Flow
When a packet enters an M-series Juniper Networks router, the Physical Interface Connector
(PIC) receiving the packet retrieves it from the network and verifies that the link-layer infor-
mation is valid. The packet is then passed to the Flexible PIC Concentrator (FPC), where the
data-link and network layer information is verified. In addition, the FPC is responsible for
segmenting the packet into 64-byte J-cells. These cells are then written into packet storage
memory while a notification cell is sent to the route lookup engine. The destination address
listed in the notification cell is located in the forwarding table, and the next hop of the packet
is written into the result cell. This result cell is queued on the appropriate outbound FPC until
the outgoing interface is ready to transmit the packet. The FPC then reads the J-cells out of
memory, reforms the original packet, and sends the packet to the outgoing PIC, where it is
transmitted back into the network.
Please consult the JNCIA Study Guide for complete details on packet flow
within a Juniper Networks router.
Some interface types have the ability to perform token bucket rate limiting on
the PIC itself. In this situation, this algorithm can set the packet’s loss priority bit
before the packet is sent to the Incoming I/O Manager ASIC.
Figure A.3 shows three routers in a sample network supporting CoS. The Chianti router is
transmitting data packets to Chardonnay using Merlot as a transit router. We’ll be configuring
Merlot to support CoS throughout this section.
We can then see these new aliases in the list of defined code points:
Forwarding Classes
We have a second CoS configuration tool that we’ll use in multiple places in our configuration.
The forwarding class is referenced in both a classifier and a rewrite rule. In addition, the for-
warding classes are closely aligned with the operation and definitions of the router’s queues. As
such, their creation within the [edit class-of-service forwarding-classes] allocates
the classes to individual queue numbers on the router’s interfaces:
The show class-of-service classifier command displays the contents of the default
IP precedence classifier. We see that the majority of bit combinations assign packets to the
best-effort forwarding class while assigning a high or low loss priority value:
The administrators of the network in Figure A.3 would like to support the best-effort,
gold, platinum, and network-control traffic classes in their network. These inbound code-
point aliases are correlated with their appropriate forwarding classes and loss priorities in the
newly defined classifier called sample-cos-classifier:
Much like a routing policy, our newly defined classifier must be applied to the appropriate
interfaces before it can perform its functions. After first verifying that the classifier is not oper-
ational, we apply it to the so-0/1/0.0 interface and commit our configuration:
Multi-Field Classifiers
Within the JUNOS software, you utilize the functionality of a firewall filter to implement an MF
classifier. This gives you the ability to use any filter match criteria to locate packets that require
further classification. Once the packets are located, you alter the forwarding class or loss priority
settings by using the action statements of then forwarding-class or then loss-priority,
respectively.
JUNOS Software Implementation 11
In the “Behavior Aggregate Classifiers” section earlier, we created a classifier called sample-
cos-classifier. This classifier assigns all IP packets whose precedence bits arrive as 010 to
the gold forwarding class. However, the network administrators of the network in Figure A.3
would like to ensure that all packets destined for the 10.10.10.0 /24 network are placed into the
platinum forwarding class. This assignment should occur regardless of the received bit values
in the packet. To accomplish this administrative goal, we create a firewall filter called set-FC-
to-gold, which looks like this:
The filter is applied in an inbound direction on the so-0/1/0 interface, which connects to the
Chianti router:
fxp1.0 up up tnp
gre up up
ipip up up
lo0 up up
lo0.0 up up inet
lo0.16383 up up inet
lsi up up
mtun up up
pimd up up
pime up up
tap up up
This now assigns a forwarding class of platinum to all packets that are received on that
interface and are destined for the 10.10.10.0 /24 subnet.
Output Queues
Once the Internet Processor ASIC performs its route lookup, the result cell is passed to the I/O
manager ASIC on the outgoing FPC, where it is queued for transmission on the physical media.
Multiple functions and configuration options are associated with output queuing within the
JUNOS software. These include drop profiles, schedulers, and servicing of the queue itself.
Drop Profiles
A drop profile is the most basic building block of implementing a random early discard (RED)
configuration. Simply put, the drop profile defines parameters that allow the packet to be
dropped from the network. The two main portions of the drop profile are the queue fullness and
the drop probability.
The queue fullness represents a percentage of the memory used to store result cells in relation
to the total amount that has been allocated for that specific queue. Only the result cells sent by
the Internet Processor ASIC are stored in this queue memory. In a similar manner, the drop
probability is a percentage value that correlates to the likelihood that an individual packet is
dropped from the network. These two variables are combined in a graph-like format, which
is represented in Figure A.4.
In Figure A.4, we see both a segmented and an interpolated graph. Although the formation
of these graph lines is quite different, the application of the profile is the same. When a packet
reaches the head of the queue, a random number between 0 and 100 percent is calculated by the
router. This random number is plotted against the drop profile using the current queue fullness
of that particular queue. When the random number falls above the graph line, the packet is
transmitted onto the physical media, but when the number falls below the line, it is dropped
from the network.
JUNOS Software Implementation 13
Segmented Interpolated
100 100
Transmit Transmit
Drop Probability (%)
50 50
25 25
Drop Drop
0 25 50 75 100 0 25 50 75 100
Fullness (%) Fullness (%)
To actually create the profile’s graph line, the router begins at the bottommost corner rep-
resenting a 0 percent fill level and a 0 percent drop probability. It begins drawing a line directly
to the right until it reaches the first defined fill level, 25 percent in our case. The router then con-
tinues the line directly vertical until the first drop probability is reached. This process is repeated
for all of the defined levels and probabilities until the top-right corner of the graph is reached.
This type of profile provides a very rigid graph line.
On the other hand, we also have the ability to create a smoother graph line by configuring
the profile with the interpolate command. This allows the router to automatically generate
64 data points on the graph beginning at (0, 0) and ending at (100, 100). Along the way, the
graph line intersects specific data points, which we define like this:
The values defined in the configuration are matched together to represent the data points in the
graph line. In our example, we have a drop probability of 25 percent when the queue is 50 percent
full. Likewise, the drop probability increases to 50 percent when the queue is 75 percent full.
The JUNOS software default drop profile begins with a drop probability of
0 percent when the queue is 0 percent full. The profile then plots a drop prob-
ability of 100 percent when the queue is 100 percent full. This profile transmits
all packets until the queue is full. In essence, packets are tail dropped from the
network—they are not placed into the queue at all.
For the purposes of our sample network in Figure A.3, we define two interpolated drop pro-
files called high-drop and low-drop. The configuration of the Merlot router then appears as:
While we won’t be creating the drop profile graphs for this configuration, feel
free to draw it on your own to ensure that you accurately grasp the concept.
Much like routing policies, drop profiles are not used until they are applied someplace. Within
a CoS environment the profiles are assigned to a scheduler by a drop profile map, which contains
all of the properties of an individual queue. The drop profile maps take into account the current
loss priority setting of the packet—high, low, or any. In addition, some Layer 4 information is
checked to determine if the packet is associated to tcp, non-tcp, or any forms of traffic.
For our sample network, we associate the drop profiles with the setting of the loss priority
value as so:
Schedulers
You may have noticed that the drop profile map we used in the previous section was applied to
a piece of configuration called a scheduler. This was no random mistake. The JUNOS software
uses schedulers to define the properties of an individual queue. These include the amount of
interface bandwidth assigned to the queue, the size of the memory buffer allocated for storing
result cells, the priority of the queue, and the drop profiles associated with the queue. Since
we’ve already discussed drop profiles, let’s examine the other attributes at this point.
Each queue is allocated some portion of the bandwidth of the outgoing interface. This band-
width amount can be a hard value, such as 1Mbps, a percentage of the total available bandwidth,
or the rest of the available bandwidth. This variable provides you the control to guarantee that
each queue receives the amount of bandwidth appropriate to its level of service. The best-effort
scheduler on the Merlot router is assigned to use the remainder of the bandwidth on any interface
it is assigned to:
The transmit-rate command correlates the queue bandwidth to the particular scheduler.
By default, each individual queue may burst outside of its defined bandwidth, provided extra
bandwidth is available on the interface. You may limit this default behavior through the addi-
tion of the exact option within the transmit-rate. This strictly limits the queue to just the
bandwidth allocated to it. We now create a network-control scheduler on Merlot, which sets
a strict rate limit of 1Mbps:
For the sake of completeness, we also create gold and platinum schedulers and assign them
bandwidth limits:
The second attribute we can assign to a scheduler is the amount of memory buffer allocated
to store and queue the result cells. This is configured using the buffer-size command. One
method for setting the buffer size is defining a percentage of the total memory space allocated
on the outgoing FPC. A second method involves setting a time value, expressed in microseconds,
which represents the longest amount of time an individual packet should be queued.
Setting larger values for the buffer-size means a greater possibility exists for
delaying packets in the network. This may not be useful for sensitive traffic such
as voice or video. By default, the buffer-size setting is equal to the transmit-
rate. In fact, this type of configuration is recommended.
Each of the schedulers defined on the Merlot router is now assigned some amount of buffer
space for queuing result cells:
platinum {
transmit-rate percent 25;
buffer-size temporal 200;
}
The third scheduler attribute is the priority of the queue itself. This allows the JUNOS soft-
ware to service certain high-priority queues before low-priority queues. We define this value
using the priority command within the scheduler. For completeness, we also assign our drop
profiles to each scheduler:
Now that we’ve created our individual schedulers, we need to associate them with an out-
going interface as well as a forwarding class. These two separate steps both use a scheduler map
within the configuration. We first build the scheduler map, which matches a forwarding class
18 Bonus A Class of Service
to a scheduler. This is a critical step in the configuration process since the forwarding class is
already assigned a queue number and the scheduler contains the parameters that queue should
use. Because we’ve conveniently named our forwarding classes and schedulers identically, we
now combine them in a scheduler map called sample-cos-scheduler-map:
The final step of our configuration is the association of the scheduler map to the outgoing
interface on the router. In our case, the so-0/1/2.0 interface connects Merlot to Chardonnay:
Queue Servicing
Given a large enough traffic load, each individual queue may experience a period of congestion
where the number of result cells queued is greater than the ability of the router to empty the
queue. In this environment, each queue requires a method for determining which result cells
should be dropped from the network. The JUNOS software provides the option of enabling ran-
dom early discard (RED) on the individual queues.
JUNOS Software Implementation 19
The JUNOS software doesn’t supply an explicit command to enable RED. Rather, the appli-
cation of a drop profile to a scheduler turns on this functionality. Once RED is operational on
an interface, the queue no longer drops result cells from the tail of the queue. Rather, cells are
dropped after they reach the head of the queue. At this point, the router generates a random
number to plot against the drop profile graph. This ultimately determines if the result cell is
dropped from the network or transmitted out the physical interface.
While RED operates efficiently within a single queue, we need another mechanism to ensure
that queues containing important traffic are provided better access to the outgoing interface.
This is accomplished through a procedure of priority queuing, in which the router examines the
priority of the queue. In addition, the router determines if the individual queue is within its
defined bandwidth profile. This binary decision, which is reevaluated on a regular time cycle,
compares the amount of data transmitted by the queue against the amount of bandwidth allo-
cated to it by the scheduler. When the transmitted amount is less than the allocated amount, the
queue is considered to be in profile. A queue is out of profile when its transmitted amount is
larger than its allocated amount.
The JUNOS software performs priority queuing using the following steps:
1. The router first locates all high-priority queues that are currently in profile. These queues
are serviced first in a weighted round-robin fashion.
2. The router then locates all low-priority queues that are currently in profile. These queues
are also serviced using a weighted round-robin scheme.
3. The router then locates all high-priority queues that are currently out of profile and that are
not rate limited. The weighted round-robin algorithm is applied to these queues for servicing.
4. The router finally locates all low-priority queues that are currently out of profile and are
also not rate limited. These queues are serviced last in a weighted round-robin manner.
Rewrite Rules
The final CoS action taken on a packet within a Juniper Networks router is the application of a
rewrite rule. These rules are applied after the data packet is reassembled by the I/O Manager ASIC
on the outgoing FPC and set the value of the CoS bits within the packet’s header. The specific bit
settings are determined by the packet’s forwarding class and loss priority setting. In effect, it per-
forms the opposite function of the behavior aggregate classifier used as the packet enters the
router. In fact, the configuration is extremely similar:
forwarding-class platinum {
loss-priority low code-point platinum;
}
forwarding-class network-control {
loss-priority low code-point network-control;
}
}
Summary
In this chapter, we spent a relatively short amount of time examining the broad topic of CoS. We
saw that a network administrator needs to view CoS from both a macro (the entire network) as
well as a micro (an individual router) point of view. We then discussed some terms commonly
used to express CoS functionality, such as classifiers, queuing, and rewrite rules. We then
explained how to locate CoS information within incoming data packets. We saw that IP packets
used a type-of-service byte and populated either three precedence bits or six Diff-Serv Code Points.
MPLS packets also carry CoS information in their header within a three-bit experimental field.
We concluded the chapter with an exploration of the JUNOS software implementation of
CoS. We saw that CoS functions closely matched the flow of a packet through the Packet For-
warding Engine. We then configured each of the CoS components using a sample network. An
individual router was assigned code points, forwarding classes, classifiers, schedulers, and
rewrite rules.
Exam Essentials
Be able to describe how individual IP data packets can be examined by a router configured
for CoS. Individual IPv4 data packets contain a type-of-service byte in their Layer 3 header.
End-user and network devices can set the three most significant bits to one of eight possible val-
ues. These precedence bits are examined by the JUNOS software by default. The six most sig-
nificant bits in this field are used to define 64 Diff-Serv Code Points.
Be able to identify the queuing methods employed by a Juniper Networks router. The
JUNOS software operates each outbound queue using a tail-drop paradigm. This prevents new
result cells from entering the queue during times of congestion. With the application of a drop
profile, queues begin dropping result cells from the head of the queue using the random early
discard (RED) algorithm. In addition, individual queues may be assigned a priority value, which
assists the router is performing priority queuing. This allows high-priority queues to be serviced
before low-priority ones.
Be able to identify the use of a classifier within a router. A CoS network uses two different
types of classifiers for assigning incoming data packets to a specific level of service. A behavior
aggregate (BA) classifier solely examines the bits in the packet’s header to make its decision. A
multi-field (MF) classifier, on the other hand, permits the administrator to use multiple match
criteria in a firewall filter to select the service level for a packet.
Be able to describe the use of a drop profile in a router. The application of a drop profile to a
queue enables RED functionality on that queue. Each individual profile contains a graph line
that correlates to the fullness of the queue and the probability that the packet will be dropped.
When a result cell is removed from the head of the queue, the router calculates a random num-
ber and plots it against the drop profile. If the number is above the graph line, the packet is
transmitted out the interface and to the network. When the value falls below the graph line,
however, the packet is dropped from the network.
22 Bonus A Class of Service
Understand the components that are associated with a scheduler. The JUNOS software uses
a scheduler to assign properties to individual queues. These properties include the amount of
bandwidth allocated to the queue, the priority of the queue, and the drop profiles assigned to
service the queue.
Understand the functionality of a rewrite rule. Before a data packet is transmitted by the router
onto the physical media, the CoS bits in the packet’s header must be set. This is the function of a
rewrite rule. Each individual rule examines the forwarding class and loss priority of the packet
about to be transmitted and sets the bits to a value defined in the rule. This allows the next down-
stream router to perform its CoS functions accurately.
Review Questions 23
Review Questions
1. What component in a Juniper Networks router uses a behavior aggregate classifier?
A. Incoming PIC
B. Incoming I/O Manager ASIC
C. Internet Processor ASIC
D. Outgoing I/O Manager ASIC
E. Outgoing PIC
4. What variable is used by a drop profile to determine whether or not to drop a packet from the
network?
A. Packet size
B. Bandwidth used by the queue
C. Fullness of the queue
D. Outgoing interface speed
5. Which JUNOS software configuration component allows the mapping of human-friendly names
to CoS bits values?
A. Forwarding class
B. Scheduler
C. Rewrite rule
D. Code-point alias
24 Bonus A Class of Service
6. Which JUNOS software configuration component allows the router to ensure that the proper bit
values are placed in outgoing packets?
A. Forwarding class
B. Scheduler
C. Rewrite rule
D. Code-point alias
8. Which two sets of bits can be used by the JUNOS software to classify IPv4 traffic into the appro-
priate service class?
A. Experimental bits
B. IP precedence bits
C. Code-point aliases
D. Diff-Serv Code Points
9. Which set of bits is used by the JUNOS software to classify MPLS traffic into the appropriate
service class?
A. Experimental bits
B. IP precedence bits
C. Code-point aliases
D. Diff-Serv Code Points
10. What JUNOS software configuration component is used in both a classifier and a rewrite rule
and is closely associated with an outgoing interface queue?
A. Scheduler map
B. Drop profile
C. Forwarding class
D. Code point alias
Answers to Review Questions 25
2. D. On an M-series Juniper Networks router, all queuing functions are handled by the I/O
manager ASIC on the outgoing FPC. The ASIC queues the result cells it receives from the Inter-
net Processor ASIC.
4. C. When the RED algorithm selects a result cell from a queue, it checks the current fullness of
that queue. This fullness is plotted against a drop profile to determine the probability of drop-
ping the packet from the network.
5. D. A code-point alias allows a network administrator to map CoS bit values to names used
throughout the [edit class-of-service] configuration hierarchy.
6. C. After a result cell is removed from a queue and permitted to be transmitted on the interface,
the I/O Manager ASIC consults any configured rewrite rules to determine the exact bit values
that should be placed in the outgoing packet.
7. B. The JUNOS software implements tail-drop queuing by default but enables random early
discard (RED) when a drop profile is configured.
8. B, D. The type-of-service byte in an IPv4 packet has two possible methods of classifying traffic.
The three most significant bits are the IP precedence bits, and the six most significant bits are the
Diff-Serv Code Points.
9. A. Technically speaking, the experimental bits in an MPLS header are just that—experimental.
However, most router vendors, including the JUNOS software, use these bits for CoS.
10. C. Each interface queue in the router is associated with a forwarding class. Incoming packets
are classified into a particular forwarding class by a behavior aggregate classifier. All packets
transmitted from the router use the current forwarding class to rewrite the appropriate CoS
bits in the header.