FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
This article describes one of the troubleshooting options available in FortiGate CLI to check the traffic flow, by capturing packets reaching the FortiGate unit. 
For capturing these packets through GUI, this article here may offer guidance. 
However, note that GUI capture has some limitations.

FortiGate, all FortiOS versions
other Fortinet appliances providing a CLI sniffer : FortiAnalyzer - FortiMail - FortiManager



Content: Packet sniffer - basics



Basic packet-capture commands
-Example 1: Simple trace
-Example 2: Simple trace
Filter Functionality
-Example 3 : Trace with filters
-uncommon scenarios 

Sniffer Basics:


The packet sniffer 'sits' in the FortiGate and can display the traffic on a specific interface or on all interfaces.

There are three different levels of Information, also known as Verbose Levels 1 to 3, where verbose 1 shows less information and verbose 3 shows the most.

Verbose Levels 4, 5 and 6 would additionally provide the interface details
Verbose levels in detail:
1: Print header of packets.
2:print header and data from IP of packets.
3: print header and data from Ethernet of packets.
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 with interface name.
This article walks through some examples and different levels of verbosity to show the. different possibilities for debugging.
Basic sniffing command:

All packet sniffing (packet capture) commands start like:


# diag sniffer packet <interface> <'filter'> <verbose> <count> a

<interface> can be an interface name or "any" for all interfaces

<'filter'> is a very powerful filter functionality which will be described in more detail

<verbose> means the level of verbosity as described already

<count> the number of packets the sniffer reads before stopping.

a – timestamps the packets with the absolute UTC time

l - (small letter L) timestamps the packets with LOCAL time on the unit

(blank/no letter) – relative to the beginning of the capture

Note: for parallel captures on multiple interfaces/SSH sessions on Fortigate, please use “a” or “l”, do not leave blank


Note: in certain cases, where the unit has the capability and the session can be handled by a dedicated processor, the session is offloaded from kernel, making it impossible to capture these packets. In this case, you can turn off the offloading in the policy that matches the traffic with “set auto-asic-offload disable” for troubleshooting purposes only, and revert to the initial state after the capture.


Example 1: Simple sniffer

Sniff 3 packets of all traffic with verbose Level 4 on wan1 Interface


# diag sniffer packet wan1 none 1 3



0.996031 arp who-has tell

1.310085 -> fin 3133701817 ack 1838214099

1.310648 -> ack 3133701818


There is an ARP packet and some communication end.

