Configuring application control traffic shaping
Application control traffic shaping gives you more control over the amount of bandwidth that applications use. If an application is necessary, but you need to prevent it from impacting bandwidth, you can use a traffic shaping policy to limit the amount of bandwidth that the application is permitted to use, instead of blocking it entirely. Applying traffic shaping to applications is useful for managing bandwidth-intensive applications, such as YouTube, that use the same TCP and UDP port numbers as mission-critical applications.
Application control traffic shaping works together with shared traffic shapers and per-IP traffic shapers in traffic shaping policies. You can control traffic by application, application category, and FortiGuard web filter categories (URL category). You configure application control traffic shaping in the FortiGate GUI or FortiGate CLI, by performing the following tasks:
- Enable application control in a security policy.
- Create a traffic shaper with the bandwidth settings that you want to enforce.
- Create a traffic shaping policy, where you configure application control options, enable the traffic shaper, and specify which security policy to apply the traffic shaper to.
Enabling application control in a security policy
Create a general Internet access security policy and enable application control in the policy. Alternatively, you can edit an existing security policy.
Enable application control in a security policy – GUI
- Go to Policy & Objects > IPv4 Policy.
- Select Create New.
- In the Name field, enter a name for the security policy.
- Set the Incoming Interface field to the appropriate incoming interface.
- Set the Outgoing Interface field to the appropriate outgoing interface.
- Set the Source field to the appropriate source.
- Set the Destination field to the appropriate destination.
- Set the Schedule field to the schedule that you want to use.
- Set the Service field to the service and service group names that you want to use.
- Set the Action field to ACCEPT.
- In the Security Profiles section, enable Application Control, and select an application control profile.
- Select OK.
Enable application control in a security policy – CLI
config firewall policy
edit <policy_ID>
set name <policy_name>
set srcintf <incoming_interface>
set dstintf <outgoing_interface>
set srcaddr <source_address_name>
set dstaddr <destination_address_name>
set schedule <schedule_name>
set service <service>
set action accept
set utm-status enable
set application-list <application_list>
set nat enable
next
end
Creating a traffic shaper with the bandwidth settings that you want to enforce
Create traffic shapers with the bandwith settings that you want to apply to applications. You can create shared policy traffic shapers or per-IP traffic shapers.
To create a shared policy shaper, see Configuring shared policy traffic shaping.
To create a per-IP traffic shaper, see Configuring per-IP traffic shaping.
Creating a traffic shaping policy
Create a new traffic shaping policy and apply it to the security policy that you created above.
Create a traffic shaping policy – GUI
- Go to Policy & Objects > Traffic Shaping Policy.
- Select Create New.
- In the IP Version field, select IPv4 or IPv6.
- In the Name field, enter a name for the traffic shaping policy.
- In the If Traffic Matches section, set the following options:
GUI option
Value
Source
Set this to the appropriate source.
Destination
Set this to the appropriate destination.
Service
Set this to the service and service group names that you want to use.
Application
Select applications that you want to apply traffic shaping to.
Select application categories that you want to apply traffic shaping to.
URL Category
Set this to a FortiGuard web filter category.
- In the Then section, set the following options:
GUI option
Value
Action
Apply Shaper
Outgoing interface
Set this to the outgoing interface that matches the outgoing interface of the security policy that you want to apply traffic shaping to.
Shared shaper
Enable this option, and select a traffic shaper in the drop-down list.
Reverse shaper
Enable this option, and select a traffic shaper in the drop-down list.
Per-IP shaper
Enable this option, and select a traffic shaper in the drop-down list.
- Select OK.
Create a traffic shaping policy – CLI
config firewall shaping-policy
edit <shaping_policy_ID>
set ip-version {4 | 6}
set name <policy_name>
set srcaddr <source_address>
set dstaddr <destination_address>
set service <service_name>
set application <application_name>
set app-category <application_category_ID_list>
set url-category <URL_category_ID_list>
set dstintf <destination_interface_list>
set traffic-shaper <traffic_shaper_name>
set traffic-shaper-reverse <reverse_traffic_shaper_name>
set per-ip-shaper <per_IP_shaper_name>
next
end
Example: Configuring traffic shaping for Facebook
The following example shows how to configure application control traffic shaping for Facebook, with a medium priority.
Example using the FortiGate GUI
Create a general Internet access security policy by completing the following tasks:
- Go to Policy & Objects > IPv4 Policy.
- Select Create New.
- Set Name to
Internet access
. - Set Incoming Interface to Internal.
- Set Outgoing Interface to wan1.
- Set Source to all.
- Set Destination to all.
- Set Schedule to always.
- Set Service to ALL.
- Set Action to ACCEPT
- In the Security Profiles section, enable Application Control, and select the default application control profile.
- Select OK.
Example using the FortiGate CLI
- Create a general Internet access security policy by entering the following commands:
config firewall policy
edit 1
set name Internet access
set srcintf Internal
set dstintf wan1
set srcaddr all
set dstaddr all
set schedule always
set service ALL
set action accept
set utm-status enable
set application-list default
set nat enable
next
end
- Create a new traffic shaping policy and apply it to the security policy that you created above by entering the following commands:
config firewall shaping-policy
edit 1
set ip-version 4
set name Facebook
set srcaddr all
set dstaddr all
set service ALL
set application 15832
set app-category 23
set url-category 37
set dstintf wan1
set traffic-shaper medium-priority
set traffic-shaper-reverse medium-priority
next
end