| Description | This article describes how to configure VLAN CoS Marking in various scenarios. |
| Scope | FortiOS. |
| Solution |
To affect how network devices, such as switches, handle traffic, VLAN CoS (Class of Service) marking gives Ethernet frames inside an 802.1Q tagged frame a priority number (0–7). VLAN CoS Marking can be configured in different ways. Here is how to configure it, referring to FortiOS v7.6.4 and the newest releases.
config firewall policy
All traffic matching the policy will be correctly marked with CoS equal to <value>.
config firewall shaping-policy next
All traffic matching the traffic shaping policy will be marked with CoS equal to <3-bit_binary>. As explained in the documentation, VLAN CoS matching on a traffic shaping policy, anything defined in the firewall shaping-policy takes precedence over anything configured in the firewall policy if a specific session matches both the firewall policy and the firewall shaping-policy.
But, it is important to understand that firewall shaping-policy overrides firewall policy configuration, even if CoS is not enabled in the shaper. If traffic matches a traffic shaping policy, even if CoS is not configured in it, CoS marking will not work.
This is true when traffic is offloaded. If traffic matches the firewall policy, it is not offloaded; firewall shaping policy does not override firewall policy configuration if CoS is not enabled in the shaper. Here is an example (for disabling offloading, consider this documentation Technical Tip: FortiGate Disable Hardware Acceleration:
config firewall policy set traffic-shaper "MARKING"
config firewall shaper traffic-shaper
In this case, traffic will be marked with CoS equal to 5, according to the firewall policy. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.