0% found this document useful (0 votes)
46 views6 pages

Fortigate CLI Commands For Troubleshooting

Uploaded by

ezzeldeen139
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views6 pages

Fortigate CLI Commands For Troubleshooting

Uploaded by

ezzeldeen139
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

12/25/2016 CLI Commands for Troubleshooting FortiGate Firewalls | Blog Webernetz.

net

Blog Webernetz.net
IT-Security, Networks, IPv6, DNSSEC, Monitoring, Music, DIY

CLI Commands for Troubleshooting


FortiGate Firewalls
2015-12-21 Fortinet, Memorandum, Network CLI, FortiGate, Fortinet, Quick Reference,
Troubleshooting Johannes Weber
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 stu .

Coming from Cisco, everything is “show”. With Fortinet, you have the choice between show | get |
diagnose | execute. Not that easy to remember. 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:

1 config global
2 config vdom
3 edit <vdom-name>

To show the running configuration (such as “show run”), simply type in:

1 show

To showuses
This website the entire running
cookies configuration
to improve with default
your experience. values,you're
We'll assume use: ok with this, but you can opt-out if you wish. Accept
Read More
1 show full-configuration
https://blog.webernetz.net/2015/12/21/cli-commands-for-troubleshooting-fortigate-firewalls/ 1/11
12/25/2016 CLI Commands for Troubleshooting FortiGate Firewalls | Blog Webernetz.net
1 show full-configuration

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 a er usage!

1 config system console


2 set output standard
3 end

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.:

1 show | grep -f ipv6


2 show full-configuration | grep -f ipv6

General Information
The very basics:

ew of hardware interfaces
s of a single network interface, same as: diagnose hardware deviceinfo nic <nic-name>
f hidden command to see more interface stats such as errors

d network usage
th all forked processed
sier, incl. CPU and mem bars. Forks are displayed by [x13] or whatever

the attack definition versions, last update, etc.


ted all possibe log entries
ows the IP addresses of FQDN objects
crashlog, a status of 0 indicates a normal close of a process!

A er 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:

1 diag debug app update -1


2 diag debug enable
3 exec update-now
4 diag debug disable

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept
Read More
https://blog.webernetz.net/2015/12/21/cli-commands-for-troubleshooting-fortigate-firewalls/ 2/11
12/25/2016 CLI Commands for Troubleshooting FortiGate Firewalls | Blog Webernetz.net

General Network Troubleshooting


Which is basically ping and traceroute:

1 execute ping-options ?
2 execute ping-options source <ip-address-of-the-interface>
3 execute ping <hostname|ip>
4 execute ping6-options ?
5 execute ping6 <hostname|ip>
6 execute traceroute <hostname|ip>
7 execute tracert6 <hostname|ip>

Routing
1 get router info routing-table all #routing table
2 get router info6 routing-table #IPv6 without the "all" keyword
3 get router info kernel #Forwarding Information Base
4 get router info6 kernel
5 get router <routing-protocol> #basic information about the enabled routing protocol
6 diagnose firewall proute list #policy-based routing
7 diagnose firewall proute6 list
8 diagnose ip rtcache list #route cache = current sessions w/ routing information

High Availability
1 diagnose sys ha status
2 execute ha manage ? #switch to the CLI of a secondary unit
3 execute ha manage <device-index>
4 diagnose sys ha showcsum #verify the checksum of all synchronized peers

Session Table
Display the current active sessions:

1 get system session list #rough view with NAT, only IPv4
2
3 diagnose sys session filter clear
4 diagnose sys session filter ?
5 diagnose sys session filter dst 8.8.8.8
6 diagnose sys session filter dport 53
7 diagnose sys session list #show the session table with the filter just set
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept
Read More
https://blog.webernetz.net/2015/12/21/cli-commands-for-troubleshooting-fortigate-firewalls/ 3/11
12/25/2016 CLI Commands for Troubleshooting FortiGate Firewalls | Blog Webernetz.net

Sniffer
Sni packets like tcpdump does. 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 diagnose sniffer packet <interface|any> '<tcpdump-filter>' <verbose>


<count> <time-format>

with:

verbose:
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
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
time-format:
a: UTC time
l: local time

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

1 diagnose sniffer packet any 'host 8.8.8.8' 4 4 l


2 diagnose sniffer packet any 'host 8.8.8.8 and dst port 53' 4 10 a
3 diagnose sniffer packet wan1 'dst port (80 or 443)' 2 50 l
4 diagnose sniffer packet any 'net 2001:db8::/32' 6 1000 l

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.

