Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Understanding CoS Rewrite Rules

As packets enter or exit a network, edge switches might be required to alter the class-of-service (CoS) settings of the packets. This topic describes how to use rewrite rules to alter the CoS settings. It covers:

This topic covers:

How Rewrite Rules Work

Rewrite rules set the value of the CoS bits within a packet’s header. Each rewrite rule reads the current forwarding class and loss priority associated with the packet, locates the chosen CoS value from a table, and writes this CoS value into the packet header. For rewrites to occur, rewrite rules must be explicitly assigned to an interface. While a classifier assigns a forwarding class and packet loss priority (PLP) based on the code point in the packet’s header, a rewrite rule modifies the code point in the packet’s header based on the forwarding class and PLP. As the packet leaves the switch, the final CoS action is generally the application of a rewrite rule.

You can define rewrite rules for IPv4 and IPv6 traffic to network interfaces, aggregated Ethernet interfaces (also known as link aggregation groups (LAGs)), routed VLAN interfaces (RVIs), Layer 3 interfaces, and Layer 3 VLAN-tagged sub-interfaces. Multiple rewrite rules of different types can be assigned to a single interface.

You configure rewrite rules to alter CoS values in outgoing packets on the outbound interfaces of an edge switch to meet the policies of a targeted peer. This allows the downstream switch in a neighboring network to classify each packet into the appropriate service group.

Note: When an IP precedence rewrite rule is active, bits 3, 4, and 5 of the type-of-service (ToS) byte are always reset to zero when code points are rewritten.

Default Rewrite Rule

To define a rewrite rule on an interface, you can either create your own rewrite rule and enable it on the interface or enable a default rewrite rule. See Defining CoS Rewrite Rules (CLI Procedure).

Table 1 shows the default rewrite-rule mappings. These are based on the default bit definitions of Differentiated Services code point (DSCP), IEEE 802.1p, and IP precedence values and the default forwarding classes. You can configure multiple CoS rewrite rules for DSCP, IP precedence and IEEE 802.1p.

Note: By default, rewrite rules are not assigned to an interface. You must explicitly assign a user-defined or system-defined rewrite rule to an interface for the rewrites to occur.

When the CoS values of a packet match the forwarding class and packet-loss-priority (PLP) values, the switch rewrites markings on the packet based on the rewrite table.

Table 1: Default Packet Header Rewrite Mappings

Map from Forwarding Class

PLP Value

Map to DSCP Value

Map to IP Precedence Value

Map to IEEE 802.1p Value

assured-forwarding

low

af11

af11

ef

assured-forwarding

high

af12

af11

ef1

best-effort

low

be

be

be

best-effort

high

be

be

be1

expedited-forwarding

low

ef

ef

af11

expedited-forwarding

high

ef

ef

af12

network-control

low

nc1/cs6

nc1/cs6

nc1/cs6

network-control

high

nc2/cs7

nc2/cs7

nc2/cs7

Flexible CoS-Outer 802.1p Marking

In a service provider environment, a packet from a local network traverses a service provider network to reach its destination remote network. The Ethernet header in packets in the local network are normally tagged with a 32-bit IEEE 802.1q tag that defines a 16-bit field to identify the frame as an IEEE 802.1Q frame, a 3-bit 802.1p CoS priority, a 1-bit field to indicate frames eligible to be dropped during congestion, and a 12-bit VLAN ID. This 32-bit IEEE 802.1q tag that is inserted in the Ethernet header within the local network is called the inner VLAN tag in the Ethernet header. The VLAN ID in the inner VLAN tag refers to the VLAN ID in the local network. When these tagged packets enter the service provider network, they are encapsulated with another 32-bit 802.1q tag that again defines a 16-bit field to identify the frame as an IEEE 802.1Q frame, a 3-bit 802.1p CoS priority, a 1-bit field to indicate frames eligible to be dropped during congestion, and a 12-bit VLAN ID. This additional 32-bit 802.1q encapsulated tag is called the outer VLAN tag. The VLAN ID in the outer VLAN tag refers to the VLAN ID in the service provider network. The dual VLAN tagging in an Ethernet header helps in solving the limitation posed by building forwarding tables on the basis of VLAN tags. An outer VLAN tag is also called a metro tag because dual tagging is an essential requirement in a metropolitan network that comprises multiple VLANs, distinguishing which by appropriate tagging is essential for effective transmission of data. When dual-tagged packets exit the service provider network to enter the destination network, an edge switch in the destination network de-encapsulates the outer VLAN tag and transmits packets to the VLAN defined in the inner VLAN tag.

The 3-bit 802.1p CoS priority bit in the Ethernet header plays an important role in prioritizing packets in the local and service provider networks, and this priority might not be the same in both these networks. Therefore, it is necessary to re-mark (or rewrite) the priority bits to reprioritize packets before they enter a service provider network. For changing the priority, you must modify the priority bits in the outer VLAN tag. CoS on Juniper Networks EX Series switches provides the flexibility to rewrite the 802.1p priority bits in the outer VLAN tag to meet policies of a service provider network. You can use the same rewrite rule configuration that you use for re-marking packets on a local switch, to re-mark the priority bits in the outer VLAN tag.

Published: 2013-11-26