CLI Commands for Troubleshooting FortiGate Firewalls

This blog post is a list of common troubleshooting commands I am using on the FortiGate CLI. It is not complete nor very detailled, but provides the basic commands for troubleshooting network related issues that are not resolvable via the GUI. I am not focused on too many memory, process, kernel, etc. details. These must only be used if there are really specific problems. I am more focused on the general troubleshooting stuff. I am using it personally as a cheat sheet / quick reference and will update it from time to time.

Coming from Cisco, everything is “show”. With Fortinet you have the choice confusion between show | get | diagnose | execute. Not that easy to remember. It is “get router info6 routing-table” to show the routing table but “diagnose firewall proute6 list” for the PBF rules. Likewise the sys | system keyword. It is always “diagnose sys” but “execute system”.

Entering the correct vdom/gobal config

Remember to enter the correct vdom or global configuration tree before configuring anything:

To execute any “show” command from any context use the sudo keyword with the global/vdom-name context followed by the normal commands (except “config”) such as:

Show running-config & grep & scp

To show the running configuration (such as “show run” on Cisco) simply type:

To show the entire running configuration with default values use:

When you are in a config submenu you can list the subsequent configuration options with all further submenus with:

For example:

To omit the “–More–” stops when displaying many lines, you can set the terminal output to the following, which will display all lines at once. This is similar to “terminal length 0” from Cisco. Be careful with it, because this command is persistent. Set it to default after usage!

To find a CLI command within the configuration, you can use the pipe sign “|” with “grep” (similar to “include” on Cisco devices). Note the “-f” flag to show the whole config tree in which the keywords was found, e.g.:

Example with grep but WITHOUT the -f option (which makes no sense at all):

Now with the -f option. Note the “<—” at the end of every line that has the “ipv6” keyword in it, while the full configuration part around it is listed.

You can even extend your grepping by using multiple expressions to grep, wrapped into single quotes and \|, such as: (Thanks to Ulrich’s comment!)


In order to copy the configuration via SCP from a backup server you must first enable the SCP protocol for the admin:

before you can grab it from the backup server, e.g. Linux with:


To save your config through the CLI in order to have it in the GUI under <username> -> Configuration -> Revisions, use:

Even better, you should enable the following feature which saves a backup of your configuration after each logout automatically:


General Information

The very basics:


After rebooting a fresh device which is already licensed, it takes some time until it is “green” at the dashboard. The following commands can troubleshoot and start the “get license” process. Use the first three to enable debugging and start the process, while the last one disables the debugging again:

To reboot your device, use:


General Network Troubleshooting

Which is basically ping and traceroute. Unluckily it is shitty difficult to use those commands since you need a couple of subcommands to source pings from a different interface, and so on. Furthermore, the traceroute for IPv6 uses its options on the CLI directly such as “-i <interface>”, while traceroute for IPv4 uses the “traceroute-options …” subcommands:

To view the current …-options, use this:



Routing table, RIB, FIB, policy routes, routing protocols, route cache, and much more. ;) Note the differences between IPv6 and legacy IP.

High Availability

Diagnose and managing: (Just another **** example on how “get | diagnose | execute” is mixed along with “sys | system”.)

Manually test a failover by decreasing the priority of the current master (since highest priority wins):

Don’t forget to restore the priority value to your original one!

Start a sync at a secondary device to (from?) the master: (Honestly, I am not sure what “synchronize” means in this command. I would like to decide which config to push to the other device. The Fortinet documentation reads: “Use this command from a subordinate unit in an HA cluster to manually synchronize its configuration with the
primary unit or to stop a synchronization process that is in progress.”)


Session Table

Display the current active sessions:


Remote Server Authentication Test

In order to test user credentials against some (remote) authentication servers such as LDAP or RADIUS or even local:


FSSO User Authentication

When you’re using some kind of Fortinet single sign-on (FSSO) features such as the agentless/agent polling mode to a Windows AD you can use the following commands to get some information about the recognized users and agent servers:

The first one shows all monitored users with details concerning their LDAP groups:

while the last one shows the users with their corresponding FortiGate user groups and traffic counters:

If you need further debugging messages you can enable it for the Fortigate non-blocking auth daemon and the FSSO daemon:


Sniffer / Packet Capture

Sniff packets like tcpdump does. (Only if the built-in packet capture feature in the GUI does not meet your requirements.) This can be used for investigating connection problems between two hosts. There are no details of the firewall policy decisions. Use the debug flow (next paragraph) for analysis about firewall policies, etc.


