Description | This article describes how to configure a schedule stitch which will be triggered during specific period in order to monitor the BGP. If the BGP which runs over IPsec is down, this tunnel will be restarted. |
Scope | FortiOS 7.0.x, 7.2.x, 7.4.x, 7.6.x. |
Solution |
For the purpose of this article, a simple IPsec configuration is used between 2 FortiGates and BGP over this tunnel.
IPsec configuration and BGP configuration:
edit "VPN2" config router bgp set as 65551 config neighbor
An automation stitch can be configured only based on the following events, but not for two or more at the same time:
For example, it is not possible to combine 'Schedule' and 'FortiOS Event Log'. The example below shows how it is possible to configure an Automation Stitch which will be enabled and disabled outside of business hours. If BGP goes down during the configured timeframe, an Automation Stitch will disable and re-enable the IPsec tunnel.
Automation Stitch which monitors the BGP over the IPsec and when BGP is down, IPsec is restarted (disable and enable the IPsec tunnel interface with 10 seconds delay between both actions).
Trigger condition, when the BGP is down:
config system automation-trigger
config system automation-stitch
config system automation-action set accprofile "super_admin" next
CLI script to bring up the IPsec:
config system automation-action edit "Restart_VPN_UP" set action-type cli-script set script "config system interface edit VPN2
Because the scheduled automation stitch supports only trigger at specific time, 2 scheduled automation stitches are needed. One will enable the 'VPN_restart_BGP' at the beginning of a specific time, and another one will disable it .
Scheduled automation stitch which enables the 'VPN_restart_BGP' stitch every day at 18:00 FW time:
config system automation-stitch edit "Activate_stitch_BGP" set trigger "Activate_Stitch_BGP" config actions edit 1 end next end
Scheduled automation stitch which disables the 'VPN_restart_BGP' stitch every day at 8:30 FW time:
config system automation-stitch edit "Deactivate_stitch_BGP" set description "deactivate stitch BGP during working hours" set trigger "Deactivate_Stitch_BGP" config actions edit 1 set action "Deactivate_BGP_Stitch" set required enable next end next end
config system automation-trigger edit "Activate_Stitch_BGP" set description "Activate BGP-IPSEC stitch every day after working hours" set trigger-type scheduled set trigger-hour 18 <----- Activated at 18:00 PM FW time. edit "Deactivate_Stitch_BGP" set description "deactivate BGP stitch during working hours" set trigger-type scheduled set trigger-hour 8 <----- Deactivated at 8:30 AM FW time. set trigger-minute 30 next |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.