Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 37 ยท Capturing Traffic

Choosing Interfaces and Capture Options

Pick the right interface, understand switches, SPAN ports and taps, and set promiscuous mode, snaplen, buffer size and stop conditions in Wireshark's capture options.

A good capture starts before you press the shark fin. Choosing the wrong interface gives you an empty list, and wrong settings give you missing or truncated packets. This lesson explains how to choose where to capture, what each option does, and how to get the packets you actually need on a switched network.

Which interface?

The welcome screen lists every interface Wireshark can capture on. Common ones:

Interface Typical name What you see
Wired Ethernet eth0, enp3s0, Ethernet Frames on your cable
Wi-Fi wlan0, en0, Wi-Fi Your own Wi-Fi traffic (as Ethernet-like frames)
Loopback lo, lo0, Npcap Loopback Adapter Traffic between programs on the same computer
Any (Linux) any Packets from all interfaces, in a "Linux cooked" format
Virtual docker0, veth..., vboxnet0, virbr0 Container or VM networks
VPN tun0, wg0, Wintun Traffic inside the tunnel (before encryption)
Extcap sshdump, androiddump, randpkt Remote and special sources

Look at the sparklines: the interface with moving activity while you browse is the one you want. If your computer has a VPN, capturing on the physical interface shows only encrypted tunnel packets, while capturing on the VPN interface shows the readable inner traffic. Use both when you want to compare.

Debugging a service that talks to localhost? Capture on the loopback interface. On Windows, Npcap provides it; older WinPcap could not.

Why you do not see everyone's traffic

A hub repeats every frame to all ports, so everyone sees everything. A switch learns which MAC address lives on which port and forwards unicast frames only there. On your switch port you therefore see:

  • your own unicast traffic,
  • broadcasts (ARP requests, DHCP discover) and multicasts (mDNS, routing protocols),
  • occasionally frames to unknown destinations, which the switch floods.

To observe traffic between two other machines, you need a copy of it:

  1. Port mirroring (SPAN / monitor session) configured on a managed switch, which copies traffic from one or more ports to the port where you attach your analyzer. Needs switch access and permission.
  2. A network tap: a small inline device that copies both directions of a link. It does not drop packets under load and cannot be misconfigured like a SPAN port.
  3. Capture on the endpoint itself (the server or client), often with tcpdump, then copy the file to your laptop.
  4. Capture at a virtual switch or hypervisor for VMs and containers.
flowchart LR
    A["Client"] --- S["Managed switch"]
    B["Server"] --- S
    S -- "mirror (SPAN) port" --> W["Analyzer<br/>running Wireshark"]

A mirror port sends a copy of the client-server traffic to the analyzer.

Never try to trick a network into sending you other people's traffic (ARP spoofing, MAC flooding). Besides being illegal without permission, it breaks the network. Use the legitimate methods above.

The Capture Options dialog

Open Capture > Options (Ctrl+K). It has three tabs.

Input

  • Interface selection with a column for each setting. You may tick several interfaces to capture at once.
  • Promiscuous mode: on by default; turn it off when you want to see only traffic to and from this host (it can reduce noise on a mirror port that you share).
  • Snaplen: bytes captured per packet. Leave at the default unless you want to limit data.
  • Buffer size (MiB): the kernel buffer between the card and dumpcap. Raise it (for example to 64 MiB) on a busy link to avoid drops.
  • Monitor mode (Wi-Fi only): see the Wi-Fi lesson.
  • Capture filter box: the BPF filter, see capture filters.

Output

Choose a file name to write the packets straight to disk (so a crash does not lose the capture). Options here create multiple files and a ring buffer; dumpcap and long captures explains them.

Options

  • Update list of packets in real time and automatic scrolling: handy for watching, but they cost CPU on fast links; turn them off for heavy captures.
  • Name resolution: MAC, network and transport name resolution. Keep network resolution off while capturing.
  • Stop capture automatically after: a number of packets, a file size, or a duration. Always set one when capturing on a server so a forgotten capture cannot fill the disk.

Do not lose packets

Dropped packets are the silent enemy. If the kernel buffer fills faster than dumpcap empties it, packets are dropped and Wireshark never sees them. The stand-in simulates a buffer that fills at one rate and drains at another, so you can see why a bigger buffer or a capture filter helps. It is a simple model, not a measurement.

Python Why buffers overflow (stand-in model)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Choosing an interface programmatically

On servers you often have only a terminal. tshark -D and dumpcap -D list interfaces with their numbers; you then capture with -i 2 or -i eth0. A typical listing is read-only here (it depends on your computer):

TEXT
1. eth0
2. any
3. lo (Loopback)
4. docker0

The stand-in picks an interface from a table of observed byte counts, the same decision you make when you watch the sparklines.

Python Pick the busiest interface (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. You want to debug two programs on your own computer that talk over 127.0.0.1. Which interface do you capture on?

    Local traffic never reaches the physical network card; it travels through the loopback interface.
  2. 2. Which method lets you legitimately see traffic between two other hosts on a switch you manage?

    Promiscuous mode does not help on a switched port. A mirror port or tap delivers a copy of the traffic.
  3. 3. What is the main risk of leaving 'update list in real time' and auto-scroll on during a very fast capture?

    Drawing every packet live is expensive. Capturing to a file without live updates is lighter.
  4. 4. You are on a VPN. Capturing on the physical interface shows...

    The physical interface carries the already-encrypted tunnel. The VPN interface (tun0, wg0) shows the traffic before encryption.
  5. 5. Why set 'stop capture after' conditions on a server?

    A size, packet-count or time limit protects the server.

Summary

  • Capture on the interface that carries the traffic you care about: loopback for local programs, the VPN interface for readable tunnel traffic.
  • A switch shows you only your traffic plus broadcasts and multicasts; use a SPAN port, a tap or endpoint capture for more.
  • Promiscuous mode, snaplen, buffer size and live updating affect completeness and performance.
  • Increase the buffer or add a capture filter if the capture reports dropped packets.
  • Always set stop conditions when capturing on a shared or remote machine.

Next: Capture Filters (BPF)