0% found this document useful (0 votes)
14 views

Cos Rewrite

Uploaded by

RAMPrabhu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Cos Rewrite

Uploaded by

RAMPrabhu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

<CourseRules

Rewrite Title>

LY
N
O
SE
U
AL
N
R
TE
IN
Rewrite Rules

LY
N
O
SE
U
AL

CoS Processing—Packet Header Rewrite


N

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,
R

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.
TE
IN

2 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Role of Packet Header Rewrite


N

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
R

class and packet loss priority (PLP) value.


Rewrite rules essentially perform the opposite function of the behavior aggregate (BA) classifier
TE

(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.
IN

www.juniper.net 3
Rewrite Rules

LY
N
O
SE
U
AL

Packet Header Rewrite Marking Options


N

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

4 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Rewrite Rules and Tables


N

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
R

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
TE

table for a protocol, mapping forwarding class and PLP combinations to different CoS values.
IN

www.juniper.net 5
Rewrite Rules

LY
N
O
SE
U
AL

Default Rewrite Tables


N

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
R

disabled). One exception exists, though: MPLS-enabled interfaces implicitly use the default EXP
rewrite rule.
TE

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
IN

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

6 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Default Rewrite Rule Mappings


N

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
R

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
TE

shown in the table.


IN

www.juniper.net 7
Rewrite Rules

LY
N
O
SE
U
AL

Packet Header Rewrite Using Default Rewrite Tables


N

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
R

packets arrive at the interface for transmission, the system applies the related default rewrite rule
based on the packet’s protocol.
TE
IN

8 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Packet Header Rewrite Using Custom Rewrite Tables


N

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,
R

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
TE

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.
IN

www.juniper.net 9
Rewrite Rules

LY
N
O
SE
U
AL

Using import to Simplify Rewrite Table Configuration


N

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
R

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
TE

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
IN

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.

10 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Apply Packet Header Rewrite Within a Network


N

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
R

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
TE

workload.
IN

www.juniper.net 11
Rewrite Rules

LY
N
O
SE
U
AL

PE1 Configuration Example


N

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
R

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.
TE
IN

12 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Rewrite Rules Based on Protocol


N

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.
R

Packets Have Multiple Protocols


TE

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.
IN

www.juniper.net 13
Rewrite Rules

LY
N
O
SE
U
AL

Rewrite Combination Options


N

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

Example
TE

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
IN

and outer VLAN tags.

14 www.juniper.net
Rewrite Rules

LY
N
O
SE
U
AL

Guidelines When Applying Rewrite Rules and Combinations


N

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
R

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.
TE
IN

www.juniper.net 15
Rewrite Rules

LY
N
O
SE
U
AL
N
R
TE
IN

16 www.juniper.net

You might also like