Applying Default Rewrite Rules
By default, rewrite rules are not usually applied to interfaces. If you want to apply a rewrite rule, you can either design your own rule and apply it to an interface, or you can apply a default rewrite rule.
The lone exception is that non-MPC MPLS-enabled interfaces use the default EXP rewrite rule, even if not configured.
To apply default rewrite rules, include one or more of the following statements 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] dscp default; dscp-ipv6 default; exp default; ieee-802.1 default vlan-tag (outer | outer-and-inner); inet-precedence default;
Table 1 shows the default rewrite rule mappings. These are based on the default bit definitions of DSCP, DSCP IPv6, EXP, IEEE, and IP CoS values, as shown in Default Aliases for CoS Value Bit Patterns Overview, and the default forwarding classes shown in Default Forwarding Classes.
When the software detects packets whose CoS values match the forwarding class and PLP values in the first two columns in Table 1, the software maps the header bits of those packets to the code-point aliases in the last column in Table 1. The code-point aliases in the last column map to the CoS bits shown in Default Aliases for CoS Value Bit Patterns Overview.
Map from Forwarding Class |
Loss Priority |
Map to DSCP/DSCP IPv6/ EXP/IEEE/IP |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Starting with Junos OS Release 21.1, PTX routers support two forwarding classes and four loss priorities for MPLS EXP default rewrite rules, as Table 2 shows.
Map from Forwarding Class |
Loss Priority |
Map to MPLS EXP Bits |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In the following example, the so-1/2/3.0
interface is assigned the
default DSCP rewrite rule. One result of this configuration is that each packet exiting
the interface with the expedited-forwarding
forwarding class and the
high
or low
loss priority has its DSCP bits
rewritten to the DSCP ef
code-point alias. Default Aliases for
CoS Value Bit Patterns Overview shows that this code-point alias maps to the
101110
bits.
Another result of this configuration is that all packets exiting the interface with the
best-effort
forwarding class and the high
or
low
loss priority have their EXP bits rewritten to the EXP
be
code-point alias.Default Aliases for
CoS Value Bit Patterns Overview shows that this code-point alias maps to the
000
bits.
To evaluate all the implications of this example, see Default Aliases for CoS Value Bit Patterns Overview and Table 1.
class-of-service { interfaces { so-1/2/3 { unit 0 { rewrite-rules { dscp default; } } } } }