Description

This article provides guide on how to configure Class of Service for every hop on Juniper Networks EX Series ELS switches except for QFX5K and EX46's, since these ones implement the use of an extra hierarchy level "traffic-control-profiles" under [edit class-of-service].

Symptoms

In this scenario, customer needs to configure Class of Service through a network of Juniper Networks ELS switches such as EX4100. It is required to respect the below classification from highest priority to lowest and the traffic must be marked with DSCP markings through the entire path.

 

(CS7) - 1st High Priority – this is the DATA traffic.

DACP Marking: 111000

 

(EF) - 2nd Highest Priority – This is the AUDIO traffic.

DSCP Marking: 101110

 

(CS4) - 3rd Highest Priority – This is VIDEO traffic

DSCP Marking: 100000

 

(AF31) This is the CAMERA traffic.

DSCP Marking: 011010

Solution

It is worth mentioning that the only difference from first hop to the other hops in the path is the type of classifier. That is because in this scenario the first hop will initiate the DSCP markings for the very first time and will use Multifield (MF) Classifier, while the other switches will continue with Behavior Aggregate (BA) Classifiers as the traffic will be already marked with DSCP markings by the first hop.

Multifield (MF) classifier (First hop)

{master:0}[edit firewall family ethernet-switching filter MF-CLASSIFIER]
user@switch# show | no-more
term DATA {
    from {
        ip-source-address {
            1.1.1.150/32;
        }
        ip-protocol tcp;
    }
    then {
        forwarding-class DATA;
        loss-priority low;
    }
}
term AUDIO {
    from {
        ip-source-address {
            2.2.2.150/32;
        }
        ip-protocol udp;
    }
    then {
        forwarding-class AUDIO;
        loss-priority low;
    }
}
term VIDEO {
    from {
        ip-source-address {
            3.3.3.150/32;
        }
        ip-protocol udp;
    }
    then {
        forwarding-class VIDEO;
        loss-priority medium-low;
    }
}
term CAMERA {
    from {
        ip-destination-address {
            4.4.4.150/32;
        }
        ip-protocol udp;
    }
    then {
        forwarding-class CAMERA;
        loss-priority medium-high;
    }
}
term ELSE {
    then {
        accept;
        forwarding-class best-effort;
        loss-priority high;
    }
}


Configure BA classifier since second hop on through the CoS designed path, and configure each forwarding class with the required loss priority values as per design.

[edit class-of-service]
classifiers {
    dscp BA-CLASSIFIER {
        forwarding-class DATA {
            loss-priority low code-points 111000; >>> CS7
        }
        forwarding-class AUDIO {
            loss-priority low code-points 101110; >>> EF
        }
        forwarding class VIDEO        
        loss-priority low code-points 100000; >>> CS4
        
        forwarding-class CAMERA {
            loss-priority high code-points 011010; >>> AF31
        }
    }
}


Configure/map each forwarding class with the queue number needed. Please note that the queue numbers must have been the same since the first hop of the path and must be respected through the entire path on all hops involved.

[edit class-of-service]
forwarding-classes {
    class AUDIO queue-num 1;
    class CAMERA queue-num 3;
    class DATA queue-num 0;
    class VIDEO queue-num 2;
}


Configure schedulers and assign the required transmit rate and buffer size.
 

[edit class-of-service]
schedulers {
    CAMERA-SCHEDULER {
        transmit-rate percent 33;
        buffer-size percent 33;
    }
    AUDIO-SCHEDULER {
        transmit-rate percent 33;
        buffer-size percent 33;
    }
    DATA-SCHEDULER {
        transmit-rate percent 33;
        buffer-size percent 33;
    VIDEO-SCHEDULER {
        transmit-rate percent 33;
        buffer-size percent 33;
    }
}


Map the schedulers with scheduler-maps.

[edit class-of-service]
scheduler-maps {
    COS-MAP {
        forwarding-class CAMERA scheduler CAMERA-SCHEDULER;
        forwarding-class AUDIO scheduler AUDIO-SCHEDULER;
        forwarding-class DATA scheduler DATA-SCHEDULER;
        forwarding-class VIDEO scheduler VIDEO-SCHEDULER;
    }
}


This configuration can be used when using rewrite rules. Proceed to configure rewrite rules.

[edit class-of-service]
rewrite-rules {
    dscp REWRITE {
        forwarding-class AUDIO {
            loss-priority low code-point 101110;
        }
        forwarding-class CAMERA {
            loss-priority medium-low code-point 011010;
        }
        forwarding-class DATA {
            loss-priority low code-point 111000;
        }
        forwarding-class VIDEO {
            loss-priority low code-point 100000;
        }
    }
}


Then, you apply the classifiers and scheduler maps to the interfaces as required by the CoS path. Note that classifiers must be applied to ingress interfaces, while scheduler maps must be applied to the egress interfaces. Rewrite rules are supposed to be configured to egress interfaces. In this scenario, CoS is needed to be performed in a two direction design, hence the scheduler map and the classifier has been applied on both ingress and egress interfaces simultaneously.

[edit class-of-service interfaces]
    ge-0/0/0 {
        scheduler-map COS-MAP;
        unit 0 {
            classifiers {
                dscp BA-CLASSIFIER;
            }
        }
    }
    ge-0/0/1 {
        scheduler-map COS-MAP;
        unit 0 {
            classifiers {
                dscp BA-CLASSIFIER;
            }
        }
    }


Example of first hop's ingress interface, since it uses MF classifiers.

[edit interfaces]
  ge-0/0/0
    unit 0
      family ethernet-switching
        filter
          input MF-CLASSIFIER


To validate if the traffic is going out tagged, implement output FF as below, and add more terms for every other DSCP code. Note that there must be a last term named ELSE with no matching condition (from) but just "then accept". Then apply this firewall filter on an egress interface as output filter.

[edit firewall]
family ethernet-switching {
    filter CoS-TEST {
        term DATA {
            from {
                dscp 111000;
            }
            then {
                accept;
                count QUEUE-DATA;
            }
        }
        term ELSE {
            then accept;
        }
    }
}

ge-0/0/0 {
    unit 0 {
        family ethernet-switching {
            filter {
                output CoS-TEST;
            }
        }
    }
}


To monitor the counters, just run the command

user@switch> show firewall CoS-TEST


Best practice of the most convenient order for CoS configuration.
Classifiers >> Forwarding classes >>> Schedulers >>> scheduler maps >>> interfaces >>> rewrite rules.

Modification History

08/12/2023 - KB article.
10/28/2023 - Added all details.
11/01/2023 - Made corrections on hierarchy levels and applicable platforms.