Class of Service (CoS) is a network mechanism used to ensure Quality of Service (QoS) by prioritizing different types of traffic. In modern networks, not all traffic is created equal:
CoS manages network congestion and ensures service quality by:
Traffic classification is the process of categorizing packets into classes based on specific criteria. These classes help assign appropriate QoS treatments.
DSCP (Differentiated Services Code Point):
IP Precedence:
VLAN Tags:
Scheduling determines how packets are forwarded when multiple traffic types compete for bandwidth. The scheduler decides the order and amount of traffic sent.
Strict Priority Queues:
Weighted Fair Queuing (WFQ):
Deficit Round Robin (DRR):
Shaping and policing manage the rate of traffic entering or leaving the network.
Traffic Shaping:
Traffic Policing:
Why Shaping and Policing Matter:
They help prevent congestion by controlling the flow of data and ensuring that higher-priority traffic gets through during peak usage.
Queue management determines how packets are handled when queues become full due to congestion.
Random Early Detection (RED):
Weighted Random Early Detection (WRED):
CoS is crucial in networks where certain applications need preferential treatment. Common use cases include:
Voice over IP (VoIP):
Video Streaming:
Enterprise Applications:
Congestion Management:
A scheduler specifies how bandwidth is allocated among different traffic classes.
set class-of-service schedulers priority-scheduler transmit-rate percent 30
Classify packets based on DSCP values and map them to a forwarding class.
set class-of-service classifiers dscp af forwarding-class AF1
Limit traffic for a specific interface to prevent congestion.
set class-of-service traffic-shaping interface ge-0/0/0 shaping-rate 100m
set class-of-service policers policer1 if-exceeding bandwidth-limit 50m
Understand Application Requirements:
Use a Hierarchical Approach:
Test Policies Before Deployment:
Monitor and Adjust:
Class of Service is a fundamental part of modern network QoS, ensuring that critical traffic gets prioritized during congestion. By combining traffic classification, scheduling, shaping, and queue management, CoS delivers a balanced and efficient use of network resources.
In Junos, Forwarding Classes define how traffic is queued and scheduled for transmission. Each forwarding class is mapped to a scheduler queue that determines:
Queue priority
Bandwidth share
Scheduling algorithm (e.g., strict-priority or weighted)
Examples of typical forwarding classes:
BE (Best Effort)
AF (Assured Forwarding)
EF (Expedited Forwarding for voice/video)
set class-of-service forwarding-classes queue 1 forwarding-class BE
Each Forwarding Class can also be assigned one of two loss priorities:
Low Loss Priority (LLP): Less likely to be dropped.
High Loss Priority (HLP): More likely to be dropped when congestion occurs.
set class-of-service forwarding-classes queue 1 forwarding-class BE loss-priority low
WRED (Weighted Random Early Detection) uses loss priority to influence drop probability. Traffic marked as HLP will reach the drop threshold faster than LLP traffic under congestion.
Juniper supports color-aware policing using the Single-Rate Three Color Marker (srTCM) or Two-Rate Three Color Marker (trTCM).
| Color | Condition | Action |
|---|---|---|
| Green | Within committed rate | Forward |
| Yellow | Exceeds committed but below peak | May mark/drop |
| Red | Exceeds peak rate | Drop |
set firewall policer POLICER1 if-exceeding bandwidth-limit 100m burst-size-limit 10m
set firewall policer POLICER1 then loss-priority high discard
Color-based treatment can be used to prioritize core (backbone) traffic over local-access traffic.
For example, red traffic can be dropped aggressively at the PE before it reaches the P routers.
This marking system is critical for congestion-aware drop policies and SLA enforcement.
In large-scale service provider networks, Hierarchical CoS is used to create multi-level traffic shaping and scheduling. This is especially important in:
Multi-tenant environments (e.g., per-VRF or per-customer shaping)
Access-to-core rate control
Apply shaping per logical unit (unit x) or per scheduler.
Create scheduler maps that define parent-child relationships.
Schedule at:
Top level (e.g., per customer or per VLAN)
Mid-level (per application type)
Bottom level (individual queues)
set class-of-service schedulers SCHED-VOICE transmit-rate percent 30
set class-of-service scheduler-maps MAP1 forwarding-class EF scheduler SCHED-VOICE
set class-of-service interfaces ge-0/0/0 unit 0 scheduler-map MAP1
In the exam, you may be asked to identify the component that enables queue-level shaping within a per-customer shaping policy — the answer is H-CoS with scheduler-maps.
While classifiers are used for ingress classification, rewrite rules are applied on egress to modify packet markings.
Example for DSCP-based rewrite:
set class-of-service rewrite-rules dscp af forwarding-class AF1 loss-priority low code-points 001010
Attach the rewrite rule to an interface:
set interfaces ge-0/0/0 unit 0 rewrite-rules dscp af
This ensures that outbound packets carry DSCP values appropriate for the forwarding class and loss priority assigned internally.
Many confuse classifier and rewrite-rule functions.
Classifier = Input classification
Rewrite-rule = Output marking
Exam trick: If the question says "modifying DSCP value on outbound packets", the answer is always rewrite-rules, not classifiers.
| Topic | Key Details |
|---|---|
| Forwarding Class & LP | FC defines queue; LP (high/low) affects WRED drop likelihood |
| Three-Color Marking | Green/yellow/red classification for traffic policing; uses trTCM |
| Hierarchical CoS | Allows shaping/scheduling at multiple levels (per VRF/unit/class) |
| Rewrite Rules | Output DSCP/CoS value marking based on forwarding class and LP |
| WRED & LP Interaction | High-loss-priority traffic dropped earlier under congestion |
What is the purpose of forwarding classes in Junos CoS?
Forwarding classes categorize traffic into queues with specific scheduling behavior.
Forwarding classes allow routers to classify packets based on criteria such as DSCP, MPLS EXP bits, or interface policies. Once classified, packets are placed into queues that determine how traffic is prioritized during congestion. For example, voice traffic might be assigned to a high-priority queue while bulk data traffic is placed in a lower-priority queue. This mechanism ensures latency-sensitive traffic receives appropriate treatment in service provider networks.
Demand Score: 70
Exam Relevance Score: 86
What is the difference between traffic policing and traffic shaping?
Policing drops excess traffic immediately, while shaping buffers traffic and sends it later.
Traffic policing enforces bandwidth limits by discarding packets that exceed configured thresholds. It is typically used to enforce strict service limits. Traffic shaping, in contrast, delays packets temporarily by buffering them and releasing them at a controlled rate. This approach smooths traffic bursts and avoids unnecessary packet loss. In service provider environments, shaping is commonly applied on egress interfaces while policing is applied on ingress edges.
Demand Score: 68
Exam Relevance Score: 84
Why is queue scheduling important in service provider networks?
It determines how packets from different classes are transmitted during congestion.
Queue scheduling defines how available bandwidth is distributed among traffic classes when multiple queues contain packets. Scheduling algorithms such as priority scheduling or weighted round-robin allow operators to guarantee bandwidth or latency characteristics for specific traffic types. Without proper scheduling policies, critical applications like voice or control traffic could experience delays or packet loss during congestion events.
Demand Score: 65
Exam Relevance Score: 82