Configuring Class of Service for IPv6 Traffic
The following topics describe class-of-service functions for IPv6 traffic and provide examples on how to configure classifiers and rewrite rules that use IPv6 DiffServ code points:
- Overview of Class-of-Service Functions for IPv6 Traffic
- Configuring and Applying a DSCP IPv6 BA Classifier
- Configuring DSCP IPv6 Rewrite Rules
Overview of Class-of-Service Functions for IPv6 Traffic
Class-of-service (CoS) processing for IPv6 traffic uses the IPv6 DiffServ code point (DSCP) value. The IPv6 DSCP value is the first six bits in the 8-bit Traffic Class field of the IPv6 header. The DSCP value is used to determine the behavior aggregate (BA) classification for the packet entering the network device. You use classifier rules to map the DSCP code points to a forwarding class and packet loss priority. You use rewrite rules to map the forwarding class and packet loss priority back to DSCP values on packets exiting the device.
Figure 12 shows the components of the CoS features for SRX Series and J Series devices, illustrating the sequence in which they interact.
Figure 12: Packet Flow Through an SRX Series or J Series Device

![]() | Note: Not all features are supported on all SRX Series devices. For information on the set of CoS features supported for your Juniper Networks device, see the JUNOS Software Feature Support Reference for SRX Series and J Series Devices. |
CoS components perform the following operations:
- BA classifier rules map DSCP code points to a forwarding class and loss priority. The forwarding class and loss priority determine the per-hop behavior of the packet throughout the system. The forwarding class associates a packet with an outbound transmission queue. Loss priority affects the scheduling of a packet without affecting the relative ordering of packets. BA classification is a simple way that “downstream” nodes can honor the CoS objectives that were encoded “upstream”.
- Multifield classifier rules overwrite the initial
forwarding class and loss priority determination read by the BA classifier
rule. You typically use multifield classifier rules on nodes close
to the content origin, where a packet might not have been encoded
with the desired DSCP values in the headers. A multifield classifier
rule assigns packets to a forwarding class and assigns a packet loss
priority based on filters, such as source IP, destination IP, port,
or application.
See Configuring and Applying a Firewall Filter for a Multifield Classifier.
- Input policers meter traffic to see if traffic flow exceeds its service level. Policers might discard, change the forwarding class and loss priority, or set the packet loss priority bit of a packet. A packet for which the packet loss priority bit is set has an increased probability of being dropped during congestion.
- Scheduler maps are applied to interfaces and associate
the outgoing packets with a scheduler and a forwarding class.
The scheduler manages the output transmission queue, including:
- Buffer size—Defines the period for which a packet is stored during congestion.
- Scheduling priority and transmit rate—Determine the order in which a packet is transmitted.
- Drop profile—Defines how aggressively to drop a packet that is using a particular scheduler.
- Output policers meter traffic and might change the forwarding class and loss priority of a packet if a traffic flow exceeds its service level.
- Rewrite rules map forwarding class and packet loss priority to DSCP values. You typically use rewrite rules in conjunction with multifield classifier rules close to the content origin; or when the device is at the border of a network and must alter the code points to meet the policies of the targeted peer.
Only BA classification rules and rewrite rules require special consideration to support CoS for IPv6 traffic. The program logic for the other CoS features is not sensitive to differences between IPv4 and IPv6 traffic.
Configuring and Applying a DSCP IPv6 BA Classifier
A behavior aggregate (BA) classifier rule maps DSCP code points to a forwarding class and loss priority. The forwarding class and loss priority determine the per-hop behavior of the packet throughout the system. The forwarding class associates a packet with an outbound transmission queue. Loss priority affects the scheduling of a packet without affecting the relative ordering of packets.
BA classification can be applied within one DiffServ domain or between two domains, where each domain honors the CoS results generated by the other domain. Table 67 shows the mapping for the default DSCP IPv6 BA classifier.
Table 67: Default IPv6 BA Classifier
Code Points | DSCP IPv6 Alias | Forwarding Class | Packet Loss Priority |
|---|---|---|---|
101110 | ef | expedited-forwarding | low |
001010 | af11 | assured-forwarding | low |
001100 | af12 | assured-forwarding | high |
001110 | af13 | assured-forwarding | high |
010010 | af21 | best-effort | low |
010100 | af22 | best-effort | low |
010110 | af23 | best-effort | low |
011010 | af31 | best-effort | low |
011100 | af32 | best-effort | low |
011110 | af33 | best-effort | low |
100010 | af41 | best-effort | low |
100100 | af42 | best-effort | low |
100110 | af43 | best-effort | low |
000000 | be | best-effort | low |
001000 | cs1 | best-effort | low |
010000 | cs2 | best-effort | low |
011000 | cs3 | best-effort | low |
100000 | cs4 | best-effort | low |
101000 | cs5 | best-effort | low |
110000 | nc1/cs6 | network-control | low |
111000 | nc2/cs7 | network-control | low |
You can use the CLI show command to display the settings for the CoS classifiers. The following command shows the settings for the default DSCP IPv6 classifier:
Displaying the settings for the default DSCP IPv6 classifier
user@host# show class-of-service classifier
type dscp-ipv6Classifier: dscp-ipv6-default, Code point type: dscp-ipv6, Index: 8 Code point Forwarding class Loss priority 000000 best-effort low 000001 best-effort low 000010 best-effort low 000011 best-effort low 000100 best-effort low 000101 best-effort low 011011 best-effort low ... Classifier: dscp-ipv6-compatibility, Code point type: dscp-ipv6, Index: 9 Code point Forwarding class Loss priority 000000 best-effort low 000001 best-effort low 000010 best-effort low 000011 best-effort low 000100 best-effort low 000101 best-effort low 000110 best-effort low 000111 best-effort low ...
![]() | Note: The predefined classifier named dscp-ipv6–compatibility maps all code points loss priority to low. It maps 110000 and 111000 (typically seen in network control packets) to the network-control class and all other code points to the best-effort class. The dscp-ipv6–compatibility is an implicit classifier similar to the ipprec-compatibility provided to map IP precedence bits in IPv4 traffic when no classifier has been configured. |
The following example CLI command associates the ge-0/0/0 interface with the default DSCP IPv6 classifier:
Using the default DSCP IPv6 BA classifier
user@host# set class-of-service interfaces ge-0/0/0
unit 0 classifiers dscp-ipv6 defaultuser@host# show class-of-service interfacesge-0/0/0 {
unit 0 {
classifiers {
dscp-ipv6 default;
}
}
}If necessary, you can create a user-defined DSCP IPv6 BA classifier with the CLI.
The following steps create a classifier named dscp-ipv6-example:
- Navigate to the [class-of-service] hierarchy:
user@host# edit class-of-service - For this example, use the following commands to
map queues to user-defined forwarding classes:
[edit class-of-service]user@host# set forwarding-classes queue 0 be-class[edit class-of-service]user@host# set forwarding-classes queue 1 ef-class[edit class-of-service]user@host# set forwarding-classes queue 2 af-class[edit class-of-service]user@host# set forwarding-classes queue 3 nc-class - Create a new behavior aggregate classifier for
DiffServ CoS:
[edit class-of-service]user@host# edit classifiers dscp-ipv6 dscp-ipv6-example - Import the default DSCP IPv6 classifier so that
it can be used to classify the code points you do not explicitly cover
in your configuration:
[edit class-of-service classifiers dscp-ipv6 dscp-ipv6-example]user@host# set import default - Specify a best-effort forwarding class classifier:
[edit class-of-service classifiers dscp-ipv6 dscp-ipv6-example]user@host# set forwarding-class be-class loss-priority high code-points 000001 - Specify an expedited forwarding class classifier:
[edit class-of-service classifiers dscp-ipv6 dscp-ipv6-example]user@host# set forwarding-class ef-class loss-priority high code-points 101111 - Specify an assured forwarding class classifier:
[edit class-of-service classifiers dscp-ipv6 dscp-ipv6-example]user@host# set forwarding-class af-class loss-priority high code-points 001100 - Specify a network control class classifier:
[edit class-of-service classifiers dscp-ipv6 dscp-ipv6-example]user@host# set forwarding-class nc-class loss-priority high code-points 110001 - Go to the [class-of-service] level in the hierarchy
and apply your user-defined classifier to an interface:
[edit class-of-service classifiers dscp-ipv6 dscp-ipv6–example]
user@host# up
[edit class-of-service classifiers]
user@host# up
[edit class-of-service]
user@host# set interfaces ge-0/0/0 unit 0 classifiers dscp-ipv6 dscp-ipv6-example - Use the show command to review your configuration.
If the output does not display the intended configuration, repeat
the configuration instructions in this example to correct it.
[edit class-of-service]
user@host# showclassifiers { dscp-ipv6 dscp-ipv6–example { import default; forwarding-class be-class { loss-priority high code-points 000001; } forwarding-class ef-class { loss-priority high code-points 101111; } forwarding-class af-class { loss-priority high code-points 001100; } forwarding-class nc-class { loss-priority high code-points 110001; } } } forwarding-classes { queue 0 be-class; queue 1 ef-class; queue 2 af-class; queue 3 nc-class; } interfaces { ge-0/0/0 { unit 0 { classifiers { dscp-ipv6 dscp-ipv6–example; } } } } - Check your changes to the configuration before
committing.
[edit class-of-service]
user@host# commit checkconfiguration check succeeds
- Commit the configuration.
[edit class-of-service]
user@host# commitcommit complete
Configuring DSCP IPv6 Rewrite Rules
A rewrite rule maps the forwarding class and loss priority after JUNOS CoS processing to a corresponding DSCP value specified in the rule. Typically, you use rewrite rules to alter the CoS values in outgoing packets to meet the requirements of the targeted peer.
You can use the CLI show command to display the configuration for the CoS classifiers. The following command shows the configuration of the default DSCP IPv6 rewrite rule:
Displaying the configuration for the default DSCP IPv6 rewrite rule
user@host# show class-of-service rewrite-rule
type dscp-ipv6Rewrite rule: dscp-ipv6-default, Code point type: dscp-ipv6, Index: 32 Forwarding class Loss priority Code point best-effort low 000000 best-effort high 000000 expedited-forwarding low 101110 expedited-forwarding high 101110 assured-forwarding low 001010 assured-forwarding high 001100 network-control low 110000 network-control high 111000
The following example configuration statement associates the ge-0/0/0 interface with the default DSCP IPv6 rewrite rule:
Using the default DSCP IPv6 rewrite rule
user@host# set class-of-service interfaces ge-0/0/0
unit 0 rewrite-rules dscp-ipv6 defaultuser@host# show class-of-service interfacesge-0/0/0 {
unit 0 {
classifiers {
dscp-ipv6 default;
}
rewrite-rules {
dscp-ipv6 default;
}
}
}If necessary, you can use the CLI to create a user-defined rewrite rule.
The following example configuration statements configure a rewrite rule named rewrite-ipv6-dscps:
- Navigate to the [class-of-service] hierarchy:
user@host# edit class-of-service - Create a user-defined rewrite rule:
user@host# edit rewrite-rules dscp-ipv6 rewrite-ipv6-dscps - Specify rewrite rules for the best-effort forwarding
class:
[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class be-class loss-priority low code-point 000000[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class be-class loss-priority high code-point 000001 - Specify rewrite rules for the expedited-forwarding
forwarding class:
[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class ef-class loss-priority low code-point 101110[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class ef-class loss-priority high code-point 101111 - Specify rewrite rules for the assured-forwarding
forwarding class:
[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class af-class loss-priority low code-point 001010[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class af-class loss-priority high code-point 001100 - Specify rewrite rules for the network-control forwarding
class:
[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class nc-class loss-priority low code-point 110000[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]user@host# set forwarding-class nc-class loss-priority high code-point 110001 - Go to the [class-of-service] level in the hierarchy
and associate an interface with your user-defined rule:
[edit class-of-service rewrite-rules dscp-ipv6 rewrite-ipv6-dscps]
user@host# up
[edit class-of-service rewrite-rules]
user@host# up
[edit class-of-service]
user@host# set interfaces ge-0/0/0 unit 0 rewrite-rules dscp rewrite-dscps - Use the show command to review your configuration.
The following example shows the classifier rules created in Configuring and Applying a DSCP IPv6 BA Classifier and the rewrite rules created
in this procedure:
[edit class-of-service]
user@host# showclassifiers { dscp-ipv6 dscp-ipv6–example { import default; forwarding-class be-class { loss-priority high code-points 000001; } forwarding-class ef-class { loss-priority high code-points 101111; } forwarding-class af-class { loss-priority high code-points 001100; } forwarding-class nc-class { loss-priority high code-points 110001; } } } forwarding-classes { queue 0 be-class; queue 1 ef-class; queue 2 af-class; queue 3 nc-class; } interfaces { ge-0/0/0 { unit 0 { classifiers { dscp-ipv6 dscp-ipv6–example; } rewrite-rules { dscp-ipv6 rewrite-ipv6-dscps; } } } } rewrite-rules { dscp-ipv6 rewrite-ipv6-dscps { forwarding-class be-class { loss-priority low code-point 000000; loss-priority high code-point 000001; } forwarding-class ef-class { loss-priority low code-point 101110; loss-priority high code-point 101111; } forwarding-class af-class { loss-priority low code-point 001010; loss-priority high code-point 001100; } forwarding-class nc-class { loss-priority low code-point 110000; loss-priority high code-point 110001; } } } - Check your changes to the configuration before
committing.
[edit class-of-service]
user@host# commit checkconfiguration check succeeds
- Commit the configuration.
[edit class-of-service]
user@host# commitcommit complete
