Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

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.

On EX Series switches, 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.

On EX4300 switches, you cannot configure separate DSCPv4 and DSCPv6 rewrite rules on network interfaces, aggregated Ethernet interfaces, Layer 3 interfaces, and integrated routing and bridging (IRB) interfaces. If you configure a DSCPv4 rewrite rule on an interface to rewrite IPv4 traffic, then the same rewrite rule is applied to IPv6 traffic also on that interface, and vice versa. You can define only DSCPv4 rewrite rules on integrated routing and bridging (IRB) interfaces and Layer 3 VLAN-tagged logical interfaces.

In effect, the rewrite rule performs the reverse function of the behavior aggregate (BA) classifier, which is used when the packet enters the switch. As the packet leaves the switch, the final CoS action is generally the application of a rewrite rule.

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/IEEE 802.1p/IP Precedence Value

expedited-forwarding

low

ef

expedited-forwarding

high

ef

assured-forwarding

low

af11

assured-forwarding

high

af12 (DSCP)

best-effort

low

be

best-effort

high

be

network-control

low

nc1/cs6

network-control

high

nc2/cs7