Technical Tip: Configuring a Firewall Policy which is valid only at certain days or hours by using a schedule
Description
This article describes an example of Firewall Policy rules where the Administrator needs to:
- On weekdays, allow all users to fully access the Internet during lunchtime and after business hours.
- Allow full access to the Internet without any restriction for users from a specific IP range, called Admin_PCs.
- During business hours, allow only access to www.fortinet.com and <my_business_web_site2> for the other users.
- No restrictions during the weekend.
Additional information about Firewall Policy can be found in the FortiGate Administration guides of each release. See also the related articles at the end of this page.
Scope
FortiGate.
Solution
Configuring the schedules.
Note:
edit "week-end"
set day sunday saturday
next
edit "lunch-time"
set day monday tuesday wednesday thursday friday
set end 14:00
set start 12:00
next
edit "late evening to early morning"
set day monday tuesday wednesday thursday friday
set end 08:00
set start 18:00
next
end
Configuring the IP addresses:
edit "Admin_PCs"
set type iprange
set end-ip 192.168.1.254
set start-ip 192.168.1.200
next
edit "www.fortinet.com"
set type fqdn
set fqdn "www.fortinet.com"
next
edit "my_business_web_site2"
set type fqdn
set fqdn "www.my_business_web_site2.com"
next
end
Configuring the firewall policies:
edit 6
set srcintf "internal"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set comments "Required for DNS requests anytime"
set schedule "always"
set service "DNS"
set nat enable
next
edit 1
set srcintf "internal"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set comments "week-end policy"
set schedule "week-end"
set service "ALL"
set nat enable
next
edit 2
set srcintf "internal"
set dstintf "wan1"
set srcaddr "Admin_PCs"
set dstaddr "all"
set action accept
set comments "Admin PCs no restriction"
set schedule "always"
set service "ALL"
set nat enable
next
edit 3
set srcintf "internal"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set comments "lunch time policy"
set schedule "lunch-time"
set service "ALL"
set nat enable
next
edit 4
set srcintf "internal"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set comments "late evening to early morning policy"
set schedule "late evening to early morning"
set service "ALL"
set nat enable
next
edit 5
set srcintf "internal"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "www.fortinet.com" "my_business_web_site2"
set action accept
set schedule "always"
set service "ALL"
set nat enable
next
end
Related articles
Technical Tip : Troubleshoot and verify if traffic is hitting a Firewall Policy