Written for FortiOS 7.6 on FortiGate firewalls, and checked against Fortinet's CLI reference, administration guides and knowledge base. Most commands work the same on 7.4 and 8.0. get and show read settings, config opens a block you change with set, edit and next, and end saves it. Changes take effect as soon as you type end, so there's no separate commit. diagnose debug commands print nothing until you run diagnose debug enable, and keep running until you disable or reset them. Names, addresses and passwords are examples, so swap in your own.
Official links: FortiOS 7.6 CLI reference, FortiOS 7.6 CLI troubleshooting cheat sheet.
Getting around #
-
Show the model, serial number, firmware and uptimeFortiOS
get system status -
Show CPU, memory, sessions and uptimeFortiOS
get system performance status -
Show part of the config (only settings changed from the default)FortiOS
show system interface -
Show part of the config with every default tooFortiOS
show full-configuration system interface -
Show config lines that match some textFortiOS
show | grep port1 -
Show matching config with the block around itFortiOS
show firewall policy | grep -f port1 -
Stop output pausing at the end of each screenFortiOS
config system console set output standard end -
Leave a config block without saving the changeFortiOS
abort -
Go into a VDOM (when VDOMs are on)FortiOS
config vdom edit root -
Go into global settings (when VDOMs are on)FortiOS
config global
Basic setup #
-
Set the hostnameFortiOS
config system global set hostname fgt-hq end -
Set the admin idle timeout in minutesFortiOS
config system global set admintimeout 10 end -
Give an interface an IP address and allow management on itFortiOS
config system interface edit port2 set ip 192.168.10.1 255.255.255.0 set allowaccess ping https ssh next end -
Add a VLAN interfaceFortiOS
config system interface edit vlan10 set vdom root set interface port2 set vlanid 10 set ip 192.168.110.1 255.255.255.0 next end -
Add a default routeFortiOS
config router static edit 0 set gateway 203.0.113.1 set device wan1 next end -
Add a static routeFortiOS
config router static edit 0 set dst 10.20.0.0 255.255.255.0 set gateway 203.0.113.1 set device port2 next end -
Set the DNS serversFortiOS
config system dns set primary 192.168.10.53 set secondary 1.1.1.1 end -
Set a custom NTP serverFortiOS
config system ntp set ntpsync enable set type custom config ntpserver edit 1 set server pool.ntp.org next end end -
Add an admin userFortiOS
config system admin edit netadmin set accprofile super_admin set password ChangeMe-2026 next end -
Allow an admin to log in only from one networkFortiOS
config system admin edit netadmin set trusthost1 192.168.10.0 255.255.255.0 next endWarning: That admin can't log in from anywhere else. Set it on another admin first and test.
Interfaces and routing #
-
Show interfaces with addresses and statusFortiOS
get system interface physical -
Show an interface's speed, duplex and errorsFortiOS
diagnose hardware deviceinfo nic port2 -
Show the routing tableFortiOS
get router info routing-table all -
Show the route to one addressFortiOS
get router info routing-table details 198.51.100.10 -
Add a link aggregation (LACP) interfaceFortiOS
config system interface edit agg1 set vdom root set type aggregate set member port3 port4 set lacp-mode active next end -
Group interfaces into a zoneFortiOS
config system zone edit inside set interface port2 vlan10 next end -
Renew an interface's DHCP addressFortiOS
execute interface dhcpclient-renew wan1 -
Show the ARP table (kernel view)FortiOS
diagnose ip arp list -
Clear the ARP tableFortiOS
execute clear system arp table -
Show the ARP tableFortiOS
get system arp -
Show BGP neighboursFortiOS
get router info bgp summary -
Show OSPF neighboursFortiOS
get router info ospf neighbor
Routing protocols #
-
Set up OSPF in area 0FortiOS
config router ospf set router-id 10.255.255.1 config area edit 0.0.0.0 next end config network edit 1 set prefix 10.20.0.0 255.255.255.0 set area 0.0.0.0 next end end -
Set up a BGP neighbourFortiOS
config router bgp set as 65001 set router-id 10.255.255.1 config neighbor edit 10.0.12.2 set remote-as 65002 next end end -
Advertise a network in BGPFortiOS
config router bgp config network edit 1 set prefix 10.20.0.0 255.255.255.0 next end end -
Show BGP neighbour detailsFortiOS
get router info bgp neighbors -
Show BGP routesFortiOS
get router info bgp network -
Soft-reset all BGP sessions (keeps them up)FortiOS
execute router clear bgp all soft -
Reset all BGP sessionsFortiOS
execute router clear bgp allWarning: Drops every BGP session until they come back up.
-
Show OSPF interfacesFortiOS
get router info ospf interface -
Show policy routesFortiOS
diagnose firewall proute list
Objects and firewall policies #
-
Add an address objectFortiOS
config firewall address edit web-server-1 set subnet 10.20.0.0 255.255.255.0 next end -
Add an address groupFortiOS
config firewall addrgrp edit web-servers set member web-server-1 next end -
Add a custom service (port)FortiOS
config firewall service custom edit tcp-8443 set tcp-portrange 443 next end -
Add a firewall policy with NAT to the internetFortiOS
config firewall policy edit 0 set name inside-to-internet set srcintf port2 set dstintf wan1 set srcaddr all set dstaddr all set action accept set schedule always set service ALL set nat enable set logtraffic all next end -
Move a policy above anotherFortiOS
config firewall policy move 5 before 2 end -
Turn a policy off without deleting itFortiOS
config firewall policy edit 5 set status disable next end -
Delete a policyFortiOS
config firewall policy delete 5 end -
Show one policyFortiOS
show firewall policy 5 -
Forward a port to an inside server (virtual IP)FortiOS
config firewall vip edit web-https set extintf wan1 set portforward enable set extip 203.0.113.10 set mappedip 192.168.10.80 set extport 443 set mappedport 443 next end -
Find which policy some traffic would matchFortiOS
diagnose firewall iprope lookup 192.168.10.25 0 198.51.100.10 443 6 port2
Security profiles and inspection #
-
Turn on certificate inspection and the default profiles on a policyFortiOS
config firewall policy edit 5 set utm-status enable set ssl-ssh-profile certificate-inspection set av-profile default set webfilter-profile default set ips-sensor default set application-list default next end -
Show web filter rating statisticsFortiOS
diagnose webfilter fortiguard statistics -
Show the FortiGuard rating serversFortiOS
diagnose debug rating -
Show FortiGuard update statusFortiOS
diagnose autoupdate status -
Restart the IPS engineFortiOS
diagnose test application ipsmonitor 99Warning: Inspection pauses while it restarts.
-
Show the IP addresses behind FQDN objectsFortiOS
diagnose test application dnsproxy 6
Users and authentication #
-
Add a local userFortiOS
config user local edit jsmith set type password set passwd ChangeMe-2026 next end -
Add a user groupFortiOS
config user group edit vpn-users set member jsmith next end -
Add an LDAP serverFortiOS
config user ldap edit corp-ldap set server 192.168.10.20 set cnid sAMAccountName set dn dc=example,dc=com set type regular set username svc-fortigate set password ChangeMe-2026 next end -
Add a RADIUS serverFortiOS
config user radius edit corp-radius set server 192.168.10.21 set secret RadiusSecret next end -
Test a login against a RADIUS serverFortiOS
diagnose test authserver radius corp-radius pap netadmin ChangeMe-2026 -
Debug authenticationFortiOS
diagnose debug application fnbamd -1 -
List authenticated firewall usersFortiOS
diagnose firewall auth list
SD-WAN #
-
Turn on SD-WAN and add two internet linksFortiOS
config system sdwan set status enable config members edit 1 set interface wan1 set gateway 203.0.113.1 next edit 2 set interface wan2 set gateway 198.51.100.1 next end end -
Add a performance SLA (health check)FortiOS
config system sdwan config health-check edit internet set server 8.8.8.8 set members 1 2 next end end -
Show SD-WAN membersFortiOS
diagnose sys sdwan member -
Show health check results (loss, latency, jitter)FortiOS
diagnose sys sdwan health-check -
Show which links SD-WAN rules are usingFortiOS
diagnose sys sdwan service -
Show a link's SLA historyFortiOS
diagnose sys sdwan intf-sla-log wan1
DHCP and DNS #
-
Run a DHCP server on an interfaceFortiOS
config system dhcp server edit 0 set interface port2 set default-gateway 192.168.10.1 set netmask 255.255.255.0 set dns-service default config ip-range edit 1 set start-ip 192.168.10.100 set end-ip 192.168.10.200 next end next end -
List DHCP leasesFortiOS
execute dhcp lease-list -
Clear one DHCP leaseFortiOS
execute dhcp lease-clear 192.168.10.25 -
Answer DNS queries on an interfaceFortiOS
config system dns-server edit port2 set mode recursive next end
VDOMs #
-
Turn on multiple VDOMsFortiOS
config system global set vdom-mode multi-vdom endWarning: Logs you out, and moves the existing config into the root VDOM.
-
Add a VDOMFortiOS
config vdom edit root next end -
List VDOMsFortiOS
diagnose sys vd list
Sessions #
-
Clear any old session filter firstFortiOS
diagnose sys session filter clear -
Filter sessions by source addressFortiOS
diagnose sys session filter src 192.168.10.25 -
Filter sessions by destination portFortiOS
diagnose sys session filter dport 443 -
Show the current session filterFortiOS
diagnose sys session filter -
List the sessions that match the filterFortiOS
diagnose sys session list -
Clear the sessions that match the filterFortiOS
diagnose sys session clearWarning: With no filter set, this clears every session on the FortiGate.
-
Show session countsFortiOS
diagnose sys session stat
Packet capture and debug flow #
-
Capture traffic to and from an address on any interfaceFortiOS
diagnose sniffer packet any 'host 192.168.10.25' 4 0 l -
Capture one conversation on one interfaceFortiOS
diagnose sniffer packet port2 'host 192.168.10.25 and port 443' 4 100 a -
Reset debug settings firstFortiOS
diagnose debug reset -
Clear the old flow filterFortiOS
diagnose debug flow filter clear -
Debug the flow for one addressFortiOS
diagnose debug flow filter addr 192.168.10.25 -
Show function names in the flow debugFortiOS
diagnose debug flow show function-name enable -
Show which policies are checkedFortiOS
diagnose debug flow show iprope enable -
Add timestamps to debug outputFortiOS
diagnose debug console timestamp enable -
Trace the next 100 packetsFortiOS
diagnose debug flow trace start 100 -
Show debug output on the screenFortiOS
diagnose debug enable -
Stop debuggingFortiOS
diagnose debug disable -
Stop the flow traceFortiOS
diagnose debug flow trace stop
High availability #
-
Show the cluster, which unit is primary and whyFortiOS
get system ha status -
Check the members' configs matchFortiOS
diagnose sys ha checksum cluster -
Log in to another cluster memberFortiOS
execute ha manage 1 netadmin -
Fail over by resetting this unit's HA uptimeFortiOS
diagnose sys ha reset-uptimeWarning: If override is off, the other unit becomes primary. Run it on the current primary.
-
Set up active-passive HAFortiOS
config system ha set group-name fgt-cluster set mode a-p set password ChangeMe-2026 set hbdev port5 50 set priority 200 end -
Show HA details per memberFortiOS
diagnose sys ha dump-by group -
Force a config sync to the other unitFortiOS
execute ha synchronize start -
Show failover historyFortiOS
diagnose sys ha history read
IPsec VPN #
-
Show tunnels and whether they're upFortiOS
get vpn ipsec tunnel summary -
Show tunnel details, SAs and countersFortiOS
diagnose vpn tunnel list -
Show IKE gateways (phase 1)FortiOS
diagnose vpn ike gateway list -
Bring a tunnel's phase 2 upFortiOS
diagnose vpn tunnel up to-branch-p2 to-branch -
Reset a tunnel's phase 1FortiOS
diagnose vpn ike gateway clear name to-branchWarning: Drops the tunnel until it renegotiates.
-
Clear the old IKE debug filterFortiOS
diagnose vpn ike log filter clear -
Debug IKE for one remote peerFortiOS
diagnose vpn ike log filter rem-addr4 198.51.100.200 -
Turn on full IKE debuggingFortiOS
diagnose debug application ike -1
Logging #
-
Send logs to a syslog serverFortiOS
config log syslogd setting set status enable set server 192.168.10.70 end -
Send logs to FortiAnalyzerFortiOS
config log fortianalyzer setting set status enable set server 192.168.10.75 end -
Test the FortiAnalyzer connectionFortiOS
execute log fortianalyzer test-connectivity -
Show FortiAnalyzer log statusFortiOS
diagnose test application fgtlogd 1 -
Show only event logsFortiOS
execute log filter category event -
Show the logs stored on the FortiGateFortiOS
execute log display -
Send test log messagesFortiOS
diagnose log test
Firmware, backups and FortiGuard #
-
Back up the config to a TFTP serverFortiOS
execute backup config tftp fgt-hq.conf 192.168.10.60 -
Back up the config to an FTP serverFortiOS
execute backup config ftp fgt-hq.conf 192.168.10.60 backup BackupPass -
Restore the config from a TFTP serverFortiOS
execute restore config tftp fgt-hq.conf 192.168.10.60Warning: Replaces the whole config and reboots the FortiGate.
-
Upgrade firmware from a TFTP serverFortiOS
execute restore image tftp FGT_60F-v7.6.6.F-build3652-FORTINET.out 192.168.10.60Warning: Reboots the FortiGate. Check the upgrade path in the release notes and back up the config first.
-
Check FortiGuard licences and connectionFortiOS
get system fortiguard-service status -
Show the signature and engine versionsFortiOS
diagnose autoupdate versions -
Update signatures nowFortiOS
execute update-now -
Reboot the FortiGateFortiOS
execute rebootWarning: Stops all traffic until it's back up.
-
Shut down the FortiGateFortiOS
execute shutdown
Troubleshooting #
-
Ping from the FortiGateFortiOS
execute ping 198.51.100.10 -
Ping from one of the FortiGate's addressesFortiOS
execute ping-options source 192.168.10.1 -
Trace the route to a hostFortiOS
execute traceroute 198.51.100.10 -
Show the busiest processes (press q to quit)FortiOS
diagnose sys top -
Show processes by CPU, with a summaryFortiOS
diagnose sys top-summary -
Check whether the FortiGate is in conserve modeFortiOS
diagnose hardware sysinfo conserve -
Show NTP sync statusFortiOS
diagnose sys ntp status -
SSH to another device from the FortiGateFortiOS
execute ssh [email protected] -
Read the crash logFortiOS
diagnose debug crashlog read -
Test a login against an LDAP serverFortiOS
diagnose test authserver ldap corp-ldap netadmin ChangeMe-2026