To configure the device as a node in a network supporting CoS, read the section Before You Begin, determine your needs, and select the tasks you need to perform from the following list. For information about using the J-Web and CLI configuration editors, see the the J-Web Interface User Guide and the JUNOS CLI User Guide.
You configure a policer to detect packets that exceed the limits established for expedited forwarding. The packets that exceed these limits are given a higher loss priority than packets within the bandwidth and burst size limits.
The following example shows how to configure a policer called ef-policer that identifies for likely discard expedited forwarding packets with a burst size greater than 2000 bytes and a bandwidth greater than 10 percent.
For more information about firewall filters, see Configuring Stateless Firewall Filters (ACLs) and the JUNOS Policy Framework Configuration Guide.
To configure an expedited forwarding policer for a firewall filter for the Services Router:
Table 257: Configuring a Policer for a Firewall Filter
You configure a multifield (MF) classifier to detect packets of interest to CoS and assign the packet to the proper forwarding class independently of the DiffServ code point (DSCP). To configure a multifield classifier on a customer-facing or host-facing link, configure a firewall filter to classify traffic. Packets are classified as they arrive on an interface.
One common way to detect packets of CoS interest is by source or destination address. The destination address is used in this example, but many other matching criteria for packet detection are available to firewall filters.
This example shows how to configure the firewall filter mf-classifier and apply it to the Services Router's Gigabit Ethernet interface ge-0/0/0. The firewall filter consists of the rules (terms) listed in Table 258.
Table 258: Sample mf-classifier Firewall Filter Terms
Rule (Term) |
Purpose |
Contents |
|---|---|---|
assured forwarding |
Detects packets destined for 192.168.44.55, assigns them to an assured forwarding class, and gives them a low likelihood of being dropped. |
Match condition: destination address 192.168.44.55 Forwarding class: af-class Loss priority: low |
expedited-forwarding |
Detects packets destined for 192.168.66.77, assigns them to an expedited forwarding class, and subjects them to the EF policer configured in Configuring a Policer for a Firewall Filter. |
Match condition: destination address 192.168.66.77 Forwarding class: ef-class Policer: ef-policer |
network control |
Detects packets with a network control precedence and forwards them to the network control class. |
Match condition: precedence net-control Forwarding class: nc-class |
best-effort-data |
Detects all other packets and assigns them to the best effort class. |
Forwarding class: be-class |
For more information about firewalls filters see Configuring Stateless Firewall Filters (ACLs) and the JUNOS Policy Framework Configuration Guide.
To configure a firewall filter for a multifield classifier for the Services Router:
Table 259: Configuring and Applying a Firewall Filter for a Multifield Classifier
You must assign the forwarding classes established by the mf-classifier multifield classifier to output queues. This example assigns output queues as shown in Table 260.
Table 260: Sample Output Queue Assignments for mf-classifier Forwarding Queues
For multifield classifier details, see Configuring and Applying a Firewall Filter for a Multifield Classifier.
To assign forwarding classes to output queues:
Table 261: Assigning Forwarding Classes to Output Queues
To configure CoS forwarding classes on an SRX-series device, include the following statements at the [edit class-of-service] hierarchy level of the configuration:
- [edit class-of-service]
- forwarding-classes {
- class class-name queue-num queue-number priority (high | low);
- queue queue-number class-name priority (high | low);
- }
- interfaces {
-
- interface-name {
-
- unit logical-unit-number {
- forwarding-class class-name;
- }
- }
- }
- restricted-queues {
- forwarding-class class-name queue-number;
- }
You cannot commit a configuration that assigns the same forwarding class to two different queues.
On an SRX-series device, you can configure fixed classification on a logical interface by specifying a forwarding class to be applied to all packets received by the logical interface, regardless of the packet contents.
To assign a forwarding class configuration to the input logical interface, include the forwarding-class statement at the [edit class-of-service interfaces interface-name unit logical-unit-number] hierarchy level:
- [edit class-of-service interfaces interface-name unit logical-unit-number]
- forwarding-class class-name;
You can include interface wildcards for interface-name and logical-unit-number.
In the following example, all packets coming into the device from the ge-3/0/0.0 interface are assigned to the assured-forwarding forwarding class:
By default on all platforms, four output queues are mapped to four forwarding classes as shown in Table 243. On J-series Services Routers or SRX-series devices, you can configure up to eight forwarding classes and eight queues once the eight-queue mode has been enabled. For more information on enabling up to eight queues, see Forwarding Classes.
![]() |
Note: The new setting takes place only after the FPC is restarted. |
To configure up to eight forwarding classes, include the queue statement at the [edit class-of-service forwarding-classes] hierarchy level:
The output queue number can be from 0 through 7, and you must map the forwarding classes one-to-one with the output queues. The default scheduler transmission rate and buffer size percentages for queues 0 through 7 are 95, 0, 0, 5, 0, 0, 0, and 0 percent.
For example, to configure a one-to-one mapping between eight forwarding classes and eight queues: you would use the following configuration:
- [edit class-of-service]
- forwarding-classes {
- queue 0 be;
- queue 1 ef;
- queue 2 af;
- queue 3 nc;
- queue 4 ef1;
- queue 5 ef2;
- queue 6 af1;
- queue 7 nc1;
- }
Defining Eight Classifiers
- [edit class-of-service]
- classifiers {
-
- dscp dscp-table {
-
- forwarding-class ef {
- loss-priority low code-points [101000, 101001];
- loss-priority high code-points [101010, 101011];
- }
-
- forwarding-class af {
- loss-priority low code-points [010000, 010001];
- loss-priority high code-points [010010, 010011];
- }
-
- forwarding-class be {
- loss-priority low code-points [000000];
- }
-
- forwarding-class nc {
- loss-priority low code-points [111000];
- }
-
- forwarding-class ef1 {
- loss-priority low code-points [101100, 101101];
- loss-priority high code-points [101110];
- }
-
- forwarding-class af1 {
- loss-priority high code-points [101110];
- }
-
- forwarding-class ef2 {
- loss-priority low code-points [101111];
- }
-
- forwarding-class af2 {
- loss-priority low code-points [010000];
- }
-
- forwarding-class nc1 {
- loss-priority low code-points [111001];
- }
- }
- }
Adding Eight Schedulers to a Scheduler Map
Configure a custom scheduler map that applies globally to all interfaces, except those that are restricted to four queues:
- [edit class-of-service]
- scheduler-maps {
-
- sched {
- forwarding-class be scheduler Q0;
- forwarding-class ef scheduler Q1;
- forwarding-class af scheduler Q2;
- forwarding-class nc scheduler Q3;
- forwarding-class ef1 scheduler Q4;
- forwarding-class ef2 scheduler Q5;
- forwarding-class af1 scheduler Q6;
- forwarding-class nc1 scheduler Q7;
- }
- }
- schedulers {
-
- Q0 {
- transmit-rate percent 25;
- buffer-size percent 25;
- priority low;
- drop-profile-map loss-priority any protocol both drop-default;
- }
-
- Q1 {
- buffer-size temporal 2000;
- priority strict-high;
- drop-profile-map loss-priority any protocol both drop-ef;
- }
-
- Q2 {
- transmit-rate percent 35;
- buffer-size percent 35;
- priority low;
- drop-profile-map loss-priority any protocol both drop-default;
- }
-
- Q3 {
- transmit-rate percent 5;
- buffer-size percent 5;
- drop-profile-map loss-priority any protocol both drop-default;
- }
-
- Q4 {
- transmit-rate percent 5;
- priority high;
- drop-profile-map loss-priority any protocol both drop-ef;
- }
-
- Q5 {
- transmit-rate percent 10;
- priority high;
- drop-profile-map loss-priority any protocol both drop-ef;
- }
-
- Q6 {
- transmit-rate remainder;
- priority low;
- drop-profile-map loss-priority any protocol both drop-default;
- }
-
- Q7 {
- transmit-rate percent 5;
- priority high;
- drop-profile-map loss-priority any protocol both drop-default;
- }
- }
Configuring an IP Precedence Classifier and Rewrite Tables
- [edit class-of-service]
- classifiers {
-
- inet-precedence inet-classifier {
-
- forwarding-class be {
- loss-priority low code-points 000;
- }
-
- forwarding-class af11 {
- loss-priority high code-points 001;
- }
-
- forwarding-class ef {
- loss-priority low code-points 010;
- }
-
- forwarding-class nc1 {
- loss-priority high code-points 011;
- }
-
- forwarding-class {
- loss-priority low code-points 100;
- }
-
- forwarding-class af12 {
- loss-priority high code-points 101;
- }
-
- forwarding-class ef1 {
- loss-priority low code-points 110;
- }
-
- forwarding-class nc2 {
- loss-priority high code-points 111;
- }
- }
- }
- exp exp-rw-table {
-
- forwarding-class be {
- loss-priority low code-point 000;
- }
-
- forwarding-class af11 {
- loss-priority high code-point 001;
- }
-
- forwarding-class ef {
- loss-priority low code-point 010;
- }
-
- forwarding-class nc1 {
- loss-priority high code-point 111;
- }
-
- forwarding-class be1 {
- loss-priority low code-point 100;
- }
-
- forwarding-class af12 {
- loss-priority high code-point 101;
- }
-
- forwarding-class ef1 {
- loss-priority low code-point 110;
- }
-
- forwarding-class nc2 {
- loss-priority low code-point 111;
- }
- }
- inet-precedence inet-rw-table {
-
- forwarding-class be {
- loss-priority low code-point 000;
- }
-
- forwarding-class af11 {
- loss-priority high code-point 001;
- }
-
- forwarding-class ef1 {
- loss-priority low code-point 010;
- }
-
- forwarding-class nc1 {
- loss-priority low code-point 111;
- }
-
- forwarding-class be1 {
- loss-priority low code-point 100;
- }
-
- forwarding-class af12 {
- loss-priority high code-point 101;
- }
-
- forwarding-class ef1 {
- loss-priority low code-point 111;
- }
-
- forwarding-class nc2 {
- loss-priority low code-point 110;
- }
- }
You can configure rewrite rules to replace DiffServ code points (DSCPs) on packets received from the customer or host with the values expected by other devices. You do not have to configure rewrite rules if the received packets already contain valid DSCPs. Rewrite rules apply the forwarding class information and packet loss priority used internally by the device to establish the DSCP on outbound packets. Once configured, you must apply the rewrite rules to the correct interfaces.
The following example shows how to create the rewrite rules rewrite-dscps and apply them to the device's Gibabit Ethernet interface ge-0/0/0. The rewrite rules replace the DSCPs on packets in the four forwarding classes, as shown in Table 262.
Table 262: Sample rewrite-dscps Rewrite Rules to Replace DSCPs
To configure and apply rewrite rules for the device:
Table 263: Configuring and Applying Rewrite Rules
Task |
J-Web Configuration Editor |
CLI Configuration Editor |
|---|---|---|
Navigate to the Class of service level in the configuration hierarchy. |
|
From the [edit] hierarchy level, enter edit class-of-service |
Configure rewrite rules for DiffServ CoS. |
|
Enter edit rewrite-rules dscp rewrite-dscps |
Configure best-effort forwarding class rewrite rules. |
|
Enter set forwarding-class be-class loss-priority low code-point 000000 set forwarding-class be-class loss-priority high code-point 000001 |
Configure expedited forwarding class rewrite rules. |
|
Enter set forwarding-class ef-class loss-priority low code-point 101110 set forwarding-class ef-class loss-priority high code-point 101111 |
Configure assured forwarding class rewrite rules. |
|
Enter set forwarding-class af-class loss-priority low code-point 001010 set forwarding-class af-class loss-priority high code-point 001100 |
Configure network control class rewrite rules. |
|
Enter set forwarding-class nc-class loss-priority low code-point 110000 set forwarding-class nc-class loss-priority high code-point 110001 |
Apply rewrite rules to an interface. (See the interface naming conventions in Network Interface Naming.) |
|
From the [edit class of service] hierarchy level, enter set interfaces ge-0/0/0 unit 0 rewrite-rules dscp rewrite-dscps |
You configure behavior aggregate classifiers to classify packets that contain valid DSCPs to appropriate queues. Once configured, you must apply the behavior aggregate classifier to the correct interfaces.
The following example shows how to configure the DSCP behavior aggregate classifier ba-classifier as the default DSCP map, and apply it to the device's Gigabit Ethernet interface ge-0/0/0. The behavior aggregate classifier assigns loss priorities, as shown in Table 264, to incoming packets in the four forwarding classes.
Table 264: Sample ba-classifier Loss Priority Assignments
To configure and apply behavior aggregate classifiers for the device:
Table 265: Configuring and Applying Behavior Aggregate Classifiers
Task |
J-Web Configuration Editor |
CLI Configuration Editor |
|---|---|---|
Navigate to the Class of service level in the configuration hierarchy. |
|
From the [edit] hierarchy level, enter edit class-of-service |
Configure behavior aggregate classifiers for DiffServ CoS. |
|
Enter edit classifiers dscp ba-classifier set import default |
Configure a best-effort forwarding class classifier. |
|
Enter set forwarding-class be-class loss-priority high code-points 000001 |
Configure an expedited forwarding class classifier. |
|
Enter set forwarding-class ef-class loss-priority high code-points 101111 |
Configure an assured forwarding class classifier. |
|
Enter set forwarding-class af-class loss-priority high code-points 001100 |
Configure a network control class classifier. |
|
Enter set forwarding-class nc-class loss-priority high code-points 110001 |
Apply the behavior aggregate classifier to an interface. (See the interface naming conventions in Network Interface Naming.) |
|
From the [edit class of service] hierarchy level, enter set interfaces ge-0/0/0 unit 0 classifiers dscp ba-classifier |
When you configure classes and define classifiers, you can refer to the markers by alias names. You can configure user-defined classifiers in terms of alias names. If the value of an alias changes, it alters the behavior of any classifier that references it.
To define a code-point alias on an SRX-series device, include the code-point-aliases statement at the [edit class-of-service] hierarchy level:
- [edit class-of-service]
- code-point-aliases {
- (dscp |exp | ieee-802.1 | inet-precedence) {
- alias-name bits;
- }
- }
The CoS marker types are as follows:
For example, you can set up the following configuration:
- [edit class-of-service]
- code-point-aliases {
-
- dscp {
-
- my1 110001;
- my2 101110;
-
- be 000001;
- cs7 110000;
- }
- }
The sample configuration produces this mapping:
user@host>show class-of-service code-point-aliases
dscpAlias Bit pattern ef/my2 101110 af11 001010 af12 001100 af13 001110 af21 010010 af22 010100 af23 010110 af31 011010 af32 011100 af33 011110 af41 100010 af42 100100 af43 100110 be 000001 cs1 001000 cs2 010000 cs3 011000 cs4 100000 cs5 101000 nc1/cs6/cs7 110000 nc2 111000 my1 110001
The following notes explain certain results in the mapping:
If the device must support assured forwarding, you can control congestion by configuring random early detection (RED) drop profiles. RED drop profiles use drop probabilities for different levels of buffer fullness to determine which scheduling queue on the device is likely to drop assured forwarding packets under congested conditions. The device can drop packets when the queue buffer becomes filled to the configured percentage.
Assured forwarding traffic with the PLP (packet loss priority) bit set is more likely to be discarded than traffic without the PLP bit set. This example shows how to configure a drop probability and a queue fill level for both PLP and non-PLP assured forwarding traffic. It is only one example of how to use RED drop profiles.
The example shows how to configure the RED drop profiles listed in Table 266.
Table 266: Sample RED Drop Profiles
To configure RED drop profiles for assured forwarding congestion control on the device:
Table 267: Configuring RED Drop Profiles for Assured Forwarding Congestion Control
Create a segmented configuration and an interpolated configuration that correspond to the graphs in Figure 105. The values defined in the configuration are matched to represent the data points in the graph line. In this example, the drop probability is 25 percent when the queue is 50 percent full. The drop probability increases to 50 percent when the queue is 75 percent full.
Figure 105: Segmented and Interpolated Drop Profiles

