Created on
‎04-03-2025
07:27 AM
Edited on
‎04-14-2025
10:24 PM
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 delete entry 2, run the following commands:
delete 2 <----- Deletes entry 2. end <----- Saves changes.
Related article: Technical Tip: How to create a static route on FortiGate from the GUI Interface |