Perhaps the best way to understand JUNOS CoS is to examine how a packet is treated on its way through the CoS process. This section includes a description of each step, some figures illustrating the process, and a configuration example.
The following steps describe the CoS process:
At the [edit class-of-service interfaces] hierarchy level, the scheduler-map and rewrite-rules statements affect the outgoing packets, and the classifiers statement affects the incoming packets.
Figure 7 and Figure 8 show the components of the JUNOS CoS features, illustrating the sequence in which they interact.
Figure 7: CoS Classifier, Queues, and Scheduler

Figure 8: Packet Flow Through CoS Configurable Components

Each outer box in Figure 8 represents a process component. The components in the upper row apply to inbound packets, and the components in the lower row apply to outbound packets. The arrows with the solid lines point in the direction of packet flow.
The middle box (forwarding class and loss priority) represents two data values that can either be inputs to or outputs of the process components. The arrows with the dotted lines indicate inputs and outputs (or settings and actions based on settings). For example, the multifield classifier sets the forwarding class and loss priority of incoming packets. This means that the forwarding class and loss priority are outputs of the classifier; thus, the arrow points away from the classifier. The scheduler receives the forwarding class and loss priority settings, and queues the outgoing packet based on those settings. This means that the forwarding class and loss priority are inputs to the scheduler; thus, the arrow points to the scheduler. For more information, see CoS Inputs and Outputs.
Typically, only a combination of some components (not all) is used to define a CoS service offering.
The following configuration demonstrates the concepts described in this section:
- [edit class-of-service]
- interfaces {
-
- so-* {
- scheduler-map sched1;
-
- unit 0 {
-
- classifiers {
- exp exp_classifier;
- }
- }
- }
-
- t3-* {
- scheduler-map sched1;
-
- unit 0 {
-
- classifiers {
- exp exp_classifier;
- }
- }
- }
- }
- classifiers { # Step 2: Define classifiers.
- exp exp_classifier {
-
- forwarding-class data-queue {
- loss-priority low code-points 000;
- loss-priority high code-points 001;
- }
-
- forwarding-class video-queue {
- loss-priority low code-points 010;
- loss-priority high code-points 011;
- }
-
- forwarding-class voice-queue {
- loss-priority low code-points 100;
- loss-priority high code-points 101;
- }
-
- forwarding-class nc-queue {
- loss-priority high code-points 111;
- loss-priority low code-points 110;
- }
- }
- drop-profiles {
-
- be-red {
- fill-level 50 drop-probability 100;
- }
- }
- forwarding-classes {
- queue 0 data-queue;
- queue 1 video-queue;
- queue 2 voice-queue;
- queue 3 nc-queue;
- }
- schedulers {
-
- data-scheduler {
- transmit-rate percent 50;
- buffer-size percent 50;
- priority low;
- drop-profile-map loss-priority high protocol any drop-profile
be-red;
- }
-
- video-scheduler {
- transmit-rate percent 25;
- buffer-size percent 25;
- priority strict-high;
- }
-
- voice-scheduler {
- transmit-rate percent 20;
- buffer-size percent 20;
- priority high;
- }
-
- nc-scheduler {
- transmit-rate percent 5;
- buffer-size percent 5;
- priority high;
- }
- }
- scheduler-maps {
-
- sched1 {
- forwarding-class data-queue scheduler data-scheduler;
- forwarding-class video-queue scheduler video-scheduler;
- forwarding-class voice-queue scheduler voice-scheduler;
- forwarding-class nc-queue scheduler nc-scheduler;
- }
- }