Fortinetguru Com 2019 10 Traffic Shaping
Fortinetguru Com 2019 10 Traffic Shaping
Fortinet GURU About Me Where Fortinet Is Messing Up Fortinet GURU Forums Consulting Services FortinetGURU @ YouTube
REPLY
Traffic shaping Search …
T raffic shaping
You can limit interface bandwidth for arriving and departing traffic. In some cases, the traffic received on an
LATEST VIDEOS
interfaces could exceed the maximum bandwidth limit defined in the security policy. Rather than waste
processing power on packets that will get dropped later in the process, you can configure FortiGate to
preemptively drop excess packets when they’re received at the source interface. A similar command is
available to the outgoing interface.
The following diagram shows how excess packets going from LAN to WAN1 can be intercepted and dropped
at the source interface.
4. Click OK.
end
This traffic prioritization method puts packets into the following queues based on its Type of Service (ToS)
value: l High l Medium l Low One Way VOIP Audio Quick Fix
ToS-based traffic prioritization cannot be used to apply bandwidth limits and guarantees, but it can be used
to prioritize traffic at per-packet levels.
You can use the following command to configure the default system-wide level of priority:
end
You can also prioritize packets according to the ToS bit value in the packet’s IP header by using the following
SD-WAN and Use Cases
command: config system tos-based-priority edit <id_int> set tos [0-15]
next
end
Example
The following configuration shows that packets with ToS bit values of 10 are prioritized as medium and
packets with ToS bit values of 20 are prioritized as high. All the other traffic is prioritized as low. Importing Policy to FortiManag er
config system global set traffic-priority-level low end
next
end
The maximum bandwidth indicates the largest amount of traffic allowed when using the policy. You can set
the maximum bandwidth to a value between 1 and 16776000 Kbps. The GUI displays an error if any value
outside this range is used. If you want to allow unlimited bandwidth, use the CLI to enter a value of 0.
The guaranteed bandwidth ensures that there is a consistent reserved bandwidth available. When setting the
guaranteed bandwidth, ensure that the value is significantly less than the interface’s bandwidth capacity.
Otherwise, the interface will allow very little or no other traffic to pass through, potentially causing unwanted Importing Policy to FortiManag er
latency.
In a shared traffic shaper, the administrator can prioritize certain traffic as high, medium, or low. FortiOS
provides bandwidth to low priority connections only when high priority connections do not need the
bandwidth. For example, you should assign a high traffic priority to a policy for connecting a secure web
server that needs to support e-commerce traffic. You should assign less important services a low priority.
When you configure a shared traffic shaper, you can apply bandwidth shaping per policy or for all policies. By
default, a shared traffic shaper applies traffic shaping evenly to all policies that use the shared traffic shaper.
When configuring a per-policy traffic shaper, FortiOS applies the traffic shaping rules defined for each security Don't Use FortiOS 6.2.4
policy individually. For example, if a per-policy traffic shaper is configured with a maximum bandwidth of 1000
Kbps, any security policies that have that traffic shaper enabled get 1000 Kbps of bandwidth each.
If a traffic shaper for all policies is configured with a maximum bandwidth of 1000 Kbps, all policies share the
1000 Kbps on a first-come, first-served basis.
The shared traffic shaper selected in the traffic shaping policy affects traffic in the direction defined in the
policy. For example, if the source port is LAN and the destination is WAN1, the traffic shaping affects the flow
in this direction only, affecting the outbound traffic’s upload speed. You can define the traffic shaper for the
policy in the opposite direction (reverse shaper) to affect the inbound traffic’s download speed. In this
example, that would be from WAN1 to LAN.
The following example shows how to apply different speeds to different types of service. The example
configures two shared traffic shapers to use in two firewall shaping policies. One policy guarantees a speed Free Fortinet T raining !
of 10 Mbps for VoIP traffic.
The other policy guarantees a speed of 1 Mbps for other traffic. In the example, FortiOS communicates with
a PC using port10 and the Internet using port9.
next
[6:0x0:0/(1,65535)->(5060,5060)] helper:auto
[0:0x0:0/(0,0)->(0,0)] helper:auto
2. To check if the correct traffic shaper is applied to the session, run the diagnose sys session list
command. The example output shows that the 1Mbps shaper is applied to the session:
origin-shaper=1Mbps prio=4 guarantee 128000Bps max 1280000Bps traffic 1050Bps drops 0B reply-shaper=
per_ip_shaper=
tx speed(Bps/kbps): 76/0 rx speed(Bps/kbps): 66/0 orgin->sink: org pre->post, reply pre->post dev=39->38/38-
>39 gwy=172.16.200.55/0.0.0.0 hook=post dir=org act=snat 10.1.100.11:58241-
>172.16.200.55:21(172.16.200.1:58241) hook=pre dir=reply act=dnat 172.16.200.55:21-
>172.16.200.1:58241(10.1.100.11:58241) pos/(before,after) 0/(0,0), 0/(0,0) misc=0 policy_id=1 auth_info=0
chk_client_info=0 vd=4 serial=0003255f tos=ff/ff app_list=0 app=0 url_cat=0 rpdb_link_id = 00000000 dd_type=0
dd_mode=0 npu_state=0x100000
3. To check statuses of shared traffic shapers, run the diagnose firewall shaper traffic-shaper list
command. The output should resemble the following: # dia firewall shaper traffic-shaper list
With per-IP traffic shaping, you can limit each IP address’s behavior to avoid a situation where one user uses
all of the available bandwidth. In addition to controlling the maximum bandwidth used per IP address, you can
also define the maximum number of concurrent sessions for an IP address. For example, if you apply a per-
IP shaper of 1 Mbps to your entire network, FortiOS allocates each user/IP address 1 Mbps of bandwidth.
Even if the network consists of a single user, FortiOS allocates them 1 Mbps. If there are ten users, each user
gets 1 Mbps of bandwidth, totaling 10 Mbps of outgoing traffic.
For shared shapers, all users share the set guaranteed and maximum bandwidths. For example, if you set a
shared shaper for all PCs using an FTP service to 10 Mbps, all users uploading to the FTP server share the 10
Mbps.
Shared shapers affect upload speed. If you want to limit the download speed from the FTP server in the
example, you must configure the shared shaper as a reverse shaper. Per-IP shapers apply the speed limit on
both upload and download operations.
The following example shows how to apply a per-IP shaper to a traffic shaping policy. This shaper assigns
each user a maximum bandwidth of 1 Mbps and allows each user to have a maximum of ten concurrent
connections to the FTP server. In the example, FortiOS communicates with users using port10 and the FTP
server using port9.
config firewall policy edit 1 set name “FTP Access” set srcintf “port10” set dstintf “port9” set srcaddr “all” set
dstaddr “FTP_Server” set action accept set schedule “always” set service “ALL” set fsso disable set nat enable
next
end
config firewall shaper per-ip-shaper edit “FTP_Max_1M” set max-bandwidth 1000 set max-concurrent-session
10
next
end
config firewall shaping-policy edit 1 set name “FTP speed 1M” set service “ALL” set dstintf “port9”
set per-ip-shaper “FTP_Max_1M” set srcaddr “PC1” “WinPC” “PC2” set dstaddr “FTP_Server”
next
end
1. To check if specific traffic is attached to the correct traffic shaper, run the diagnose firewall iprope list
100015 command. The example output shows the traffic attached to the FTP_Max_1M shaper:
policy index=3 uuid_idx=0 action=accept flag (0): shapers: per-ip=FTP_Max_1M cos_fwd=0 cos_rev=0
group=00100015 av=00000000 au=00000000 split=00000000 host=2 chk_client_info=0x0 app_list=0
ips_view=0 misc=0 dd_type=0 dd_mode=0 zone(1): 0 -> zone(1): 38
[0:0x0:0/(0,65535)->(0,65535)] helper:auto
2. To check if the correct traffic shaper is applied to the session, run the diagnose sys session list
command. The example output shows that the FTP_Max_1M shaper is applied to the session:
tx speed(Bps/kbps): 0/0 rx speed(Bps/kbps): 0/0 orgin->sink: org pre->post, reply pre->post dev=39->38/38-
>39 gwy=172.16.200.55/0.0.0.0 hook=post dir=org act=snat 10.1.100.11:58275-
>172.16.200.55:21(172.16.200.1:58275) hook=pre dir=reply act=dnat 172.16.200.55:21-
>172.16.200.1:58275(10.1.100.11:58275) pos/(before,after) 0/(0,0), 0/(0,0) misc=0 policy_id=1 auth_info=0
chk_client_info=0 vd=2 serial=0000211a tos=ff/ff app_list=0 app=0 url_cat=0 rpdb_link_id = 00000000
dd_type=0 dd_mode=0 npu_state=0x100000
3. To check statuses of per-IP traffic shapers, run the diagnose firewall shaper per-ip-shaper list
command. The output should resemble the following: # diagnose firewall shaper per-ip-shaper list
tos ff/ff packets dropped 0 bytes dropped 0 addr=10.1.100.11 status: bps=0 ses=3
Priority queues
After packet acceptance, FortiOS classifies traffic and may apply Quality of Service techniques such as
prioritization and traffic shaping. Traffic shaping consists of a mixture of traffic policing to enforce bandwidth
limits and priority queue adjustment to assist packets in achieving the guaranteed rate.
If you have configured prioritization, FortiOS prioritizes egressing packets by distributing them among first in
first out queues associated with each possible priority number. Each physical interface has six priority queues.
Virtual interfaces use the priority queues of the physical interface to which they are bound.
Each physical interface’s six queues are queue 0 to queue 5, where queue 0 is the highest priority queue.
However, you may observe that your traffic uses only a subset of those six queues. For example, some
traffic may always use a certain queue number. Queuing may also vary by the packet rate or mixture of
services. Some queue numbers may only be used by through traffic for which you have configured traffic
shaping in the security policy that applies to that traffic session.
Traffic matching firewall policies without traffic shaping may use queue 0, queue 1, or queue 2. The queue is
selected based on the priority value you have configured for packets with that Type of Service (ToS) bit value,
if you have configured ToS-based priorities.
Traffic matching firewall shaping policies with traffic shaper enabled may use any queue. The queue is
selected based on whether the packet rate is currently below the guaranteed bandwidth (queue 0), or above
the guaranteed bandwidth. Packets at rates greater than the maximum bandwidth limit are dropped.
Priority types
On entering ingress – for packets flowing through the firewall. l Upon generation – for packets
generated by the firewall (including packets generated due to AV proxying).
On passing through a firewall policy – for packets passing through a firewall policy (firewall shaping
policy) that has a traffic shaper defined.
T oS priority
The first and second types, ingress priority and priority for generated packets, are controlled via two different
CLI settings, as shown below:
end
config system tos-based-priority edit 1 set tos [0-15] -> type of service bit in the IP datagram header with a
value between 0 and 15
next
end
T oS priority Value
High 0
Medium 1
Low 2
In a firewall shaping policy, you can enable traffic shaping. In the shared traffic shaper, you can set the
firewall priority to high, medium, or low, as shown below:
next
end
Since the priority in a traffic shaper is set to high by default, you must set some traffic at a lower priority to
see results. Each priority level is mapped to a value as follows:
High (default) 1
Medium 2
Low 3
To combine the two priority types, the global or ingress ToS-based priority value is combined with the firewall
policy priority value:
ToS priority (0, 1, 2) + policy priority (1, 2, 3) = total priority (queue number)
If the current packet rate is less than the guaranteed bandwidth, packets use priority queue 0. Packet
priority is 0. l If the current packet rate exceeds the maximum bandwidth, excess packets are dropped.
If the current packet rate is greater than the guaranteed bandwidth but less than the maximum
bandwidth, FortiOS assigns a priority queue by adding the ToS-based priority and the firewall priority.
For example, if you have enabled traffic shaping in the security policy and the security policy’s traffic
priority is low (value 3), and the priority normally applied to packets with that ToS bit is medium (value
1), the packets have a total packet priority of 4, and use priority queue 4.
Priority Queues
After packet acceptance, FortiGate classifies traffic and might apply Quality of Service (QoS) techniques, such
as prioritization and traffic shaping. Traffic shaping consists of a mixture of traffic policing to enforce
bandwidth limits and priority queue adjustment to assist packets in achieving the guaranteed rate.
If you have configured prioritization, the FortiGate unit prioritizes egressing packets by distributing them
among FIFO (first in, first out) queues associated with each possible priority number. Each physical interface
has six priority queues. Virtual interfaces use the priority queues of the physical interface to which they are
bound.
Each physical interface’s six queues are queue 0 to queue 5, where queue 0 is the highest priority queue.
However, you might observe that your traffic uses only a subset of those six queues. For example, some
traffic might always use a certain queue number. Queuing may also vary by the packet rate or mixture of
services. Some queue numbers might only be used by through traffic for which you have configured traffic
shaping in the security policy that applies to that traffic session.
T ypes of priority
The first and second types (ingress priority and priority for generated packets) are controlled via two different
CLI settings:
end And
config system tos-based-priority edit 1 set tos [0-15] -> type of service bit in the IP datagram header with a
value between 0 and 15
next
end
T oS Priority Value
High 0
Medium 1
Low 2
In a firewall shaping policy, you can enable traffic shaping. In the shared traffic shaper, you can set the
firewall priority to high, medium, or low:
next
end
Since priority in traffic shaper are set to “high” priority by default, it is necessary to set some traffic at a lower
priority to get results. Each priority level is mapped to a value like following:
High (default) 1
Medium 2
Low 3
Combination priority
The global or ingress ToS-based priority value is combined with the firewall policy priority value:
Tos priority (0, 1, 2) + policy priority (1, 2, 3) = total priority (queue number) Let’s take a look at some
scenarios:
Case 1: If the current packet rate is less than the guaranteed bandwidth, packets use priority queue 0. In other
words, packet priority = 0.
Case 2:If the current packet rate exceeds the maximum bandwidth, excess packets are dropped.
Case 3:If the current packet rate is greater than the guaranteed bandwidth, but less than maximum
bandwidth, the FortiGate unit assigns a priority queue by adding the ToS-based priority and the firewall
priority.
For example, if you have enabled Traffic Shaping in the security policy, and the security policy’s Traffic Priority
is Low (value 3), and the priority normally applied to packets with that ToS bit is medium (value 1), then
packets have a total packet priority of 4, and use priority queue 4.
Share this:
Having trouble config uring your Fortinet hardware or have some questions you need answered?
Check Out T he Fortinet Guru Youtube Channel! Want someone else to deal with it for you? Get
some consulting from Fortinet GURU!
Don't Forg et T o visit the YouT ube Channel for the latest Fortinet T raining Videos and Question /
Answer sessions!
- FortinetGuru YouT ube Channel
- FortiSwitch T raining Videos
Multicast processing and basic Multicast policy Security Profiles – AntiVirus – FortiOS 6.2
Your Name *
Your Email *
Your Website
Save my name, email, and website in this browser for the next time I comment.
POST COMMENT
This site uses Akismet to reduce spam. Learn how your comment data is processed.