Rewriting MPLS and IPv4 Packet Headers
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 48.
Table 48: Default MPLS EXP Rewrite Table
Forwarding Class | Loss Priority | CoS Value |
|---|---|---|
best-effort | low | 000 |
best-effort | high | 001 |
expedited-forwarding | low | 010 |
expedited-forwarding | high | 011 |
assured-forwarding | low | 100 |
assured-forwarding | high | 101 |
network-control | low | 110 |
network-control | high | 111 |
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:
- mpls—Applies the rewrite rule to MPLS packets and writes the CoS value to MPLS headers.
- mpls-inet-both—Applies the rewrite rule to VPN MPLS packets with IPv4 payloads. On Juniper Networks M120 Multiservice Edge Routers, M320 Multiservice Edge Routers, and T Series Core Routers, writes the CoS value to the MPLS and IPv4 headers. On other M Series Multiservice Edge Router routers, causes all ingress MPLS LSP packets with IPv4 payloads to be initialized with 000 code points for the MPLS EXP value, and the configured rewrite code point for IP precedence.
- mpls-inet-both-non-vpn—Applies the rewrite rule to non-VPN MPLS packets with IPv4 payloads. On Juniper Networks M120 Multiservice Edge Routers, M320 Multiservice Edge Routers, and T Series Core Routers, writes the CoS value to the MPLS and IPv4 headers. On other M Series Multiservice Edge Routers, causes all ingress MPLS LSP packets with IPv4 payloads to be initialized with 000 code points for the MPLS EXP value, and the configured rewrite code point for IP precedence.
An alternative to overwriting the default with a rewrite-rules mapping is to configure the default packet header rewrite mappings, as discussed 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.
Example: Rewriting MPLS and IPv4 Packet Headers
On M320 and T Series routers, configure rewrite tables and apply them in various ways to achieve the following results:
- For interface so-3/1/0, the three EXP rewrite
tables are applied to packets, depending on the protocol of the payload:
- IPv4 packets (VPN) that enter the LSPs on interface so-3/1/0 are initialized with values from rewrite table exp-inet-table. An identical 3-bit value is written into the IP precedence and MPLS EXP bit fields.
- IPv4 packets (non-VPN) that enter the LSPs on interface so-3/1/0 are initialized with values from rewrite table rule-non-vpn. An identical 3-bit value is written into the IP precedence and MPLS EXP bit fields.
- Non-IPv4 packets that enter the LSPs on interface so-3/1/0 are initialized with values from rewrite table rule1, and written into the MPLS EXP header field only. The statement exp rule1 has the same result as exp rule1 protocol mpls.
- For interface so-3/1/0, IPv4 packets transmitted over a non-LSP layer are initialized with values from IP precedence rewrite table rule2.
- For interface so-3/1/1, IPv4 packets that enter the LSPs are initialized with values from EXP rewrite table exp-inet-table. An identical 3-bit value is written into the IP precedence and MPLS EXP bit fields.
- For interface so-3/1/1, MPLS packets other than
IPv4 Layer 3 types are also initialized with values from table exp-inet-table. For VPN MPLS packets with IPv4 payloads, the
CoS value is written to MPLS and IPv4 headers. For VPN MPLS packets
without IPv4 payloads, the CoS value is written to MPLS headers only.[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];}}}}
Hide Navigation Pane
Show Navigation Pane
Download
SHA1