Applying Rewrite Rules to Output Logical Interfaces

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-prec vlan-tag (outer | outer-and-inner);inet-precedence (rewrite-name | default)protocol protocol-types;}

On M120 and M320 routers with an Enhanced III FPC and MX Series routers, 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.

For IQ PICs, you can only configure one IEEE 802.1 rewrite rule on a physical port. All logical ports (units) on that physical port should apply the same IEEE 802.1 rewrite rule. if you configure more than one IEEE 802.1 rewrite rule for the IQ PIC, the configuration check fails.

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 tunnelexp 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 routers 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 routers and T Series routers with Enhanced III FPCs.

For IQ PICs, you can only configure one IEEE 802.1 rewrite rule on a physical port. All logical ports (units) on that physical port should apply the same IEEE 802.1 rewrite rule.

On M320 routers and T Series routers, 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.