FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Description This articles describes how to copy the original DSCP marking when return traffic arrives as untagged on the FortiGate.
Scope FortiOS 7.2.1+ versions.

Initially, in order to have an understanding regarding the DSCP feature on FortiOS, read this related KB article:


Currently, there are two main ways on how to mark traffic with DSCP:


1) Directly via the firewall policy:


# config firewall policy

    edit <X>

        set diffserv-forward enable
        set diffservcode-forward <binary_integer>
        set diffserv-reverse enable
        set diffservcode-rev <binary_integer> 


2) Or via as SD-WAN rule:


# config system sdwan
# config service
    edit <X>
        set dscp-forward enable
        set dscp-reverse enable
        set dscp-forward-tag <binary_integer>
        set dscp-reverse-tag <binary_integer>


Let's assume, there is the below topology:




 - End hosts generate traffic towards the servers which are located behind Hub FortiGate.


- Spoke FortiGate is marking the traffic with the configured DSCP values for specific type of traffic.


- Servers usually do not have the capability to mark the right QoS values, so reply traffic is arriving as untagged on Hub FortiGate and traverses without the correct DSCP values on its way back to branch.


- In order to have bidirectional end-to-end QoS markings on the reply traffic as well, it is necessary to configure the firewall policy on the Hub with the below commands:


# config firewall policy

    edit <X>

        set diffserv-copy {enable | disable}



When the particular command is being enabled on a firewall policy, the following commands will become hidden:


# config firewall policy

    edit <X>