To assign the rewrite-rules configuration to the output logical interface, include the rewrite-rules 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]
-
rewrite-rules {
-
dscp (rewrite-name | default) protocol protocol-types;
-
dscp-ipv6 (rewrite-name | default);
-
exp (rewrite-name | default) protocol protocol-types;
-
exp-push-push-push default;
-
exp-swap-push-push default;
-
ieee-802.1 (rewrite-name | default) inet-precvlan-tag (outer | outer-and-inner);
-
inet-precedence (rewrite-name | default) protocol protocol-types;
- }
On the M120 and MX-series routers, or an M320 router with an Enhanced III FPC, you can combine the dscp or inet-prec and exp options to set the DSCP or IP precedence bits and MPLS EXP bits independently on IP packets entering an MPLS tunnel.
The following example sets the DSCP bits to the bit configuration specified in zf-dscp on packets entering the MPLS tunnel on so-0/0/1 and sets the EXP bits to the bit configuration specified in zf-exp:
- [edit class-of-service interfaces]
- so-0/0/1 {
-
- unit 0 {
-
- rewrite-rules {
- dscp zf-dscp protocol mpls; # Applies to IPv4 packets entering
MPLS tunnel
- exp zf-exp; # Sets label EXP bits independently
- }
- }
- }
You can use interface wildcards for interface-name and logical-unit-number. You can also include Layer 2 and Layer 3 rewrite information in the same configuration.
![]() |
Note: On M-series platforms only, if you include the control-word statement at the [edit protocols l2circuit neighbor address interface interface-name] hierarchy level, the software cannot rewrite MPLS EXP bits. DSCP and DSCP IPv6 rewrite rules are only supported on IQ and IQ2 PICs installed on M320 and T-series routing platforms with Enhanced III FPCs. On M320 and T-series routing platforms, for a single interface, you cannot enable a rewrite rule on a subset of forwarding classes. You must assign a rewrite rule to either none of the forwarding classes or all of the forwarding classes. When you assign a rewrite rule to a subset of forwarding classes, the commit does not fail, and the subset of forwarding classes work as expected. However, the forwarding classes to which the rewrite rule is not assigned are rewritten to all zeros. For example, if you configure a Differentiated Services code point (DSCP) rewrite rule, the bits in the forwarding classes to which you do not assign the rewrite rule are rewritten to 000000; if you configure an IP precedence rewrite rule, the bits in the forwarding classes to which you do not assign the rewrite rule are rewritten to 000. |