Rewriting the EXP Bits of All Three Labels of an Outgoing Packet
In interprovider, carrier-of-carrier, and complex traffic engineering scenarios, it is sometimes necessary to push three labels on the next hop, using a swap-push-push or triple-push operation.
By default, the top MPLS EXP label of an outgoing packet is not rewritten when you configure swap-push-push and triple-push operations. On M Series routers, you can rewrite the EXP bits of all three labels of an outgoing packet, thereby maintaining the CoS of an incoming MPLS or non-MPLS packet.
When the software performs a swap-push-push operation and no rewriting is configured, the EXP fields of all three labels are the same as in the old label. If there is EXP rewriting configured, the EXP bits of the bottom two labels are overwritten with the table entry. The EXP setting of the top label is retained even with rewriting.
To push three labels on all incoming MPLS packets, include the exp-swap-push-push default
statement at the [edit class-of-service
interfaces interface-name unit logical-unit-number rewrite-rules]
hierarchy level:
[edit class-of-service interfaces interface-name unit logical-unit-number rewrite-rules] exp-swap-push-push default;
When the software performs a push-push-push operation and if no rewriting is configured, the EXP fields of the bottom two labels are zero. If EXP rewriting is configured, the EXP fields of the bottom two labels are rewritten with the table entry’s rewrite value. The EXP field of the top label is inserted with the Qn+PLP value. This Qn reflects the final classification by a multifield classifier if one exists, regardless of whether rewriting is configured.
The exp-push-push-push
and exp-swap-push-push
configuration on the egress interface does not rewrite the top label’s
EXP field with the Qn+PLP value on an IQ or IQ2 PIC.
To push three labels on incoming non-MPLS packets, include the exp-push-push-push default
statement at the [edit class-of-service
interfaces interface-name unit logical-unit-number rewrite-rules]
hierarchy level:
[edit class-of-service interfaces interface-name unit logical-unit-number rewrite-rules] exp-push-push-push default;
These configurations apply the default MPLS EXP rewrite table, as described in Rewriting MPLS and IPv4 Packet Headers. You can configure these operations and override the default MPLS EXP rewrite table with a custom table. For more information about writing and applying a custom rewrite table, see Configuring Rewrite Rules and Applying Rewrite Rules to Output Logical Interfaces.
With a three-label stack, if you do not include the exp-swap-push-push default
or exp-push-push-push default
statement in the configuration, the top label’s EXP bits are
set to zero.
Example: Rewriting the EXP Bits of All Three Labels of an Outgoing Packet
Configure a swap-push-push operation, and override the default rewrite table with a custom table:
[edit class-of-service] forwarding-classes { queue 0 be; queue 1 ef; queue 2 af; queue 3 nc; } interfaces { so-1/1/3 { unit 0 { rewrite-rules { exp exp_rew; # Apply custom rewrite table exp-swap-push-push default; } } } } rewrite-rules { exp exp_rew { forwarding-class be { loss-priority low code-point 000; loss-priority high code-point 100; } forwarding-class ef { loss-priority low code-point 001; loss-priority high code-point 101; } forwarding-class af { loss-priority low code-point 010; loss-priority high code-point 110; } forwarding-class nc { loss-priority low code-point 011; loss-priority high code-point 111; } } }