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. Rewrite rules set the value of the CoS bits within the 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.
In effect, the rewrite rule performs the opposite function of the behavior aggregate (BA) classifier 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 ToS byte are always reset to zero when code-points are rewritten. |
Default Rewrite Rule
By default, rewrite rules are applied to routed packets and are not applied to forwarded packets. If you want to apply a rewrite rule, you can either configure your own rule or apply a default rewrite rule.
Table 1 shows the default rewrite rule mappings. These are based on the default bit definitions of DSCP, IEEE 802.1p, and IP precedence values and the default forwarding classes.
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 rewrite-rule table.
Table 1: Default Packet Header Rewrite Mappings





