Created on
04-03-2025
07:27 AM
Edited on
05-05-2025
03:17 AM
By
Jean-Philippe_P
Description | This article describes the creation or deletion of a static route via CLI on the FortiGate. It will be useful in case the GUI is inaccessible. |
Scope | FortiGate. |
Solution |
To list active routes in the routing-table, run the command below:
get router info routing-table all Routing table for VRF=0
The following example shows CLI commands to create a static route to destination 192.168.100.0/24:
config router static edit 0 set dst 192.168.100.0/24 <----- Destination subnet and mask. set device port3 <----- Interface through which traffic will be forwarded. set gateway 192.168.10.2 <----- Next hop IP address. end
Once the above changes are applied, the new static route will appear in the routing-table:
get router info routing-table all Routing table for VRF=0 S 192.168.100.0/24 [10/0] via 192.168.10.2, port3, [1/0]
The following example shows CLI commands to delete a static route created in Step 1.
config router static show <----- Shows all static route entries. Based on the output below, entry 2 was created in step 1.
config router static
To find the route faster, the following format of command can be used:
config router static show | grep -f <network IP>
In this case, the example would be:
show | grep -f 192.168.100.0
config router static
And the field with the number of the policy will show up.
To delete entry 2, run the following commands:
delete 2 <----- Deletes entry 2. end <----- Saves changes.
Related articles: Technical Tip: How to create a static route on FortiGate from the GUI Interface Technical Tip: Configure static routes and black hole routes to different VRFs |
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.