task 1.1 · chapter 1 of 8: what a capture shows · 20 min
Your first capture
objective
Capture the laptop pinging the printer, open the file in Wireshark, and read the three panes: the packet list, the details and the bytes. Find out what the laptop sent before its first ping.
answers/1.1.ymlopen a file in VS Code: Ctrl+P (Cmd+P on a Mac), type its name, Enter
| Capture | make capture AT=laptop:eth1 NAME=1.1 X=ping |
|---|---|
| Open it | the Wireshark tab in the lab app, Start Wireshark, then File › Open › /captures/1.1.pcapng |
| Your answers | answers/1.1.yml |
new to this? step by stepbeginner
make capture AT=laptop:eth1 NAME=1.1 X=ping.- The lab app’s Wireshark tab, Start Wireshark, then File › Open ›
/captures/1.1.pcapng. - Read the packet list: what came before the first ping? Count the echo requests.
- Challenge: click a reply. Its Ethernet layer has the printer’s MAC address, its IP layer the TTL.
- Fill in answers/1.1.yml, then
make check T=1.1.
more in meet the lab
A recording of one cable
What a capture is
A packet capture is a recording of every frame that crossed one place in the network, while the recording ran. Each one is written down exactly as it was, bit for bit, with the time it was seen. Nothing is summarized and nothing is left out.
That’s what makes it different from everything else you’ve used so far. ip neigh tells you what the laptop
concluded. show mac address-table tells you what the switch learned. A capture shows you what was
actually sent, and in what order. When those disagree, the capture wins.
in one sentence A capture is a word-for-word recording of the frames that crossed one point, with the time of each.
Where this one is taken
make capture AT=laptop:eth1 records the laptop’s only network card, eth1: the cable between the laptop
and the switch. It’s like clipping a listening device onto that one cable. You’ll see everything the laptop
sends and everything that’s sent to it, and nothing else.
The lab does the recording from outside the laptop, with containerlab capture, so nothing on the laptop
knows it’s being watched. The file lands in captures/1.1.pcapng. pcapng (packet capture, next
generation) is the file format Wireshark saves by default. It holds the frames, and also the name of the
port each one was captured on, which matters in task 1.2.
in one sentence AT= names the cable you’re listening on; the frames go into a .pcapng file.
Wireshark’s three panes
Open a capture and Wireshark shows three panes, top to bottom:
| Pane | What it shows |
|---|---|
| Packet list | one line per frame: its number, the time, from, to, the protocol and a one-line summary |
| Packet details | the frame you clicked, layer by layer, each one a line you can open: Ethernet, then IP, then ICMP |
| Packet bytes | the same frame as raw bytes, in hex. Click a field in the details and its bytes light up |
The details pane is the layers from Networking 101, stacked the way they’re stacked on the wire: the outermost envelope first.
One ping, layer by layer
Here’s the packet list of a capture like yours, as tshark prints it in the terminal (Wireshark shows the same
columns):
1 0.000000000 aa:aa:aa:11:11:11 → Broadcast ARP 42 Who has 192.168.1.20? Tell 192.168.1.175
2 0.000113458 aa:aa:aa:22:22:22 → aa:aa:aa:11:11:11 ARP 42 192.168.1.20 is at aa:aa:aa:22:22:22
3 0.000115250 192.168.1.175 → 192.168.1.20 ICMP 98 Echo (ping) request id=0x07a0, seq=1/256, ttl=64
4 0.000193416 192.168.1.20 → 192.168.1.175 ICMP 98 Echo (ping) reply id=0x07a0, seq=1/256, ttl=64 (request in 3)
| Column | What it means |
|---|---|
1 | the frame number, counted from the start of the capture |
0.000113458 | seconds since the first frame |
aa:aa:aa:11:11:11 → Broadcast | from and to. For frames with no IP layer Wireshark shows MAC addresses |
ARP · ICMP | the highest layer Wireshark recognized in the frame |
42 · 98 | the frame’s length in bytes |
Who has ... | Wireshark’s one-line summary of it |
Click frame 4 and open its layers in the details pane (... marks lines left out here):
Frame 4: Packet, 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface laptop:eth1, id 0
Ethernet II, Src: aa:aa:aa:22:22:22 (aa:aa:aa:22:22:22), Dst: aa:aa:aa:11:11:11 (aa:aa:aa:11:11:11)
Internet Protocol Version 4, Src: 192.168.1.20, Dst: 192.168.1.175
...
Time to Live: 64
Protocol: ICMP (1)
...
Internet Control Message Protocol
Type: Echo (ping) reply (0)
...
Frame is Wireshark’s own line: when and where the frame was captured. Then come the layers: Ethernet (MAC addresses), IP (IP addresses, TTL), ICMP (the ping itself). The TTL (time to live) is a number every IP packet carries. Each router on the way takes one off, and a packet that reaches zero is thrown away, so lost packets can’t loop forever.
You may also see a frame from a MAC address you don’t know, with the protocol STP. That’s the switch: it sends a spanning tree message out of every port every two seconds, to check there are no loops in the cabling. Real switches do it too. Ignore it for now.
Capture, open, read
Capture the laptop’s cable while the lab sends four pings to the printer:
run in the terminalmake capture AT=laptop:eth1 NAME=1.1 X=pingIt prints each command it runs on the laptop, then
saved 11 frames to captures/1.1.pcapng(your number may be a frame or two different: an STP message lands in the middle now and then).Click the Wireshark tab at the top of the lab app, then Start Wireshark. The first start takes about half a minute (it fetches Wireshark once), then Wireshark fills the tab.
make wiresharkin the terminal does the same.In Wireshark, File › Open, go to
/captures, and open1.1.pcapng. (Prefer the terminal?tshark -r captures/1.1.pcapngprints the same packet list.)Look at the first frame the laptop sent: the first one from
aa:aa:aa:11:11:11. It isn’t a ping. Before the laptop could send anything to192.168.1.20, it needed the printer’s MAC address, so it asked. That’s ARP, from Networking 101’s lesson on ARP, on the wire.Count the Echo (ping) request frames. Then fill in the follow-along lines:
editanswers/1.1.ymlCtrl+P → 1.1.ymlfirst_protocol: ARP echo_requests: 4
in one sentence The laptop’s first frame was a question, not a ping: it had to learn the printer’s MAC address before it could send to it.
Read a reply
Click one of the Echo (ping) reply frames, and find two things in the packet details:
printer_mac: the printer’s MAC address, from the Ethernet layer;reply_ttl: the TTL in the printer’s reply, from the IP layer.
hint
The reply comes from the printer, so its MAC address is the Ethernet layer’s Src.
hint
Open the Internet Protocol Version 4 line with its arrow. Time to Live is about halfway down.
show the solutionanswers/1.1.yml
or pull it into your lab: make solve T=1.1, then git diff --staged shows what changed
printer_mac: aa:aa:aa:22:22:22
reply_ttl: 64
The printer is a Linux computer, and Linux starts every packet at a TTL of 64. It arrived at 64 because the printer is on the laptop’s own network: no router in between took anything off. Hold on to that: in task 1.2 the replies come from further away.
5 check: run it, then prove it
$ make check T=1.1when it's right, you'll see
╭─ task 1.1 · your first capture
│ ✓ captures/1.1.pcapng: taken on laptop:eth1, 11 frames
│ ✓ the protocol of the first frame the laptop sent (follow along): ...
│ ✓ how many echo requests the laptop sent (follow along): ...
│ ✓ the printer's MAC address, from a reply's Ethernet header (challenge): ...
│ ✓ the TTL in the printer's replies (challenge): ...
╰─ 5/5 checks passed verified