Hands-On Prep Series

🦈 Hands-On Prep Manual: How to Use Wireshark — Opening Capture Files and Transferring Them with scp

Introduction

This article is part of the Top 1% Series’ full article guide, one of the theme-specific articles split off from the hands-on prep manual. Using an SSH client is covered in How to Use Teraterm (a Terminal Client).

The Workflow This Article Covers

This blog’s hands-on articles don’t run Wireshark itself on the remote Linux server — instead, the server side captures with tcpdump, and you transfer the resulting file to your own PC before opening it in Wireshark. This means the server doesn’t need a GUI environment, and since the capture is just a saved file, you can revisit it anytime later.

graph LR
    A["Linux server<br/>captures with tcpdump<br/>(produces a .pcap file)"] -->|"scp (SSH file transfer)"| B["Your own PC<br/>(the .pcap file is saved)"]
    B --> C["Open and analyze in Wireshark"]

Step 1: Install Wireshark

Download the installer for your OS (Windows/macOS) from the official Wireshark site and install it. If you’re prompted to also install “Npcap” (a driver for packet capture) during setup, go ahead and install it too — even if you’re only opening files for now, you’ll need it if you ever want to run a live capture on your own PC directly.

Step 2: Transfer the Capture File to Your PC with scp

scp (Secure Copy) transfers files over SSH’s encrypted channel. Windows 10/11 ships with an OpenSSH client built in, so it works right out of the command prompt or PowerShell (and works the same way from a terminal on macOS/Linux).

Once you’ve captured something with tcpdump on the server side (say, /tmp/l2tp-capture.pcap), run the following from your own PC’s command prompt/PowerShell/terminal.

scp <username>@<server's IP address>:/tmp/l2tp-capture.pcap ./

The command’s structure is scp <source> <destination>. The remote file is specified with username@server's IP address:path, and the trailing ./ means “save it in the current directory.” Running it prompts for a password (or key-based auth) just like SSH, and copies the file on success.

If you get "Permission denied"

If you captured with root privileges (sudo tcpdump), the resulting .pcap file is owned by root. If the regular user you’re SSH-connecting as doesn’t have read permission on that file, scp fails with Permission denied. On the server side, you need to do one of the following.

  • After capturing, loosen the read permission with something like sudo chmod 644 /tmp/l2tp-capture.pcap (it’s fine to delete this temporary lab file once you’re done transferring it).
  • Use tcpdump’s -Z option to set the file’s owner at capture time (e.g., sudo tcpdump ... -Z <username> -w /tmp/l2tp-capture.pcap).
You can also use Teraterm's file transfer feature

Instead of the scp command line, you can also fetch a file through the GUI via Teraterm’s menu: “File” → “Transfer” → “SCP” → “Receive file.” If remembering the command feels like a hassle, this works just as well.

Step 3: Open the File in Wireshark

Launch Wireshark and select “File” → “Open…” to pick the .pcap file you transferred in Step 2. You can also open it by dragging the .pcap file from your file explorer onto Wireshark’s icon.

Once opened, packets are listed chronologically from the top. Typing a condition into the “Filter” field at the top of the screen narrows the list down to matching packets only (this is called a display filter).

Example inputWhat it narrows down to
isakmpOnly IKE (key exchange) traffic
l2tpOnly L2TP control messages
tcp.port == 443Only packets on TCP port 443 (HTTPS)
ip.addr == 10.10.10.1Only packets where the source or destination matches the given IP address
Display filters vs. capture filters

Wireshark has two distinct kinds of filters: a display filter (the Filter field at the top of the screen, using syntax like isakmp), which narrows down which of the packets you already have (opened or currently recording) get displayed; and a capture filter (using tcpdump’s BPF syntax, like udp port 500), which narrows down which packets get recorded in the first place, at the moment you start capturing. When you’re just opening and analyzing an already-recorded file, as in this article, you only use display filters — but the command used to actually capture with tcpdump (something like the udp port 500 or udp port 4500 used in the L2TP/IPsec hands-on lab) is a capture filter. Note that the syntax for the two is different.

Clicking a packet shows its protocol layers stacked from bottom to top (Ethernet → IP → UDP → ISAKMP, for example) in the middle of the screen — expand each one to inspect individual field values.

Summary

That’s all 5 articles in the Hands-On Prep series. If you’d like to review the whole thing by ear during a commute or while doing chores, check out [Listen] The Hands-On Prep Series, Fully Recapped.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).