Chapter 17 Traffic Shaping for FortiOS 5.0 : Examples : QoS using priority from ToS or differentiated services
  
QoS using priority from ToS or differentiated services
Configurations implementing QoS using the priority values defined in either global or specific ToS bit values are not capable of applying bandwidth limits and guarantees, but are capable of prioritizing traffic at per-packet levels, rather than uniformly to all services matched by the security policy.
In addition to configuring traffic prioritization, you may also choose to limit bandwidth being received by each interface. This can sometimes be useful in scenarios where you want to limit traffic levels, but do not want to configure traffic shaping within a security policy. This has the benefit of policing traffic at a point before the FortiGate unit performs most processing.
Note that if you implement QoS using ToS octet rather than security policies, the FortiGate unit applies QoS on a packet by packet basis, and priorities may be different for packets and services controlled by the same security policy. This is more granular control than prioritization by security policies, but has the drawbacks that quality of service is may not be uniform for multiple services controlled by the same security policy, packets will only use up to three of the six possible queues (queue 0 to queue 2), and bandwidth cannot be guaranteed. Other devices in your network must also be able to set or preserve ToS bits.
In this example, we limit the bandwidth accepted by each source interface, and then configure prioritized queuing on the destination interface based upon the value of the ToS bit located in the IP header of each accepted packet.
To limit bandwidth accepted by an interface, in the CLI, enter the following commands:
config system interface
edit <name_str>
set inbandwidth <rate_int>
next
end
where <rate_int> is the bandwidth limit in Kb/s. Excess packets will be dropped.
To configure priorities, in the CLI, configure the global priority value using the following commands:
config system global
set tos-based-priority {high | low | medium}
end
where high has a priority value of 0 and low is 2.
If you want to prioritize some ToS bit values differently than the global ToS-based priority, configure the priority for packets with that ToS bit value using the following commands:
config system tos-based-priority
edit <id_int>
set tos [0-15]
set priority {high | low | medium}
next
end
where and tos is the value of the ToS bit in the packet’s IP header, and high has a priority value of 0 and low is 2. Priority values configured in this location will override the global ToS-based priority.
See also 
QoS using priority from security policies
Example setup for VoIP
Sample configuration