A packet capture (PCAP) contains network traffic going to and from the system it was captured on, for troubleshooting and analysis purposes. These PCAPs can be quite useful when diagnosing exotic networking issues!
This guide will focus on capturing PCAPs using Wireshark and tcpdump.
Wireshark can be downloaded and installed from the official Download page. For macOS and Windows, the stable releases will be located at the top of the page. For stable Linux releases, for various distributions, look to the bottom of the Download page, under the Third-Party Packages section.
tcpdump is primarily used on systems running Linux/macOS as it comes pre-installed on macOS and on most Linux distributions.
If you require tcpdump and it's not installed on your Linux system then please follow the package installation method for your system's package manager. For example, installing tcpdump on Debian-based distributions can be done with:
sudo apt-get install tcpdump
Similarly, for RPM-based distributions:
sudo yum install tcpdump




From a terminal window, run the following command to capture network traffic on all interfaces:
sudo tcpdump -i any -s 0 -w $(hostname).cap
Press Cmd+C(macOS) or Ctrl+C(Linux), in the same terminal window, to end the packet capture.
The PCAP will be located in the directory the command was run in under a name that follows this format:
my_device.cap
Sometimes problems occur intermittently and the process for reproducing them is unclear. In these cases, Twingate support may recommend capturing a "rolling PCAP" where a capture can be configured to keep running while only saving a certain amount of data. This way PCAPs can be run in the background while controlling the max storage size of the captures (if the problem takes a while to reproduce).




Use the following command to capture a rolling PCAP:
sudo tcpdump -i any -s 0 -w $(hostname).cap -C 100 -W 5 -z root
The command will create and save PCAP files in the format:
my_device.cap*
Press Ctrl+C(Linux), in the same terminal window, to end the packet capture. Alternatively, if the process was run in the background you can stop it using it's PID.
Up to 5 PCAPs will be created, up to 100MB each. When all 5 files are full, the packet capture will over-write the data in the oldest file.
Notes: