online posts 16
wireshark 101

task 3.1 · chapter 3 of 8: arp · 15 min

Who has?

objective

Read ARP’s question and answer field by field, and see which address the laptop asks about when the destination is on another network.

you edit, in the labanswers/3.1.yml

open a file in VS Code: Ctrl+P (Cmd+P on a Mac), type its name, Enter

given
Capturemake capture AT=laptop:eth1 NAME=3.1 X=arp: the laptop pings the printer, then web
Filterarp
Your answersanswers/3.1.yml
new to this? step by stepbeginner
  1. make capture AT=laptop:eth1 NAME=3.1 X=arp, open it, filter arp.
  2. Open the first request and its reply: the printer’s MAC, and where the request was sent.
  3. Challenge: the second request, made to reach web. Which IP address did it ask about? Whose MAC came back?
  4. Fill in answers/3.1.yml, then make check T=3.1.

more in meet the lab

1 explain

A question to everyone, an answer to one

What ARP is for

You met ARP in task 1.1: before the laptop could ping the printer, it had to learn the printer’s MAC address. Networking 101 explained why. An IP packet travels inside an Ethernet frame, and the frame needs a to MAC address. The laptop knows the printer’s IP address but not its MAC address, so it asks the whole network.

ARP has two messages:

  • the request, sent to everyone (the broadcast MAC address, ff:ff:ff:ff:ff:ff): who has 192.168.1.20? Tell 192.168.1.175;
  • the reply, sent only to the one that asked: 192.168.1.20 is at aa:aa:aa:22:22:22.

in one sentence ARP asks everyone who has this IP address?; only the owner answers, and only to the asker.

Two pairs of addresses

An ARP message carries four addresses, and Wireshark labels them like this:

FieldIn the requestIn the reply
Sender MAC addressthe laptop’s MACthe printer’s MAC: the answer
Sender IP addressthe laptop’s IPthe printer’s IP
Target MAC address00:00:00:00:00:00: unknown, that’s the questionthe laptop’s MAC
Target IP addressthe IP being asked aboutthe laptop’s IP

The Opcode says which one it is: request (1) or reply (2).

Only for your own network

ARP is a broadcast, and broadcasts stop at the router. So a host only ever ARPs for addresses on its own network. For anything further away, it sends the packet to its default gateway, and so it ARPs for the gateway instead. The IP packet still says to web; the Ethernet frame says to r1.

2 show

A request and a reply

Filtered to arp, a capture like yours:

    2 1.263625709 aa:aa:aa:11:11:11 → Broadcast    ARP 42 Who has 192.168.1.20? Tell 192.168.1.175
    3 1.264371584 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
    8 1.629981209 aa:aa:aa:11:11:11 → Broadcast    ARP 42 Who has 192.168.1.1? Tell 192.168.1.175
    9 1.630064376 aa:c1:ab:fd:00:84 → aa:aa:aa:11:11:11 ARP 42 192.168.1.1 is at aa:c1:ab:fd:00:84

And frame 2 in the details pane:

Ethernet II, Src: aa:aa:aa:11:11:11 (aa:aa:aa:11:11:11), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Address Resolution Protocol (request)
    Hardware type: Ethernet (1)
    Protocol type: IPv4 (0x0800)
    Hardware size: 6
    Protocol size: 4
    Opcode: request (1)
    Sender MAC address: aa:aa:aa:11:11:11 (aa:aa:aa:11:11:11)
    Sender IP address: 192.168.1.175
    Target MAC address: 00:00:00_00:00:00 (00:00:00:00:00:00)
    Target IP address: 192.168.1.20

Broadcast is Wireshark’s name for ff:ff:ff:ff:ff:ff. The laptop’s own IP address is whatever DHCP gave it (192.168.1.175 here); yours may be different. r1’s MAC address is made up when the lab starts, so yours will differ from aa:c1:ab:fd:00:84.

3 follow along

The printer’s answer

  1. Capture the laptop pinging the printer and then web. The lab empties the laptop’s ARP table first, so it has to ask:

    run in the terminal
    make capture AT=laptop:eth1 NAME=3.1 X=arp
    
  2. Open /captures/3.1.pcapng in Wireshark and filter arp.

  3. Click the first Who has 192.168.1.20? and open its Ethernet and ARP layers. Note the Ethernet Dst. Then click the reply below it and read its Sender MAC address.

  4. Fill in the follow-along lines:

    editanswers/3.1.ymlCtrl+P → 3.1.yml
    printer_mac: aa:aa:aa:22:22:22
    request_dst_mac: ff:ff:ff:ff:ff:ff
    

    (broadcast is accepted too.)

4 challenge

Reaching further

The laptop’s second ARP request was made so it could ping web, 192.168.2.10. Look at it:

  • asked_for_web: the IP address it asked about;
  • gateway_mac: the MAC address that came back.
hint

The second request isn’t Who has 192.168.2.10?. Why not?

hint

Read the reply’s Sender MAC address. To be sure whose it is, click r1 on the Topology tab, then in the r1 tab show interfaces GigabitEthernet1.

show the solutionanswers/3.1.yml

or pull it into your lab: make solve T=3.1, then git diff --staged shows what changed

asked_for_web: 192.168.1.1
gateway_mac: aa:c1:ab:fd:00:84      # yours is different: r1's MAC address

web is on another network, so the laptop never ARPs for it. It ARPs for its gateway, r1, and sends every frame for web to r1’s MAC address. Now look at a ping to web in the capture: IP destination 192.168.2.10, Ethernet destination r1. That one frame is the whole of Networking 101’s routing lesson.

5 check: run it, then prove it

$ make check T=3.1

when it's right, you'll see

╭─ task 3.1 · who has?
│  ✓ captures/3.1.pcapng: taken on laptop:eth1, 14 frames
│  ✓ the printer's MAC address, from its ARP reply (follow along): aa:aa:aa:22:22:22
│  ✓ where the laptop's ARP request was sent: its destination MAC (follow along): ...
│  ✓ the address the laptop asked ARP about, to reach web (challenge): ...
│  ✓ that address's MAC, from the reply (challenge): ...
╰─ 5/5 checks passed  verified