Pi capture box
The Raspberry Pi runs Linux, handles the Alfa adapter, and records packet captures without needing my main desktop to sit in the same spot.
This project turns a Raspberry Pi and an Alfa Wi-Fi adapter into a portable packet-capture sensor for my private lab. The Pi handles the capture, the Alfa adapter listens to Wi-Fi traffic, and Wireshark on my desktop lets me analyze the saved PCAP files afterward.
The goal is to understand wireless networking at the packet level: beacons, probe requests, channels, MAC addresses, access points, DNS, ARP, DHCP, TCP, and the difference between visible metadata and encrypted payloads.
This is a small portable lab tool. I can place the Raspberry Pi near my test access point, capture wireless traffic from my own lab, save the capture as a PCAP file, and analyze it later on my main computer.
The Raspberry Pi runs Linux, handles the Alfa adapter, and records packet captures without needing my main desktop to sit in the same spot.
The Alfa adapter lets me study Wi-Fi management frames, channels, beacons, probe requests, and other lab traffic that normal web tools do not show.
Instead of trying to understand everything live, I save a capture and then open it in Wireshark where I can filter, inspect, and document it carefully.
Wi-Fi feels invisible until I capture it. This project gives me a safe way to see what my own wireless lab is doing.
See how access points advertise, how devices search, and how channels affect captures.
Use real tools like iw, tcpdump, tshark, and SSH.
Create small, controlled captures that are easier to analyze than huge noisy files.
Open the capture in Wireshark and write down what the packets prove.
The exact adapter model matters less than having a Linux-supported Wi-Fi adapter that can work with monitor mode. Alfa adapters are popular for wireless labs because many models are well supported.
| Part | What I use it for | Why it matters |
|---|---|---|
| Raspberry Pi | Small Linux capture machine. | Portable, low-power, easy to SSH into, and good for lab sensors. |
| Alfa Wi-Fi adapter | External Wi-Fi interface for captures. | Better lab adapter than relying only on the Pi's built-in Wi-Fi. |
| microSD card | Stores Raspberry Pi OS and capture files. | Packet captures can grow, so free space matters. |
| Power supply | Powers the Pi and USB adapter. | Weak power can cause unstable adapters and failed captures. |
| Main desktop/laptop | Runs Wireshark for analysis. | Bigger screen, better storage, and easier packet review. |
The safety rules are part of the project. Packet capture is powerful, and the public version of this project should be clear about what it is and is not for.
Here is the magic of apt install again: most of the tools I need are FREE Linux
utilities. I install Wireshark support, command-line capture tools, wireless tools, and USB
inspection tools.
sudo apt update
sudo apt install tcpdump tshark wireshark-common iw rfkill usbutils -y
tcpdump captures packets, tshark
analyzes captures from the terminal, iw manages Wi-Fi interfaces, and
usbutils helps confirm the Alfa adapter is detected.
Before changing anything, I check that Linux can see the USB adapter and I find the interface
name. It may be wlan1, wlan2, or another name depending on the Pi.
# Show USB devices
lsusb
# Show network interfaces
ip link
# Show wireless interfaces
iw dev
# Check if anything is blocked
rfkill list
lsusb,
and a wireless interface should appear in iw dev.
I like keeping captures organized by project or date. PCAP files can get messy quickly.
mkdir -p ~/captures
cd ~/captures
Before using monitor mode, I start with a normal capture from an interface. This is easier and confirms that my tools work.
# Replace wlan0 with the interface that is actually carrying traffic
sudo tcpdump -i wlan0 -w ~/captures/normal-network-test.pcap
Ctrl+C when I have enough traffic.
Short captures are easier to understand than giant captures.
Monitor mode lets the adapter listen to wireless frames on a channel. I use this only inside my private lab and only to understand my own wireless environment.
# Replace wlan1 with the Alfa interface shown by iw dev
sudo ip link set wlan1 down
sudo iw dev wlan1 set type monitor
sudo ip link set wlan1 up
# Confirm the interface type
iw dev
Wi-Fi channels matter. If my lab access point is on channel 6, I set the adapter to channel 6 so the capture stays focused.
# Example: set the monitor interface to channel 6
sudo iw dev wlan1 set channel 6
# Confirm current channel details
iw dev wlan1 info
Once the adapter is in monitor mode and locked to my lab channel, I capture packets to a file.
mkdir -p ~/captures
sudo tcpdump -i wlan1 -w ~/captures/lab-wifi-channel-6.pcap
I want traffic that is easy to recognize and belongs to my own devices. Good first tests are DNS lookups, pings, and normal browsing from a test device on my lab network.
From a test device, generate a simple DNS lookup.
dig example.com
Generate ICMP traffic that is easy to find later.
ping 1.1.1.1
Use a plain HTTP test site only for learning request structure.
curl http://example.com
Compare visible metadata with encrypted payloads.
curl https://example.com
The Pi is good for capturing, but my desktop is better for analysis. I move the PCAP file
with scp.
# From my desktop or laptop
scp pi@raspberrypi.local:~/captures/lab-wifi-channel-6.pcap .
# Open it locally
wireshark lab-wifi-channel-6.pcap
raspberrypi.local.
Once the PCAP is open, I use filters and statistics to understand what I captured.
Start with protocol hierarchy to see what kinds of traffic exist.
Statistics → Protocol Hierarchy
See which devices or addresses appear.
Statistics → Endpoints
Find name lookups from my test traffic.
dns
Focus on one lab device by IP address.
ip.addr == 192.168.1.50
Useful for seeing beacons, probes, and wireless metadata in a monitor-mode capture.
wlan.fc.type == 0
Beacon frames advertise access points.
wlan.fc.type_subtype == 8
Probe requests show devices searching for networks.
wlan.fc.type_subtype == 4
Probe responses are replies from access points.
wlan.fc.type_subtype == 5
I can also inspect the capture directly on the Raspberry Pi before moving it.
# Basic read
tshark -r ~/captures/lab-wifi-channel-6.pcap
# Protocol summary
tshark -r ~/captures/lab-wifi-channel-6.pcap -q -z io,phs
# Conversation summary
tshark -r ~/captures/lab-wifi-channel-6.pcap -q -z conv,ip
# Show only DNS packets
tshark -r ~/captures/lab-wifi-channel-6.pcap -Y dns
After the capture, I put the adapter back to normal managed mode if I want to use it like a regular Wi-Fi client again.
sudo ip link set wlan1 down
sudo iw dev wlan1 set type managed
sudo ip link set wlan1 up
iw dev
This project connects hardware, Linux, wireless networking, packet capture, and analysis.
I need to know which adapter is which, what mode it is in, what channel it is on, and whether Linux can see it correctly.
Even before application data, Wi-Fi has management frames, beacons, probes, channels, signal behavior, and metadata worth understanding.
A PCAP gives me packet-level evidence. Instead of saying “the network is broken,” I can show where the conversation failed or what traffic appeared.
Once the basic capture workflow works, I can improve the project without making it unsafe.
tshark to summarize protocols automatically.This is the short version of the build and capture workflow.
# Install tools
sudo apt update
sudo apt install tcpdump tshark wireshark-common iw rfkill usbutils -y
# Identify adapter
lsusb
ip link
iw dev
rfkill list
# Create capture folder
mkdir -p ~/captures
# Normal capture test
sudo tcpdump -i wlan0 -w ~/captures/normal-network-test.pcap
# Enable monitor mode on Alfa adapter
sudo ip link set wlan1 down
sudo iw dev wlan1 set type monitor
sudo ip link set wlan1 up
iw dev
# Lock to lab channel
sudo iw dev wlan1 set channel 6
iw dev wlan1 info
# Capture wireless packets
sudo tcpdump -i wlan1 -w ~/captures/lab-wifi-channel-6.pcap
# Quick summaries
tshark -r ~/captures/lab-wifi-channel-6.pcap -q -z io,phs
tshark -r ~/captures/lab-wifi-channel-6.pcap -q -z conv,ip
# Copy to desktop
scp pi@raspberrypi.local:~/captures/lab-wifi-channel-6.pcap .
# Open in Wireshark
wireshark lab-wifi-channel-6.pcap
# Return adapter to managed mode
sudo ip link set wlan1 down
sudo iw dev wlan1 set type managed
sudo ip link set wlan1 up
This project turns Wi-Fi from something invisible into something I can study. The Raspberry Pi captures, the Alfa adapter listens in my private lab, and Wireshark lets me analyze the evidence afterward. It is a practical bridge between Linux, wireless networking, packet analysis, and safe cybersecurity learning.