1: print header of packets
2: print header and data from ip of packets
3: print header and data from ethernet of packets (if available)
4: print header of packets with interface name <<<<<< good default choice
5: print header and data from ip of packets with interface name
6: print header and data from ethernet of packets (if available) with intf name
count: number of packets
a: UTC time
l: local time

Examples: (Thanks to the comment from Ulrich for the IPv6 example)

Here are two more examples on how to show LLDP or CDP packets in order to reveal the connected layer 2 ports from switches. Kudos to Joachim Schwierzeck.



If you want to see the FortiGate details about a connection, use this kind of debug. E.g., it shows the routing decision and the policy, which allowed the connection.




To show details about IKE/IPsec connections, use these commands:

To debug IKE/IPsec sessions, use the VPN debug:

To reset a certain VPN connection, use this (Credit):



For investigating the log entries (similar to the GUI), use the following filters, etc.:



Just a reminder for myself:

  • IP:
  • Login: admin
  • Password: <blank>

To change the IP address of the mgmt interface (or any other) via the CLI, these commands can be used:

Password Recovery & Factory Reset

Just the links here: Resetting a lost Admin password and How to reset a FortiGate with the default factory settings.


Featured image “Warten auf Arbeit” by Günter Hentschel is licensed under CC BY-ND 2.0.

