Rewrite Rules ONLY USE INTERNAL

16
<Course Title> Rewrite Rules INTERNAL USE ONLY

Transcript of Rewrite Rules ONLY USE INTERNAL

Page 1: Rewrite Rules ONLY USE INTERNAL

<Course Title>Rewrite Rules

INTERNAL U

SE ONLY

Page 2: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

2 www.juniper.net

CoS Processing—Packet Header Rewrite

Rewriting the class of service (CoS) bits in a packet header is the final stage of the CoS process. Once packets have been scheduled for transmission, the device can mark the header with CoS bits, which then can be used by the next-hop device. At the next device, the CoS process begins again, starting with a CoS-marked packet.

INTERNAL U

SE ONLY

Page 3: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 3

Role of Packet Header Rewrite

Forwarding class and loss priority form the CoS profile of a packet in a router. The purpose of packet rewrite is to efficiently convey a packet’s CoS profile to the next-hop router, based on the forwarding class and packet loss priority (PLP) value.

Rewrite rules essentially perform the opposite function of the behavior aggregate (BA) classifier (used when a packet enters the router). As the packet leaves the device, the CoS profile can be communicated to the next-hop router by marking the packet’s header with appropriate CoS values, providing a consistent end-to-end CoS policy for packets traversing the network.

INTERNAL U

SE ONLY

Page 4: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

4 www.juniper.net

Packet Header Rewrite Marking Options

The slide lists the CoS types you can set on outgoing packets.

INTERNAL U

SE ONLY

Page 5: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 5

Rewrite Rules and Tables

A rewrite rule is a mapping that links a forwarding class and PLP to a set of CoS bits for a particular protocol. A set of rewrite rules forms a rewrite table. Each rewrite rule reads the current forwarding class and loss priority information associated with the packet, locates the chosen CoS value from a table, and writes this CoS value into the packet header. You can configure more than one rewrite table for a protocol, mapping forwarding class and PLP combinations to different CoS values.

INTERNAL U

SE ONLY

Page 6: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

6 www.juniper.net

Default Rewrite Tables

The Junos OS provides several default rewrite tables, for all the protocols listed earlier in this material, but in general they are not applied to interfaces (that is, rewrite rules are generally disabled). One exception exists, though: MPLS-enabled interfaces implicitly use the default EXP rewrite rule.

The dscp-default rewrite table is the following:

Rewrite rule: dscp-default, Code point type: dscp, Index: 31 Forwarding class Loss priority Code point best-effort low 000000 best-effort high 000000 expedited-forwarding low 101110 expedited-forwarding high 101110 assured-forwarding low 001010 assured-forwarding high 001100 network-control low 110000 network-control high 111000

INTERNAL U

SE ONLY

Page 7: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 7

Default Rewrite Rule Mappings

In default rewrite tables, the mappings from forwarding class and PLP to CoS values is based on the default bit definitions of DSCP, DSCP IPv6, EXP, IEEE, and IP CoS values. When the Junos OS detects packets for which the CoS profile matches the forwarding class and PLP values listed in the first two columns in the table on the slide, it maps the header bits of those packets to the code-point aliases shown in the table.

INTERNAL U

SE ONLY

Page 8: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

8 www.juniper.net

Packet Header Rewrite Using Default Rewrite Tables

To use a default rewrite table, simply apply it to an interface within the class-of-service stanza. In the example on the slide, several rewrite rules are applied to the ge-0/0/0.0 interface. As packets arrive at the interface for transmission, the system applies the related default rewrite rule based on the packet’s protocol.

INTERNAL U

SE ONLY

Page 9: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 9

Packet Header Rewrite Using Custom Rewrite Tables

If the default rewrite tables do not meet your needs, you can create custom tables under the class-of-service rewrite-rules stanza. When the custom rewrite table is fully defined, apply it to an interface, again under the class-of-service stanza.

