The gap ARP fills
To send an IP packet over Ethernet, a host must put it in a frame, and a frame needs a destination MAC address. The host knows the destination's IP address (you typed it, or DNS provided it), but not its MAC address. ARP (Address Resolution Protocol) asks the local network: "Who has this IP address? Tell me your MAC address."
Two addresses, set independently
A host on an Ethernet or Wi-Fi network, such as a PC, a phone or a router interface, has two addresses that do different jobs. (Not every network device needs both: an unmanaged switch forwards frames without any IP address of its own.)
- The IP address is a logical address used end to end. Applications and people use it.
- The MAC address is a hardware address that only has meaning on one local link. Switches and network cards use it.
Learn more: What Is an IP Address?MAC Addresses
Nothing in the IP address tells you the MAC address. They are set independently: the IP address by DHCP or an administrator, and the MAC address by the manufacturer (or randomly by the operating system, on many phones and laptops). So something has to look up the MAC address at the moment it is needed. On IPv4 networks, that is ARP.
ARP stays on the local subnet
Before following the exchange, separate the two jobs. The route lookup chooses the next hop, meaning the next device that should receive the packet on this link. ARP then finds that device's MAC address. For local PC-B, the next hop is PC-B itself. For a remote server reached through the default route, the next hop is the nearby router. A useful ARP answer cannot repair a wrong route.
An ARP request is its own Ethernet payload, not an IPv4 packet sent to a special TCP or UDP port. In the header diagram below, EtherType 0x0806 tells the receiver to interpret the payload as ARP. The sender and target IP fields inside that payload describe the mapping being requested; they are not an IP header.
ARP works on the local subnet only. Strictly, an ARP broadcast reaches the whole Layer 2 broadcast domain (the VLAN), not the IP subnet. Usually one VLAN carries one subnet, so the two are the same; if two subnets share a VLAN, hosts in both receive the broadcast, and only the owner of the target address answers. Its messages are carried directly in an Ethernet frame with EtherType 0x0806 (normal IPv4 traffic uses 0x0800). There is no IP header in an ARP message, so a router has no destination IP address to route it with, and it does not forward ARP messages to other networks.
The broadcast request and unicast reply below are the ordinary case. There are variants: a gratuitous ARP announces a device's own address (used after an address change and by gateway redundancy protocols), proxy ARP lets a router answer for another host, and many operating systems send a unicast ARP request to check that a cached entry is still valid.
Request, reply, cache and next hop
ARP Request
“Who has 192.168.10.20? Tell 192.168.10.10.” It is sent as a broadcast, because the sender doesn't know the target's MAC address yet. Every device in the same broadcast domain (VLAN) receives it.
ARP Reply
“192.168.10.20 is at 02:00:00:00:00:bb.” It is sent as a unicast directly back to the sender of the request, whose MAC address was in the request.
ARP cache
A small table in every host and router that remembers IP address → MAC address answers for a while, so ARP isn't needed for every packet.
Next-hop IP
The IP address that ARP resolves: the destination itself if it is on the local subnet, or the default gateway if it is remote.
The addresses used in this lesson
| Device | IP address | MAC address |
|---|---|---|
| PC-A | 192.168.10.10/24 | 02:00:00:00:00:aa |
| PC-B | 192.168.10.20/24 | 02:00:00:00:00:bb |
| Default gateway (router R1) | 192.168.10.1/24 | 02:00:00:00:00:01 |
Three outcomes when PC-A sends to PC-B
PC-A wants to send a packet to PC-B (192.168.10.20). What happens depends on what is already in its ARP cache, and on whether PC-B answers. Pick a case:
Device key: PC-A (laptop) · PC-B (computer) · Gateway R1 (router)
Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
MAC addresses identify link-layer interfaces or destination groups. They are not IP addresses or website URLs.
- PC-A: 192.168.10.10 · …:aa
- PC-B: 192.168.10.20 · …:bb
- Gateway R1: 192.168.10.1 · …:01
Frame 02:00:00:00:00:aa to ff:ff:ff:ff:ff:ff.
Tip: click or tap a device to see its details.
- 1. Request (broadcast): PC-A doesn't know PC-B's MAC address, so it broadcasts an ARP request. The packet for PC-B waits in a queue.
- 2. Everyone receives it: The switch floods it out of every other port. R1 sees the target IP is not its own and ignores it.
- 3. Reply (unicast): Only PC-B answers, straight to PC-A's MAC address. PC-B also caches PC-A's addresses from the request.
- 4. Cached and sent: PC-A stores the answer and sends the waiting packet to PC-B's MAC address.
Inside one ARP exchange
Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.
Inside an ARP message
An ARP message for IPv4 over Ethernet is 28 bytes long. It is padded to the Ethernet minimum frame size, so on the wire it fills a 64-byte frame.
Read each row from left to right. The ruler gives bit positions 0–31 within that row; field sizes are labelled in bits or bytes.
| Field | In the request | In the reply |
|---|---|---|
| Operation | 1 (request) | 2 (reply) |
| Sender MAC | 02:00:00:00:00:aa (PC-A) | 02:00:00:00:00:bb (PC-B) |
| Sender IP | 192.168.10.10 | 192.168.10.20 |
| Target MAC | 00:00:00:00:00:00 (unknown) | 02:00:00:00:00:aa (PC-A) |
| Target IP | 192.168.10.20 | 192.168.10.10 |
The frames that carry them
ARP Request frame
Broadcast
ARP Reply frame
Unicast
Notice that there is no IP header in either frame: the IP addresses are fields inside the ARP message. IPv6 doesn't use ARP at all. It uses Neighbor Discovery instead.
Why the gateway is the busiest ARP entry
A host only sends ARP requests for addresses on its own subnet. For any other destination, it sends an ARP request for its default gateway and sends the frame to the gateway's MAC address. The packet inside keeps the remote destination IP address. This is why the most used entry in most PCs' ARP caches is the router. The topic is important enough to have its own lesson.
Learn more: ARP for Local and Remote Destinations
The ARP cache: how long answers last
Answers are cached so that ARP isn't needed for every packet. Entries expire after seconds to minutes on most PCs, and after 4 hours by default on Cisco routers. If a device's MAC address changes (for example, after a network card is replaced or a failover), stale entries can send traffic to the old MAC address for a while.
Before PC-A has talked to anyone, its cache is nearly empty:
C:\> arp -a Interface: 192.168.10.10 --- 0xb Internet Address Physical Address Type 192.168.10.255 ff-ff-ff-ff-ff-ff static 224.0.0.22 01-00-5e-00-00-16 static 255.255.255.255 ff-ff-ff-ff-ff-ff static
After PC-A has talked to PC-B and to the internet:
C:\> arp -a Interface: 192.168.10.10 --- 0xb Internet Address Physical Address Type 192.168.10.1 02-00-00-00-00-01 dynamic 192.168.10.20 02-00-00-00-00-bb dynamic 192.168.10.255 ff-ff-ff-ff-ff-ff static 224.0.0.22 01-00-5e-00-00-16 static 255.255.255.255 ff-ff-ff-ff-ff-ff static
192.168.10.1) and PC-B. They were learned with ARP and will expire. Windows writes MAC addresses with dashes.$ ip neigh 192.168.10.1 dev eth0 lladdr 02:00:00:00:00:01 REACHABLE 192.168.10.20 dev eth0 lladdr 02:00:00:00:00:bb STALE
REACHABLE means the entry was confirmed recently. STALE means it can still be used, but Linux will confirm it again the next time it sends traffic to that address. On older Linux systems and on macOS, use arp -a.R1#show ip arp Protocol Address Age (min) Hardware Addr Type Interface Internet 192.168.10.1 - 0200.0000.0001 ARPA GigabitEthernet0/0 Internet 192.168.10.10 12 0200.0000.00aa ARPA GigabitEthernet0/0 Internet 192.168.10.20 3 0200.0000.00bb ARPA GigabitEthernet0/0
arp -d *Clear the ARP cache on Windows (run as administrator). On Linux, use sudo ip neigh flush all. On a Cisco router, use clear arp-cache.
What happens when ARP fails
| Situation | What you see | Why |
|---|---|---|
| The target is off or unplugged, or the IP address is wrong | Ping: "Reply from 192.168.10.10: Destination host unreachable"; Linux neighbour state FAILED or INCOMPLETE | Nobody answered the ARP request, so no frame can be built. The message comes from your own PC, not from the target. |
| Two devices with the same IP address | Connections that work and then drop; an "IP address conflict" warning | Both devices answer ARP requests, and caches switch between the two MAC addresses. |
| Stale entry after a device is replaced | The new device is unreachable until old entries are refreshed (seconds on PCs, up to hours on routers) | Others still send to the old MAC until the entry expires. Clearing the cache fixes it. |
| Wrong default gateway address | Local destinations work; remote ones fail | The PC sends ARP requests for an address that no router uses (see The Default Gateway). |
ARP has no built-in security: any device can answer, and hosts believe the answer. Attackers abuse this with ARP spoofing. The ARP Security lesson (CCNA track) explains how networks defend against it. Special ARP messages, such as gratuitous ARP, have their own lesson.
Learn more: ARP SecurityGratuitous ARP, Probes and Proxy ARP
Four checks for an ARP problem
- Ping the address you can't reach. This triggers an ARP request if there is no cache entry.
- Look at the ARP cache with
arp -aorip neigh. Is there an entry for the next hop (the host itself, or the default gateway for remote traffic)? - No entry, or FAILED: the target didn't answer. Check that it is powered on, connected, in the same VLAN, and has the IP address you expect.
- An entry with an unexpected MAC address: there is a duplicate IP address or an old cache entry. Compare it with the MAC address on the device itself (
ipconfig /all), then clear the cache.
When a duplicate IP address is suspected, the unexpected MAC address is the best lead. Look it up in the switch's MAC address table and it points to the port where the second device is plugged in.
Exercise: the replaced printer
The office printer at 192.168.10.30 was replaced this morning. The new printer kept the same IP address. Now PC-A can't print, although PC-B, which was switched off overnight, prints fine. The sticker on the new printer says its MAC address is 02-00-00-00-00-3b. On PC-A you run:
C:\> arp -a Interface: 192.168.10.10 --- 0xb Internet Address Physical Address Type 192.168.10.1 02-00-00-00-00-01 dynamic 192.168.10.30 02-00-00-00-00-30 dynamic
ARP misconceptions to drop
- Thinking a PC sends ARP requests for remote IP addresses, such as a web server on the internet. The remote server can't receive the broadcast, so the PC sends an ARP request for its default gateway instead.
- Thinking the reply is a broadcast. Only the request is a broadcast. The reply is a unicast, because the target already knows the sender's MAC address from the request.
- Confusing the ARP cache with a switch's MAC address table. The ARP cache on hosts and routers maps IP address → MAC address; a switch's table maps MAC address → port (see How a Switch Learns MAC Addresses).
- Expecting ARP to cross a router. ARP requests are broadcasts, and routers don't forward ARP broadcasts, so they stay on their own subnet.
- ARP finds the MAC address that belongs to an IPv4 address on the local subnet.
- The request is a broadcast to ff:ff:ff:ff:ff:ff; the reply is a unicast back to the sender.
- ARP is carried directly in Ethernet frames (EtherType 0x0806), with operation, sender MAC/IP and target MAC/IP fields.
- Answers are kept in the ARP cache. View it with arp -a or ip neigh.
- Hosts send ARP requests for local destinations directly, and for the default gateway for everything else.
Test yourself on ARP
In the troubleshooting exercise above, why can't PC-A print, and what fixes it fastest?
PC-A (192.168.10.10/24) wants to reach a server at 203.0.113.20. Whose MAC address does it ask for with ARP?
You capture the traffic while PC-A resolves PC-B's MAC address. How are the ARP request and reply delivered?
In PC-A's ARP request for 192.168.10.20, what is in the Target MAC field?
PC-A pings 192.168.10.30, which is switched off. What does Windows show?