ON THIS PAGE
Configuring Basic Packet Flow Through the Junos CoS Process
Figure 1 and Figure 2 show the components of the Junos CoS features, illustrating the sequence in which they interact.

The following configuration demonstrates the packet flow through the CoS process:
Define Classifiers
If you trust the CoS values in the packet headers, you can use behavior aggregate classification to map those values to a forwarding class and drop priority. For example:
[edit class-of-service]
classifiers {
exp exp_classifier {
forwarding-class data-queue {
loss-priority high code-points 001;
loss-priority low code-points 000;
}
forwarding-class nc-queue {
loss-priority high code-points 111;
loss-priority low code-points 110;
}
forwarding-class video-queue {
loss-priority high code-points 011;
loss-priority low code-points 010;
}
forwarding-class voice-queue {
loss-priority high code-points 101;
loss-priority low code-points 100;
}
}
If you do not trust the CoS values in the packet headers, you can use the more complex multifield classification to map ingress traffic to a forwarding class and drop priority. For example:
[edit firewall]
family inet {
filter classify {
term sip {
from {
protocol [ udp tcp ];
port 5060;
}
then {
forwarding-class nc-queue;
loss-priority low;
accept;
}
}
}
}
See Also
Apply Classifiers to Incoming Packets on Interfaces
You apply behavior aggregate classifiers to logical interfaces
at the [edit class-of-service interfaces] hierarchy level.
For example:
[edit class-of-service]
interfaces {
so-* {
unit 0 {
classifiers {
exp exp_classifier;
}
}
}
t3-* {
unit 0 {
classifiers {
exp exp_classifier;
}
}
}
}
You apply multifield classifiers as input filters to logical
interfaces at the [edit interfaces] hierarchy level. For
example:
[edit interfaces]
fe-0/0/2 {
unit 0 {
family inet {
filter {
input classify;
}
address 10.12.0.13/30;
}
}
}
Define Policers to Limit Traffic and Control Congestion
If you need to rate-limit a traffic flow, either by discarding excess traffic (hard policing) or reassign excess traffic to a different forwarding class and/or loss priority (soft policing), define a policier and apply the policer to a firewall filter for that traffic flow. For example:
[edit firewall]
policer be-lp {
if-exceeding {
bandwidth-limit 10m;
burst-size-limit 62500;
}
then loss-priority high;
}
family inet {
filter be-lp {
term t1 {
from {
protocol tcp;
port 80;
}
then policer be-lp;
then loss-priority low;
then accept;
}
}
}
See Also
Define Drop Profiles
Use drop profiles to define the drop probabilities across the range of delay-buffer occupancy, supporting the random early detection (RED) process.
[edit class-of-service]
drop-profiles {
be-red {
fill-level 20 drop-probability 25;
fill-level 30 drop-probability 50;
fill-level 40 drop-probability 75;
fill-level 50 drop-probability 100;
}
}
Assign Each Forwarding Class to a Queue
To provide differentiated services to each forwarding class, assign each forwarding class to it’s own output queue. For example:
[edit class-of-service]
forwarding-classes {
queue 0 data-queue;
queue 1 video-queue;
queue 2 voice-queue;
queue 3 nc-queue;
}
See Also
Define Schedulers
Define the scheduler characteristics for each forwarding class. For example:
[edit class-of-service]
schedulers { #
data-scheduler {
buffer-size percent 50;
drop-profile-map loss-priority high protocol any drop-profile be-red;
priority low;
transmit-rate percent 50;
}
nc-scheduler {
buffer-size percent 5;
priority high;
transmit-rate percent 5;
}
video-scheduler {
buffer-size percent 25;
priority strict-high;
transmit-rate percent 25;
}
voice-scheduler {
buffer-size percent 20;
priority high;
transmit-rate percent 20;
}
}
See Also
Define Scheduler Maps
Use scheduler maps to map schedulers to forwarding classes. For example:
[edit class-of-service]
scheduler-maps {
sched1 {
forwarding-class data-queue scheduler data-scheduler;
forwarding-class nc-queue scheduler nc-scheduler;
forwarding-class video-queue scheduler video-scheduler;
forwarding-class voice-queue scheduler voice-scheduler;
}
}
See Also
Define CoS Header Rewrite Rules
Use rewrite rules to redefine the CoS bit pattern of outgoing packets. For example:
[edit class-of-service]
rewrite-rules {
inet-precedence inet-rewrite {
forwarding-class data-queue {
loss-priority high code-point 001;
loss-priority low code-point 000;
}
forwarding-class nc-queue {
loss-priority high code-point 111;
loss-priority low code-point 110;
}
forwarding-class video-queue {
loss-priority high code-point 101;
loss-priority low code-point 100;
}
forwarding-class voice-queue {
loss-priority high code-point 011;
loss-priority low code-point 010;
}
}
}
See Also
Apply Scheduler Maps and Rewrite Rules to Egress Interfaces
[edit class-of-service]
interfaces {
ge-* {
scheduler-map sched1;
unit * {
rewrite-rules {
inet-precedence inet-rewrite;
}
}
}
}
See Also
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.