In the example on the slide, a custom dscp rewrite table has several rewrite rules, with forwarding classes and PLP values mapping to code points. This configuration example essentially says the following: When a packet belonging to, for example, the BestEffort forwarding class with high PLP arrives at interface ge-0/0/3, assign the dscp code point 000000 before the packet leaves the interface. The same process applies for packets with different forwarding classes and PLP values.

INTERNAL U

SE ONLY

Page 10: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

10 www.juniper.net

Using import to Simplify Rewrite Table Configuration

When creating a custom rewrite table, it is common practice to reuse several of the same settings that are found in the related default table of the same CoS type. Perhaps the default rewrite table works almost entirely for your needs, and you need to change just two of the settings. In these instances, you can use an existing rewrite table as a kind of template to simplify the configuration process.

To configure a new rewrite table that reuses settings from an existing table, use the import statement under the class-of-service rewrite-rules stanza and specify a default or custom rewrite table to use as a template. Next, define custom entries to create your specific requirements. The result is a merging of the template with the custom entries, with the new entries overriding the corresponding values in the underlying template.

In the example on the slide, a custom rewrite table uses the default EXP rewrite table as a template. (exp-default has the code point set to 001 for high PLP.) In addition, a custom entry specifies that for best effort traffic with high PLP, the code point is 000. The resulting custom rewrite table reuses many of the default EXP rewrite table’s settings, and the explicit configuration statement overrides the default code point setting for the best-effort forwarding class with high PLP.

INTERNAL U

SE ONLY

Page 11: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 11

Apply Packet Header Rewrite Within a Network

In general, the best place to use rewrite tables is within a network. Because traffic has already passed through your edge network device, you can push CoS markings onto packets and consider them trusted. Furthermore, other nodes in the network can leverage the traffic’s existing CoS values and use the more efficient BA classification method at ingress to minimize the CoS processing workload.

INTERNAL U

SE ONLY

Page 12: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

12 www.juniper.net

PE1 Configuration Example

The command output on the slide shows the relevant configuration components for the PE1 device in the diagram on the previous page. In step 1, a custom rewrite table uses the dscp default rewrite table as a template, along with two customized settings. In step 2, the fe-1/0/0 and fe-0/0/2 interfaces perform packet header rewrite using the custom rewrite table.

INTERNAL U

SE ONLY

Page 13: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 13

Rewrite Rules Based on Protocol

The type of rewrite table applied to a packet is determined by the protocol of the outgoing packet. Of course, the related rewrite table must be configured on the interface as well.

Packets Have Multiple Protocols

Every packet is associated with more than one protocol. For example, an IP packet on a virtual LAN (VLAN)-based Ethernet network uses two protocols, which means two options for CoS treatment. The Junos OS generally allows you to configure one CoS value, or both.

INTERNAL U

SE ONLY

Page 14: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

14 www.juniper.net

Rewrite Combination Options

The table on the slide shows several combinations of marking options based on the packet’s protocol(s).

Example

The example on the slide shows a rewrite rule that performs several tasks at once. The EXP entry detects MPLS packets with IPv4 headers inside, and uses the related rewrite table’s values to set both the MPLS EXP bits and the IPv4 IP precedence bits. The IEEE802.1 entry detects VLAN-tagged Ethernet packets, and uses the related rewrite table’s values to set the CoS values in both the inner and outer VLAN tags.INTERNAL U

SE ONLY

Page 15: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

www.juniper.net 15

Guidelines When Applying Rewrite Rules and Combinations

In general, you can configure multiple rewrite rules on a logical interface. However, many variations and restrictions exist for what is supported on a given platform. Often the hardware installed in a chassis is also a factor. For detailed information on supported rewrite combinations for a given platform, refer to the Junos Class of Service Configuration Guide.

INTERNAL U

SE ONLY

Page 16: Rewrite Rules ONLY USE INTERNAL

Rewrite Rules

16 www.juniper.net

INTERNAL U

SE ONLY