1 LLDP:
2 diagnose sniffer packet port1 'ether proto 0x88cc' 4 1 a
3
4 CDP:
5 diagnose sniffer packet port1 'ether[20:2] == 0x2000' 6 1 a

Flow
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.

1 diagnose
This website debug
uses cookies reset your experience. We'll assume you're ok with this, but you can opt-out if you wish.
to improve Accept
2 diagnose debug flow filter ?
3 diagnose debug flow filter saddr 172.16.27.148 Read More
4 diagnose debug flow filter daddr 8.8.8.8
https://blog.webernetz.net/2015/12/21/cli-commands-for-troubleshooting-fortigate-firewalls/ 4/11
12/25/2016 CLI Commands for Troubleshooting FortiGate Firewalls | Blog Webernetz.net
4 diagnose debug flow filter daddr 8.8.8.8
5 diagnose debug flow show console enable
6 diagnose debug enable
7 diagnose debug flow trace start 10 #display the next 10 packets, after that, disable the flow
8 diagnose debug disable

Example:

1 fd-wv-fw04 # diagnose debug reset


2
3 fd-wv-fw04 # diagnose debug flow filter daddr 8.8.8.8
4
5 fd-wv-fw04 # diagnose debug flow show console enable
6 show trace messages on console
7
8 fd-wv-fw04 # diagnose debug enable
9
10 fd-wv-fw04 # diagnose debug flow trace start 20
11 id=20085 trace_id=11 func=print_pkt_detail line=4420 msg="vd-root received a packet(proto=17,
12 id=20085 trace_id=11 func=init_ip_session_common line=4569 msg="allocate a new session-0001f0
13 id=20085 trace_id=11 func=vf_ip4_route_input line=1596 msg="find a route: flags=00000000 gw-1
14 id=20085 trace_id=11 func=fw_forward_handler line=671 msg="Allowed by Policy-16:"
15 id=20085 trace_id=11 func=__ip_session_run_tuple line=2601 msg="run helper-dns-udp(dir=origin
16 id=20085 trace_id=12 func=print_pkt_detail line=4420 msg="vd-root received a packet(proto=17,
17 id=20085 trace_id=12 func=init_ip_session_common line=4569 msg="allocate a new session-0001f0
18 id=20085 trace_id=12 func=vf_ip4_route_input line=1596 msg="find a route: flags=00000000 gw-1
19 id=20085 trace_id=12 func=fw_forward_handler line=671 msg="Allowed by Policy-16:"
20 id=20085 trace_id=12 func=__ip_session_run_tuple line=2601 msg="run helper-dns-udp(dir=origin
21
22 fd-wv-fw04 # diagnose debug disable

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

1 get vpn ike gateway <name>


2 get vpn ipsec tunnel name <name>
3 get vpn ipsec tunnel details
4 diagnose vpn tunnel list
5 diagnose vpn ipsec status #shows all crypto devices with counters that are used by t
6 get router info routing-table all

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

1 diagnose debug reset


2 diagnose vpn ike log-filter clear
3 diagnose vpn ike log-filter ?
4 diagnose vpn ike log-filter dst-addr4 1.2.3.4
5 diagnose debug app ike 255 #shows phase 1 and phase 2 output
6 diagnose debug enable #after enough output, disable the debug:
7 diagnose debug disable

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept
To reset a certain VPN connection, use this (Credit):
Read More
https://blog.webernetz.net/2015/12/21/cli-commands-for-troubleshooting-fortigate-firewalls/ 5/11
12/25/2016 CLI Commands for Troubleshooting FortiGate Firewalls | Blog Webernetz.net
1 diag vpn tunnel reset <phase1 name>

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

1 execute log filter reset


2 execute log filter category event
3 execute log filter field #press enter for options
4 execute log filter field dstport 8001
5 execute log filter view-lines 1000
6 execute log filter start-line 1
7 execute log display

Defaults
Just a reminder for myself:

IP: 192.168.1.99
Login: admin
Password: <blank>

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

1 config system interface


2 edit mgmt
3 set ip 192.168.1.1 255.255.255.0
4 set allowaccess ping https ssh
5 next
6 end

Links
Fortinet: FortiOS 5.2 CLI Reference
itsecworks: Fortigate troubleshooting commands

tweet
0 share
1 share
42 share
0 share share

rss feed e­mail


This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept
Read More
https://blog.webernetz.net/2015/12/21/cli-commands-for-troubleshooting-fortigate-firewalls/ 6/11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy