Created on 06-07-2022 10:56 AM Edited on 06-07-2022 12:08 PM By Anonymous
Description
This article demonstrates how to send 'diagnose sniffer packet' output directly to Wireshark for real-time capture and troubleshooting purposes on Windows 10.
The commands below use SSH to connect to the FortiGate back-end and send the sniffer command piping the output to a local file which must be converted using the fgt2eth tool before being sent to Wireshark in the right format.
Scope
Although this technique is quite simple to use, pre-configure the environment is needed by following the steps below:
Solution
Option 1 - Connect using Windows 10 Native ssh client.
Open an MS-DOS Command prompt and make sure the c:\tools or the folder in which files were saved previously is chosen.
Paste or type the command below:
(echo diagnose sniffer packet any "not port 22" 3 ) | ssh admin@192.168.1.99 > capture.txt | fgt2eth.exe -in capture.txt -out -
The capture will only start when the admin password is typed, so the ssh connection can be made.
Option 2 - Connect using Windows 10 Native ssh client and RSA keys.
Open an MS-DOS Command prompt and make sure the c:\tools or the folder in which files were saved previously is chosen.
Paste or type the command below:
(echo diagnose sniffer packet any "not port 22" 3 ) | ssh -i rsakey.ppk -tt admin@192.168.1.99 > capture.txt | fgt2eth.exe -in capture.txt -out -
The capture will only start when the RSA password is typed, so the ssh connection can be made.
Option 3 - Connect using one of the putty tools called plink.exe.
Open an MS-DOS Command prompt and make sure the c:\tools or the folder in which files were saved previously is chosen.
Paste or type the command below:
plink.exe -ssh -batch -pw yourpassword admin@192.168.1.99 "diagnose sniffer packet any 'not port 22' 3" > capture.txt | fgt2eth.exe -in capture.txt -out -
Option 4 - Connect using the plink tool and RSA keys.
Open an MS-DOS Command prompt and make sure the c:\tools or the folder in which files were saved previously is chosen.
Paste or type the 2 lines of commands below on separated windows.
Command prompt 1
plink.exe -ssh -i rsakey.ppk admin@192.168.1.99 "diagnose sniffer packet any 'not port 22' 3" > capture.txt
Command Prompt 2
fgt2eth.exe -in capture.txt -out -
Stopping the Capture:
To stop the chained commands, start by stopping Wireshark and save the capture if needed.
After stopping the Wireshark process, press 'Ctrl+C' in the MS-DOS Command prompt.
Finally, close the MS-DOS Command prompt window to stop any pending activities.
Caveats:
The commands above assume user is 'admin' so replace it as per users environment.
The commands above assume FortiGate's admin IP is 192.168.1.99, so replace it as required.
The commands above use the tcpdump filter 'not port 22' which intends to filter out the ssh connection. Replace it as required.
If the capture is stopped, it'll stop the chained process and starting a new capture will be necessary.
When troubleshooting packet loss or performance issues, plan to connect ssh session to a healthy interface.
Related Articles:
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.