Segmented
- class-of-service {
-
- drop-profiles {
-
- segmented-style-profile {
- fill-level 25 drop-probability 25;
- fill-level 50 drop-probability 50;
- fill-level 75 drop-probability 75;
- fill-level 95 drop-probability 100;
- }
- }
- }
To create the profile’s graph line, the software begins at the bottom-left corner, representing a 0 percent fill level and a 0 percent drop probability. This configuration draws a line directly to the right until it reaches the first defined fill level, 25 percent for this configuration. The software then continues the line vertically until the first drop probability is reached. This process is repeated for all of the defined levels and probabilities until the top-right corner of the graph is reached.
Create a smoother graph line by configuring the profile with the interpolate statement. This allows the software to automatically generate 64 data points on the graph beginning at (0, 0) and ending at (100, 100). Along the way, the graph line intersects specific data points, which you define as follows:
Interpolated
- class-of-service {
-
- drop-profiles {
-
- interpolated-style-profile {
-
- interpolate {
- fill-level [ 50 75 ];
- drop-probability [ 25 50 ];
- }
- }
- }
- }
You configure schedulers to assign resources, priorities, and drop profiles to output queues. By default, only queues 0 and 3 have resources assigned.
![]() |
Note: SRX-series devices support hierarchical schedulers, including per-unit-schedulers. For more information, see Configuring CoS Hierarchical Schedulers. |
This example creates the schedulers listed in Table 268.
Table 268: Sample Schedulers
To configure schedulers for the device:
Table 269: Configuring Schedulers
You configure a scheduler map to assign a forwarding class to a scheduler, then apply the scheduler map to any interface that must enforce DiffServ CoS.
The following example shows how to create the scheduler map diffserv-cos-map and apply it to the device's Ethernet interface ge-0/0/0. The map associates the mf-classifier forwarding classes configured in Configuring and Applying a Firewall Filter for a Multifield Classifier to the schedulers configured in Configuring Schedulers , as shown in Table 270.
Table 270: Sample diffserv-cos-map Scheduler Mapping
To configure and apply scheduler maps:
Table 271: Configuring Scheduler Maps
Task |
J-Web Configuration Editor |
CLI Configuration Editor |
|---|---|---|
Navigate to the Class of service level in the configuration hierarchy. |
|
From the [edit] hierarchy level, enter edit class-of-service |
Configure a scheduler map for DiffServ CoS. |
|
Enter edit scheduler-maps diffserv-cos-map |
Configure a best-effort forwarding class and scheduler. |
|
Enter set forwarding-class be-class scheduler be-scheduler |
Configure an expedited forwarding class and scheduler. |
|
Enter set forwarding-class ef-class scheduler ef-scheduler |
Configure an assured forwarding class and scheduler. |
|
Enter set forwarding-class af-class scheduler af-scheduler |
Configure a network control class and scheduler. |
|
Enter set forwarding-class nc-class scheduler nc-scheduler |
Apply the scheduler map to an interface. (See the interface naming conventions in Network Interface Naming.) |
|
From the [edit class of service] hierarchy level, enter set interfaces ge-0/0/0 scheduler-map diffserv-cos-map |
Once you define a scheduler, you can include it in a scheduler map, which maps a specified forwarding class to a scheduler configuration. To do this, include the scheduler-maps statement at the [edit class-of-service] hierarchy level:
- [edit class-of-service]
- scheduler-maps {
-
- map-name {
- forwarding-class class-name scheduler scheduler-name;
- }
- }
After you have defined the scheduler map, you can associate it with an output interface. To do this, include the scheduler-map statement at the [edit class-of-service interfaces interface-name] hierarchy level:
Interface wildcards are supported.
You use schedulers to define the properties of output queues. These properties include the amount of interface bandwidth assigned to the queue, the size of the memory buffer allocated for storing packets, the priority of the queue, and the random early detection (RED) drop profiles associated with the queue.
You associate the schedulers with forwarding classes by means of scheduler maps. You can then associate each scheduler map with an interface, thereby configuring the hardware queues, packet schedulers, and RED processes that operate according to this mapping.
To configure class-of-service (CoS) schedulers, use the following sample configuration at the [edit class-of-service] hierarchy level:
- [edit class-of-service]
- interfaces {
-
- interface-name {
- scheduler-map map-name;
- scheduler-map-chassis map-name;
- schedulers number;
- shaping-rate rate;
-
- unit {
- output-traffic-control-profile profile-name;
- scheduler-map map-name;
- shaping-rate rate;
- }
- }
- }
- fabric {
-
- scheduler-map {
- priority (high | low) scheduler scheduler-name;
- }
- }
- scheduler-maps {
-
- map-name {
- forwarding-class class-name scheduler scheduler-name;
- }
- }
- schedulers {
-
- scheduler-name {
- buffer-size (percent percentage |
remainder | temporal microseconds );
- drop-profile-map loss-priority (any | low | medium-low
| medium-high | high) protocol (any | non-tcp | tcp) drop-profile profile-name;
- priority priority-level;
- transmit-rate (rate | percent percentage remainder) <exact | rate-limit>;
- }
- }
- traffic-control-profiles profile-name {
- delay-buffer-rate (percent percentage | rate);
- guaranteed-rate (percent percentage | rate);
- scheduler-map map-name;
- shaping-rate (percent percentage | rate);
- }
You configure a virtual channel to set up queuing, packet scheduling, and accounting rules to be applied to one or more logical interfaces. You then must apply the virtual channel to a particular logical interface. Virtual channels can be applied in different ways. For more information on virtual channels, see Configuring Virtual Channels. In the example here, an output firewall filter is used for directing traffic to a particular virtual channel.
The following example shows how to create the virtual channels branch1–vc, branch2–vc, and branch3–vc and apply them in the firewall filter choose-vc to the Services Router's T3 interface t3-1/0/0.
To configure and apply virtual channels for the Services Router:
Table 272: Configuring and Applying Virtual Channels
Task |
J-Web Configuration Editor |
CLI Configuration Editor |
|---|---|---|
Navigate to the Class of service level in the configuration hierarchy. |
|
From the [edit] hierarchy level, enter edit class-of-service |
Define the virtual channels branch1–vc, branch2–vc, branch3–vc, and the default virtual channel. You must specify a default virtual channel. |
|
|
Define the virtual channel group wan-vc-group to include the four virtual channels, and assign each virtual channel the scheduler map bestscheduler. |
|
|
Specify a shaping rate of 2 Mbps for each virtual channel within the virtual channel group. |
|
|
Apply the virtual channel group to the logical interface t3–1/0/0.0. (See the interface naming conventions in Network Interface Naming.) |
|
From the [edit class of service] hierarchy level, enter set interfaces t3–1/0/0 unit 0 virtual-channel-group wan-vc-group |
Create the firewall filter choose-vc to select the traffic that is transmitted on a particular virtual channel. |
|
|
Apply the firewall filter choose-vc to output traffic on the t3–1/0/0.0 interface. |
|
|
You can use adaptive shaping to limit the bandwidth of traffic flowing on a Frame Relay logical interface. If you configure and apply adaptive shaping, the device checks the backward explicit congestion notification (BECN) bit within the last inbound (ingress) packet received on the interface. For more information on adaptive shaping, see Configuring Adaptive Shaping for Frame Relay.
![]() |
Note: Adaptive shaping is not available on SRX 3400, SRX 3600, SRX 5600, and SRX 5800 devices. |
The following example shows how to create an adaptive shaper fr-shaper and apply it to the device's T1 interface t1-0/0/2. The adapter shaper limits the transmit bandwidth on the interface to 64 Kbps.
To configure and apply an adaptive shaper for the device:
Table 273: Configuring and Applying an Adaptive Shaper
Task |
J-Web Configuration Editor |
CLI Configuration Editor |
|---|---|---|
Navigate to the Class of service level in the configuration hierarchy. |
|
From the [edit] hierarchy level, enter edit class-of-service |
Define the adaptive shaper name and maximum transmit rate. |
|
Enter set adaptive-shapers fr-shaper trigger becn shaping-rate 64k |
Apply the adaptive shaper to the logical interface t1-0/0/2.0. (See the interface naming conventions in Network Interface Naming.) |
|
Enter set interfaces t1-0/0/2 unit 0 adaptive-shaper fr-shaper |