Most Juniper MX operators configure QoS with a single set of four queues and move on. That works until the day a voice call sounds bad during a backup window. The MX is the most powerful CoS platform in the Juniper lineup. The trick is that Junos CoS uses four logical concepts working in series: classifiers mark, forwarding classes group, schedulers shape and rewrite rules re-tag.

1. The Four-Stage CoS Pipeline

  1. Classifiers — examine incoming DSCP/IPPrec and assign a forwarding class + loss priority.
  2. Forwarding classes — bucket names engineers use.
  3. Schedulers — bandwidth, priority, buffer allocation per queue.
  4. Rewrite rules — re-tag the IP header on egress.
If you skip rewrite rules, you have built one-way QoS — your ingress is policed but egress leaves your boxes unmarked.

2. Define Forwarding Classes

set class-of-service forwarding-classes class voice queue-num 0 priority high
set class-of-service forwarding-classes class video queue-num 1 priority high
set class-of-service forwarding-classes class data queue-num 2 priority low
set class-of-service forwarding-classes class bulk queue-num 3 priority low

3. Classifier — Mark DSCP

set class-of-service classifiers dscp VOICE-CLASS import default
set class-of-service classifiers dscp VOICE-CLASS forwarding-class voice loss-priority low code-points ef
set class-of-service classifiers dscp VOICE-CLASS forwarding-class video loss-priority low code-points af41
set class-of-service classifiers dscp VOICE-CLASS forwarding-class data loss-priority low code-points be
set class-of-service classifiers dscp VOICE-CLASS forwarding-class bulk loss-priority high code-points af11

4. Scheduler Maps

set class-of-service schedulers SCHED-VOICE transmit-rate 128k shaping-rate 256k priority strict-high buffer-size 5
set class-of-service schedulers SCHED-VIDEO transmit-rate 5m shaping-rate 10m priority high buffer-size 20
set class-of-service schedulers SCHED-DATA transmit-rate 50m shaping-rate 80m priority low buffer-size 50
set class-of-service schedulers SCHED-BULK transmit-rate percent 30 shaping-rate percent 50 priority low buffer-size 25
strict-high should be reserved for ≤ 25% of link capacity — strict-high always wins and at high utilization starves other queues.

5. Hierarchical CoS

set class-of-service interfaces et-0/0/0 scheduler-map MAP-WAN shaping-rate 200m
set class-of-service interfaces et-0/0/0 unit 0 hierarchical-scheduler
set class-of-service interfaces et-0/0/0 unit 0 shaping-rate 80m
set class-of-service interfaces et-0/0/0 unit 0 classifiers dscp VOICE-CLASS
set class-of-service interfaces et-0/0/0 unit 0 scheduler-map MAP-WAN

6. Rewrite Rules — Tag Egress DSCP

set class-of-service rewrite-rules dscp REWRITE-DSCP
set class-of-service rewrite-rules dscp REWRITE-DSCP forwarding-class voice loss-priority low code-point ef
set class-of-service rewrite-rules dscp REWRITE-DSCP forwarding-class video loss-priority low code-point af41
set class-of-service rewrite-rules dscp REWRITE-DSCP forwarding-class data loss-priority low code-point be
set class-of-service rewrite-rules dscp REWRITE-DSCP forwarding-class bulk loss-priority high code-point af11
set class-of-service interfaces et-0/0/0 unit 0 rewrite-rules dscp REWRITE-DSCP

7. End-to-End Verification

show class-of-service interface et-0/0/0 extensive
show queueing interface et-0/0/0
monitor interface et-0/0/0

If voice is dropping any packets at all, your buffering or shaping is wrong — voice should always be zero drops with strict-high.

8. Pitfalls

8.1 "Voice OK until 60% utilization"

strict-high queue too narrow. Tighten pacing, add buffer, reduce shaping on bulk.

8.2 No rewrite rule visible

The unit is missing rewrite-rules dscp. show class-of-service interface tells you which side.

9. Bringing It Together

The MX platform makes this achievable — once you stop treating classifiers, schedulers and rewrites as three separate problems. Related reading: BGP flap field method, OSPF on MX, SRX zone firewall.