83 thoughts on “CLI Commands for Troubleshooting FortiGate Firewalls

  1. Wow! Thanks for share.
    it’s so complete for resolve a problem

  2. Nice Job – good summary of most of the commands you need or routinely use.
    John K. NSE7

      1. Hi ihsan,
        I am not aware of a global history of commands. As far as I know you can only move through your own commands in that current CLI session (arrow up key).

        With the following CLI command you can see how many lines are stored in the history buffer:
        get gui console status

  3. Be careful using this as a sniffer. “Sniff packets like tcpdump does. ” is not a true statement. Fortinet support reports that if you have devices with ASIC offload enabled and you’re running anything in the v5 train, you will not see the entire conversation as you would with tcpdump.

    You must DISABLE ASIC OFFLOAD (see page 10 of Unfortunately for me, I can’t make live mods to firewall policies for troubleshooting. Disabling auto offload now makes the Fortigate sniffer less useful… :-(

  4. Great thanks! What is the command on 5.2.x to check file system for errors and repair?
    The following does not work: diagnose system file-system fscheck

    1. Hi Alex,
      try the following:
      diag hardware deviceinfo disk
      diag hardware smartctl -a /dev/sda
      I don’t know if this is exactly what you are searching for. But you’ll get some information about the disks.

      1. Hi, there is one command in fortigate that will show you what ever you do in gui its equivalent cli will be displayed over there.

  5. Some additional information for sniffing a IPv6 subnet:
    # diagnose sniffer packet any ‘net 2001:db8::/32’ 6 1000 l

      1. Hey max,
        sorry, normally I am answering to almost all questions, but I currently have no FortiGate cluster to test any commands. I simply do not know which one to use. Have you already googled it?
        (If you only need it once you can also do a packet capture and analyze the MAC addresses with Wireshark. ;))

    1. Sorry Jason for the confusion, but it’s only the WordPress plugin on my blog. There is not coloring on the FortiGate CLI at all.
      (I like the coloring here because it helps to distinguish between different areas.)

  6. Hi i would like to know how i can debug live traffic on Fortigate. i.e to see if certain traffic is passing or not. like i can debug in ASA to check all traffic then filter by the IP im interested in and see if its going through or not. if for example im pinging and would like to know if the ping went through the firewall or it got blocked?

      1. Hi Johannes,

        When i issue “diagnose debug flow filter daddr” i get no results although there’s traffic passing through. i.e im pinging that address but the command returns nothing

        1. Hey again. Just to be sure: Have you used the complete list of commands listed there? If you want to trace all connections to you must use all of the following in this order:

          diagnose debug reset
          diagnose debug flow filter daddr
          diagnose debug flow show console enable
          diagnose debug enable
          diagnose debug flow trace start 10
          diagnose debug disable

          1. Ow ok thanks Johannes. i wan only entering diagnose debug flow filter daddr”.

            I will use the complete list of commands. but is the last command not disabling the diag?
            i should enter the last command after i got the results and so that i can stop the diag right?

  7. Fortigate 100 A
    After adding all fields in column settings in the policy section, I couldn’t open the Policy section again; giving HTTP Error: 400.
    Please advise if I can reset to the default column settings so the page opens again.

    1. Hey NH,
      please open a ticket at Fortinet. I had some HTTP 400 errors as well during the last years and it was sometimes much more complicated than only a single setting. (However, you can try to reboot the device first. ;))

      1. I opened the browser through Explorer/Mozilla after the issue was on chrome.
        it worked. Then when I noticed that the window opened, I deleted history from chrome and browser also worked again.

      1. Hey Johannes ,

        I want to know, what is CLI command for the matching(policy lookup) the policy in fortinate, as similar to juniper

        1. Hi manjunatha Joshi,

          I am sorry, but I don’t know what you are searching for exactly. You can display the policies with “show firewall policy” and “show firewall policy6”. But this only shows the configured policies. Are you looking for a policy test, depending on source/destination addresses/ports? I don’t know whether such “tests” exist on the FortiGate.



  9. Hi All,
    I have a Fortigate 100D firmware 5.4.3, was fine until last weekend. After that no dhcp, for lan interface, no access for mgt, wan, or lan interfaces.
    no ping response for these inferfaces .
    i get login by serial console and reset to default factory. But no success.
    how bring system up and GUI ?


  10. sir i have fortigate firewall 2000e we use Explicit Proxy but Active authentication using LDAP problem is User & Device Authentication we can not do it

  11. Hi,

    i wan to know how many processors and the type of processor (speed etc) are there on Fortigate 1000D, can any one share the output or findings.

  12. Hi Az,
    did you try CLI-command “# get hardware ?” and use one of the displayed options?

  13. Hello,

    Super work
    Nice work

    I am new to Fortigate and this article helped me a lot for synchronizing my experience of other firewalls knowledge with Fortigate.

    Thank you
    Good Luck

  14. Tipp to use grep to find expression1 OR expression2 on FortiOS:
    show | grep ‘edit\|npu’ –> shows all lines with word ‘edit’ or word ‘npu’
    Another example:
    diag vpn tunnel list | grep ‘name\|esp\|ah’

      1. Thanks gr8 information..
        can someone help with AP inventory command which should provide list of complete associated APs with hostname, IP, mac details in single command.


  15. Hi there,

    Noticed you missed out a good HA cmd for Fotigates doesn’t work on the Fortiweb.
    #diagnose sys ha reset-uptime ####force a failover will loose around 5 packets..

  16. Some additional information for sniffing IPv6 ping (ICMP6 echo request and echo reply) :
    # diagnose sniffer packet any ‘ip6[40]=128 or ip6[40]=129’ 6 1000 l

    How to understand it:
    if byte 40 of an IP6 packet (starting from 0 so this is first byte of ICMPv6 header) has value 128 (ICMPv6 echo request) or value 129 (ICMP6 echo reply), then show the packet.

  17. How can I show the available vdom on a box.
    Is there any command that lists all vdoms? Thanks

  18. Fantastic page, I love it. Almost everything I need to know in one place. Many thanks for putting this page up.

  19. Thanks for this page ! Very helpful !

    A nice command to see the tree structure in the config sub part where you are and attributes valid value ranges :

    FG (interface) # tree

    (do not use at the root level otherwise you display the whole conf tree !)

    One you should not need (undocumented) :

    # fnsysctl ls
    (you can replace ls with other bash commands : ps, cat, …)

  20. Thank you for this great page! It was super helpful in solving a “mysterious” routing problem. :)

    *** Please contact the person(s) or company responsible for managing this device ***
    THU-ART-FW-01 login: maintainer
    Password: ********************
    Welcome !

    THU-ART-FW-01 # config system admin
    7657: Unknown action 3
    Command fail. Return code -1

    THU-ART-FW-01 # get system
    7657: Unknown action 0
    Command fail. Return code -1

    THU-ART-FW-01 # diagnose
    7657: Unknown action 0
    Command fail. Return code -1

    THU-ART-FW-01 # config
    7657: Unknown action 3
    Command fail. Return code -1

  22. Hi,
    i’m a newbie to Fortinet world (i’m an old Cisco ASA user) and this is a very good resource!
    I have read all the post but …
    Does exist something like Cisco “do” command when you are in a config ?
    For example i’m in
    config system interface
    edit port1
    and i want to show the config of another interface whitout exit the scope

    About the sudo command, i’m in a Fortigate 7.0.1 and it do not work


  23. This page is still super useful! :)

    The Flow section especially helped me figure out exactly what an application was doing (using load balancers, etc.) – to see exactly what needed to go through my Fortigate 1500 firewall.

    Thank you for creating this page!

  24. I love this. Thank you so much! Just your intro to this article alone soothes my pain:-)

Leave a Reply

Your email address will not be published. Required fields are marked *