The Big Picture: Knowing the Street Address but Not the Name
Your PC wants to send a message to 192.168.1.1 (the router). It knows the IP address. But the NIC can only build an Ethernet frame (Section 1) if it knows the MAC address of the receiver. The switch also forwards frames by MAC, not by IP.
So there is a gap: you have the IP, and you need the MAC. Imagine you want to visit "the person who lives at 12 Oak Street", but you must call out their name at the door. You stand in the street and shout: "Who lives at 12 Oak Street? Please tell me your name!" The right person answers.
That is exactly what ARP does, on the network.
3.1 Mapping an IP Address to a MAC Address
What it is: ARP (Address Resolution Protocol) finds the MAC address that belongs to an IP address on the same local network. It sits between the Internet layer (IP) and the Link layer (Ethernet).
Important: ARP works only on the local network. If the target is on another network, your PC does not ARP for it. It ARPs for the default gateway instead, and sends the frame to the router (Sections 2 and 8).
The steps:
PC A (192.168.1.25) PC B (192.168.1.40)
MAC: AA-AA-AA-00-00-01 MAC: BB-BB-BB-00-00-02
"I want to send to 192.168.1.40, but I do not know its MAC."
1. ARP REQUEST (broadcast, to FF-FF-FF-FF-FF-FF):
"Who has 192.168.1.40? Tell 192.168.1.25." ─────────────────────────► every device
on the network
hears this
2. Only B has that IP, so only B answers.
3. ARP REPLY (unicast, only to A):
"192.168.1.40 is at BB-BB-BB-00-00-02." ◄──────────────────────────── B
4. A saves the answer in its ARP cache (3.2) and sends the real frame to
BB-BB-BB-00-00-02.
Why a broadcast for the question? A does not know B's MAC yet, so it cannot address B. It uses the broadcast address FF-FF-FF-FF-FF-FF. The switch sends it out of all ports and every device on the network reads it. Devices that do not own that IP ignore it. B answers directly to A's MAC (which was inside the request), so the reply is not a broadcast.
What is inside an ARP message:
| Field | In the request | In the reply |
|---|---|---|
| Sender MAC and IP | A's MAC and IP | B's MAC and IP |
| Target MAC | all zeros ("unknown") | A's MAC |
| Target IP | 192.168.1.40 | 192.168.1.25 |
A nice side effect. Everybody who hears the request also learns A's MAC and IP, so they often store it too. That saves them from asking later.
Where ARP sits in a frame. An ARP message is carried directly inside an Ethernet frame whose Type field says "ARP" (Section 1.3). It does not use IP or TCP.
ARP has no security. Anyone on the local network can send a false ARP reply ("I am the router!"). That attack is called ARP spoofing. It is one reason to only use networks you trust, and why Wi-Fi encryption and switch security features exist. In this course you only look at ARP; you do not attack with it.
IPv6 note. IPv6 does not use ARP. It uses a similar job done by NDP (Neighbor Discovery Protocol). The idea is the same.
3.2 The ARP Cache
What it is: Asking "who has this IP?" for every single frame would flood the network. So each PC keeps a small table of recent answers called the ARP cache (or ARP table). The next frame to the same IP uses the table and no question is needed.
| IP address | MAC address | Type |
|---|---|---|
| 192.168.1.1 | A4-5E-60-12-9B-C7 | dynamic |
| 192.168.1.40 | BB-BB-BB-00-00-02 | dynamic |
| 192.168.1.255 | FF-FF-FF-FF-FF-FF | static |
Entry types:
- Dynamic entries were learned from replies. They expire after a short time (typically from tens of seconds to a few minutes if unused), then ARP asks again. This keeps the table correct when a device is replaced or gets a new IP.
- Static entries are fixed. Windows adds some by itself (like the broadcast address and multicast addresses).
See your own ARP cache (read-only):
arp -a
What you will see (your numbers will differ):
Interface: 192.168.1.25 --- 0x7
Internet Address Physical Address Type
192.168.1.1 a4-5e-60-12-9b-c7 dynamic
192.168.1.40 bb-bb-bb-00-00-02 dynamic
192.168.1.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
How to read it:
| Part | Meaning |
|---|---|
| Interface | Your own IP on the adapter that this block belongs to (one block per adapter) |
| Internet Address | The neighbour's IP |
| Physical Address | The neighbour's MAC |
| dynamic or static | How the entry was created |
ff-ff-ff-ff-ff-ff | The broadcast MAC |
224.0.0.x with a 01-00-5e-... MAC | Multicast (group) addresses |
Try it yourself (safe): run arp -a, then ping your router (for example ping 192.168.1.1), then run arp -a again. If the router was not listed before, it now appears. You have just made your PC send an ARP request.
Typical problems and what they mean:
| Symptom | Likely meaning |
|---|---|
Router is missing from arp -a even after a ping | The PC is not on the same network as the router, or the router is not answering |
| The same MAC for two different IPs | Normal for a router (it can own several IPs), but surprising for two ordinary PCs |
| Two different MACs ever claim one IP | Two devices have the same IP: an IP conflict. Windows shows a warning |
Windows tip: Deleting the whole cache needs an administrator window and is not needed in this course. Windows clears dynamic entries on its own after a short time.
Summary
| Topic | Remember this |
|---|---|
| Job of ARP | Turn an IP address into a MAC address on the same local network |
| Request | A broadcast: "Who has 192.168.1.1? Tell 192.168.1.25" |
| Reply | A unicast from the owner: "192.168.1.1 is at this MAC" |
| Other networks | Your PC ARPs for the default gateway, not the faraway target |
| ARP cache | Table of recent answers; dynamic entries expire, static ones stay |
| Command | arp -a shows the cache |
| Weak spot | ARP has no authentication, so fake replies are possible |