Technical Tip: Remove comment (created by the IPSec template) from VPN tunnels on a managed FortiGate using TCL Script
| Description | The article describes how to remove the comment 'Created by IPSec Template' from FortiGate using a TCL script via FortiManager. If in any case IPSec templates assigned to FortiGate are removed and deleted from FortiManager, on the next install FortiManager will try to delete those IPSec tunnels (including the static routes).
The possible installation error could look like this:
SECURITY_CONSOLE: (1) [DEV-FW-01[copy] root] unassign template object vpn ipsec phase1-interface(ADVPN1) fail: used. detail: delete failed. solution: record is in-use (reason:none)
Or:
Post vdom failed:
Or:
SECURITY_CONSOLE: (1) [EVF-Cluster-HQ[copy] root] unassign template object vpn ipsec phase1- interface(VPN1) fail: Do not delete fortitoken during adom to device copy. (reason:none)
|
| Scope | FortiManager, FortiGate. |
| Solution | Remove the comment 'Created by IPSec Template' from IPSec Tunnels (phase1 and phase2) and their static routes, which can be an issue if there are multiple tunnels.
Make sure the FortiGate is compatible with FortiManager.
Follow the initial steps from this article on how to enable and run TCL scripts in FortiManager:
Note: The text on line#13 ('IPSec 'Template') is case-sensitive. Make sure to match it as it shows on the FortiGate config. The comment from static route #5 has been removed:
Run the script on the desired FortiGate; the script can run on one or more FortiGates at the same time. The comment has been removed from the VPN Tunnel:
Notes:
Related documents: Technical Tip: How to troubleshoot TCL Scripts failed in FortiManager Technical Tip: How to find the interface's MAC address Technical Tip: How to fetch FortiAP and FortiSwitch Serials using TCL Script in FortiManager |







