You can apply a rewrite rule to MPLS and IPv4 packet headers simultaneously. This allows you to initialize MPLS EXP and IP precedence bits at LSP ingress. You can configure different rewrite rules depending on whether the traffic is VPN or non-VPN.
The default MPLS EXP rewrite table contents are shown in Table 45.
Table 45: Default MPLS EXP Rewrite Table
By default, IP precedence rewrite rules alter the first three bits on the type-of-service (ToS) byte while leaving the last three bits unchanged. This default behavior applies to rewrite rules you configure for MPLS packets with IPv4 payloads.
To override the default MPLS EXP rewrite table and rewrite MPLS and IPv4 packet headers simultaneously, include the protocol statement at the [edit class-of-service interfaces interface-name unit logical-unit-number rewrite-rules exp rewrite-rule-name] hierarchy level:
The protocol statement defines the types of MPLS packets and packet headers to which the specified rewrite rule is applied. The MPLS packet can be a standard MPLS packet or an MPLS packet with an IPv4 payload. Specify the type of MPLS packet using the following options:
An alternative to overwriting the default with a rewrite-rules mapping is to configure the default packet header rewrite mappings, as shown in Applying Default Rewrite Rules.
By default, IP precedence rewrite rules alter the first three bits on the ToS byte while leaving the last three bits unchanged. This default behavior is not configurable. The default behavior applies to rules you configure by including the inet-precedence statement at the [edit class-of-service rewrite-rules] hierarchy level. The default behavior also applies to rewrite rules you configure for MPLS packets with IPv4 payloads. You configure these types of rewrite rules by including the mpls-inet-both or mpls-inet-both-non-vpn option at the [edit class-of-service interfaces interface-name unit logical-unit-number rewrite-rules exp rewrite-rule-name protocol] hierarchy level.
On an M320 or T-series routing platform, configure rewrite tables and apply them in various ways to achieve the following results:
- [edit class-of-service]
- rewrite-rules {
-
- exp exp-inet-table {
-
- forwarding-class best-effort {
- loss-priority low code-point 000;
- loss-priority high code-point 001;
- }
-
- forwarding-class assured-forwarding {
- loss-priority low code-point 010;
- loss-priority high code-point 011;
- }
-
- forwarding-class expedited-forwarding {
- loss-priority low code-point 111;
- loss-priority high code-point 110;
- }
-
- forwarding-class network-control {
- loss-priority low code-point 100;
- loss-priority high code-point 101;
- }
- }
-
- exp rule1 {
- ...
- }
-
- inet-precedence rule2 {
- ...
- }
- }
- exp rule_non_vpn {
- ...
- }
-
- interfaces {
-
- so-3/1/0 {
-
- unit 0 {
-
- rewrite-rules {
- exp rule1;
- inet-precedence rule2;
- exp exp-inet-table protocol mpls-inet-both; # For all VPN
traffic.
- exp rule_non_vpn protocol mpls-inet-both-non-vpn; # For
all non-VPN
# traffic.
- }
- }
- }
-
- so-3/1/1 {
-
- unit 0 {
-
- rewrite-rules {
- exp exp-inet-table protocol [mpls mpls-inet-both];
- }
- }
- }
- }