Because the IP Address uses Port 80 ( it is possible to assume that  some packets have been caught from a running HTTP session.

The 'none' variable means 'no filter applied', '1' means 'verbose 1' and '3' means 'catch 3 packets and stop'.

Note that there is no timestamp switch at the end, therefore the first packet was received after 0.996031 seconds since the command was issued

Example 2: Simple Trace.
Sniff 3 packets of all traffic with verbose Level 4 on wan1 interface.
# diag sniffer packet wan1 none 4 3

    0.455401 wan1 -- -> syn 1906363376

    0.455490 wan1 -- -> syn 1423685325 ack 1906363377

    0.456892 wan1 -- -> ack 123332141

There is some more interesting information, just when a TCP session was being set up. tries to connect to on Port 80 with a syn and gets a syn ack back.

Finally, the session is acknowledged and established after the 3-way TCP handshake.


With information level set to Verbose 4,  additionally summary of Source and Destination IP Address are visible


If there is no <count> value, the Sniffer runs forever until you stop it with <CTRL C>


Hint: For further investigation it's always a good idea to log the SSH output to a file. If Putty is used (a free SSH client for Windows) it is possibke to easily log all output to a file which to search/sort/process.


Verbose 5 and Verbose 6 levels:


Verbose 5 contains much more information

The IP Header as we've already seen in Verbose 4

The Payload of the IP packet itself


An output of Verbose 5 looks like this:


# diag sniffer packet any none 5 1



0.529129 wan1 in -> udp 50

0x0000   4500 004e 153b 0000 8011 dce6 0a6d 13a5        E..N.;.......m..

0x0010   0a6d 1fff 0089 0089 003a a7b6 8db5 0110        .m.......:......

0x0020   0001 0000 0000 0000 2045 4745 5046 4346        .........EGEPFCF

0x0030   4545 4a45 4f45 4646 4543 4e46 4145 4443        EEJEOEFFECNFAEDC

0x0040   4143 4143 4143 4143 4100 0020 0001             ACACACACA.....


Notice the in/ out parameter after wan1 interface that will confirm the direction of the packet entering or leaving the interface.


Verbose 6, finally, even includes Ethernet (Ether Frame) Information.

A script is available (, which will convert a captured verbose 6 output, into a file that can be read and decoded by Ethereal/Wireshark. See the end of this article for details.


Use of absolute time stamp in sniffer trace will report the absolute system time (no time zone) in packet summary:


# diag sniffer packet wan1 none 4 2 a



2019-08-16 09:36:02.570320 wan1 -- arp who-has tell

2019-08-16 09:36:02.663102 wan1 -- -> fin 2427687875 ack 3609408424


Hint: Below is the format that Technical Support will usually request when attempting to analyze a problem as it includes full packet content, as well as absolute time stamp, in order to correlate packets with other system events.


# diag sniffer packet any <'filter'> 6 0 a

Filter Functionality:


As already mentioned, diag sniffer includes a powerful filter functionality that will be described here.


FortiOS gives a brief example:


# diag sniffer packet any

<filter>    Flexible logical filters for sniffer (or "none").

For example:  To print UDP 1812 traffic between forti1 and either forti2 or forti3

'udp and port 1812 and host forti1 and ( forti2 or forti3 )'


If a second host is specified, only the traffic between the 2 hosts will be displayed.


Imagine to capture the traffic from one PC to another PC.

Without a filter the sniffer will display all packets, which is far too much data and quite painful to sort and debug a large file.


Example 3: Trace with Filters:


To see what's going on between two PCs (or a PC and a FortiGate), do not forget the quotes delimiting the filter expressions:


# diag sniffer packet wan1 'src host and dst host' 1 3


filters=[src host and dst host]

1.453488 -> syn 3263501252 ack 507821611

1.454138 -> ack 507822560

1.457612 -> icmp: echo reply


Assuming there is a lot of traffic on the wire, this filter command will only display traffic (but all traffic) from Source to Destination

It will NOT show traffic to (for example the ICMP reply) because we asked for 'src host’ and ‘dst host'.



When 'src' and 'dst' are used, 'host' word is optional, and is applied by default.

It is also possible to use 'net' as keyword for a broader result:


# diag sniffer packet wan1 'src and net' 1 3


However, when filtering for the both ways of communication, we must either use 'host' or “net” keywords:


# diag sniffer packet wan1 'host and host' 1 3


To have only in a specific type of traffic (let's say TCP Traffic only) it is necessary to change the filter command slightly:


# diag sniffer packet wan1 'src and tcp' 1 3


filters=[src and tcp]

1.729308 -> ack 4024820721

1.729541 -> syn 3670899298 ack 1522348774

1.730308 -> ack 1522349665


Though ICMP (ping) was also running and probably some DNS requests too, the trace only shows the TCP part.

The Source is: which is IP on Port 80. Apparently, there is a HTTP session to


The same the other way around (using here ‘host’ we can see the traffic both ways):


# diag sniffer packet any 'host and host' 1 5


filters=[host and host]

1.182532 -> syn 3194317969

1.182598 -> syn 2863972551 ack 3194317970

1.183166 -> ack 2863972552

1.183360 -> psh 3194317970 ack 2863972552

1.183406 -> ack 3194318935


In this example we're sniffing for ICMP only, to and from


# diag sniffer packet any 'host and icmp' 1 30


filters=[host and icmp]

16.866489 -> icmp: echo request

16.866581 -> icmp: echo reply


Another useful feature is logical combination.

Let assume it is necessary to check for ICMP and TCP only (but not for UDP, ARP, etc).


It is possible to combine protocols in the following manner.

This sniff will display all tcp or icmp traffic to and from host, in verbose 1 level.


# diag sniffer packet wan1 'host and (icmp or tcp)' 1


filters=[host and (icmp or tcp)]

0.748627 -> icmp: echo request

0.748681 -> icmp: echo reply

1.138054 -> fin 1192893176 ack 3520420646

1.138313 -> syn 3309427492


It is now, necessary to to limit the sniffer even more.

Sniff traffic between 2 hosts, but only TCP and only port 80.


# diag sniffer packet wan1 'host and host and tcp port 80' 1 3


filters=[host and host and tcp port 80]

2.120582 -> fin 430415930 ack 3124927915

2.120994 -> ack 430415931

2.124248 -> fin 3124927915 ack 430415931


A logical 'and' is used in this command between and so that only packets containing both these host addresses will be seen.

Even if telnet and ssh is running between the two hosts, we only see port 80 TCP traffic.


Uncommon scenarios:


Filters can also be used to display packets based on their content, using hexadecimal byte position.


Match TTL = 1

diagnose sniffer packet any "ip[8:1] = 0x01"


Match Source IP address =


# diagnose sniffer packet wan1 "(ether[26:4]=0xc0a80102)"


Match Source MAC = 00:09:0f:89:10:ea:


# diagnose sniffer packet any "(ether[6:4]=0x00090f89) and (ether[10:2]=0x10ea)"


Match Destination MAC = 00:09:0f:89:10:ea:


# diagnose sniffer packet any "(ether[0:4]=0x00090f89) and (ether[4:2]=0x10ea)


Match ARP packets only:


# diagnose sniffer packet wan1 "ether proto 0x0806"


TCP or UDP flags can be addressed using the following:


Match packets with RST flag set:


# diagnose sniffer packet wan1 "tcp[13] & 4 != 0"


Match packets with SYN flag set:


# diagnose sniffer packet wan1 "tcp[13] & 2 != 0"


Match packets with SYN-ACK flag set:


# diagnose sniffer packet wan1 "tcp[13] = 18"


Match HA heartbeat packets only:


# diagnose sniffer packet ha1 "ether proto 0x8890"


Related article:


Sniffer for VLAN traffic:


This is a common scenario, where the VLAN interface is used instead of the interface name in the command line.

For example, sniffing the traffic for host in the VLAN interface 'vlan206', the command would be:


# diag sniffer packet any "host" 4 0



1.774584 vlan206 in -> icmp: echo request

1.774642 vlan206 out -> icmp: echo reply

1.774648 dmz out -> icmp: echo reply


# diag sniffer packet vlan206 "host" 4 0



0.968800 vlan206 -- -> icmp: echo request

0.968858 vlan206 -- -> icmp: echo reply

1.982626 vlan206 -- -> icmp: echo request

1.982683 vlan206 -- -> icmp: echo reply


Note that when the vlan206 interface is used as filter, the underlying physical interface is not shown in the capture.


In some cases, When sniffing traffic for host address by default underlying physical interface is not displayed for incoming traffic, however, associated VLANs and physical interface for outbound traffic are displayed.


For example:

From the above capture, it is possible to see dmz is a physical interface and vlan206 is an associated VLAN when traffic ingress dmz is not visible in, and only vlan 206 in but when traffic goes out we see VLAN 206 out and dmz out.


This is because when a filter with host x.x.x.x is set in sniffer, FortiGate has to strip out the vlan id and frames first to know the host address to capture the traffic, hence it is not sure it is coming via the dmz  interface.

However, for outgoing traffic, Fortigate will retag the packets so it knows it goes out via the dmz  interface .


If the sniffer filter is changed like below, a DMZ should be visible in interface as well for incoming incoming packets

# diag sniffer packet any ' ' 4


Also, when capturing the traffic with Verbose 6 (to see the contents of the packet), the vlan tag is stripped when the filter is run on the vlan interface or 'any' interface.


To capture the vlan tag in a packet capture, the sniffer must be run on the underlying physical interface.


In this situation, the filters cannot be used:


# diag sniffer packet dmz none 6 0



pcap_lookupnet: dmz: no IPv4 address assigned

0.981174 dmz -- 802.1Q vlan#206 P0

0x0000   d4be d99c 02f9 085b 0e37 ef37 8100 00ce        .......[.7.7....

0x0010   0800 4500 0040 3f4a 4000 7406 d33f d992        ..E..@?J@.t..?..

0x0020   0488 0b0b 0b09 0050 c131 ab2a 473b 1fb3        .......P.1.*G;..

0x0030   bc14 5018 0401 8da5 0000 1130 1b00 0000        ..P........0....

0x0040   0000 1f00 0000 1c00 0000 1b00 0000 1800        ................

0x0050   0000                                           ..




1) Also attached is the script that will convert a verbose level 3 or 6 sniffer output, into a file readable and decodable by Ethereal/Wireshark pcap file. In case the traffic is sniffed without interface filter ("diagnose sniffer packet any '' 6 0 a"), by default script will create a single file with traffic sniffed on all interfaces. However it is possible to create per interface pcap file by adding "-demux" argument while converting text to pcap file (pcap.exe -in <input file> -out <output file> -demux).


2) The fgt2eth.exe file is also attached to this article, this file is outdated and is not supported but may provide some guidance.


3) The attached script is provided 'as is', it is not supported by Technical Support.


Related Articles:


Troubleshooting Tip : First steps to troubleshoot connectivity problems to or through a FortiGate wi...

Troubleshooting Tip: Using the FortiGate sniffer on VLAN interfaces

Troubleshooting Tip: Packet capture (CLI sniffer) tips and best practices

Technical Note : How To Troubleshoot Wireless Station Connection Issues on the FortiAP

Technical Note: Packet capture buffer limit