ARP: How IPv4 Finds the MAC Address, the ARP Cache and the Frame Format
How a host turns a next-hop IPv4 address into a MAC address with the Address Resolution Protocol: direct delivery and the role of the router, the request and reply on the wire, the 28-byte message format, the ARP cache and its states on Linux, and what happens when nobody answers.
kvi5hnuCode Sprout team member15 min readOn this page
To send an IPv4 packet over Ethernet or Wi-Fi, a host has to put a destination MAC address in the frame. The routing table tells it which IPv4 address is the next hop, but not which MAC address belongs to it. The Address Resolution Protocol (ARP), defined in RFC 826 in 1982 and almost unchanged since, fills that gap. It works on any broadcast-capable link: a host broadcasts "who has this IP address?", and the owner replies with its MAC address.
ARP exists only for IPv4. IPv6 does the same job with Neighbor Discovery, which uses ICMPv6 (the IPv6 version of ICMP, the Internet Control Message Protocol that also carries ping; article 39) and multicast instead of broadcast (article 42), but many ideas below, especially the cache states, are shared.
Direct delivery and the next hop
When a host sends an IPv4 packet, it first decides where the packet goes next (article 27):
- If the destination is on a directly connected subnet, for example
192.0.2.2from192.0.2.1/24, the host delivers it directly, and the next hop is the destination itself. - Otherwise it sends the packet to a router, usually the default gateway. The next hop is the router's address, while the IP header still carries the final destination.
Either way, ARP is used only to find the MAC address of the next hop on the local link. A host never ARPs for a remote server's address. When you fetch a web page from across the Internet, your host ARPs once for its gateway, and from then on every packet to every remote destination goes in a frame addressed to the gateway's MAC. At the next router, the same thing happens again with that router's next hop. The IP addresses stay the same end to end, while the MAC addresses change on every link.
ARP on the wire
The lab connected two hosts, a (192.0.2.1) and b (192.0.2.2), and disabled IPv6 so that nothing else would talk first. At the start, a's ARP cache is empty, and then a sends a single ping to b, which is answered:
(cache empty)
64 bytes from 192.0.2.2: icmp_seq=1 ttl=64 time=0.098 ms
A capture of that ping. Each line shows the frame number, the time in seconds since the first frame, source → destination, the protocol, the frame length in bytes and a summary:
1 0.000000 02:00:00:00:0a:01 → Broadcast ARP 42 Who has 192.0.2.2? Tell 192.0.2.1
2 0.000016 02:00:00:00:0b:01 → 02:00:00:00:0a:01 ARP 42 192.0.2.2 is at 02:00:00:00:0b:01
3 0.000017 192.0.2.1 → 192.0.2.2 ICMP 98 Echo (ping) request id=0x0020, seq=1/256, ttl=64
4 0.000038 192.0.2.2 → 192.0.2.1 ICMP 98 Echo (ping) reply id=0x0020, seq=1/256, ttl=64 (request in 3)
Four frames:
abroadcasts an ARP request toff:ff:ff:ff:ff:ff: "Who has 192.0.2.2? Tell 192.0.2.1." Every host on the link receives it.brecognizes its own address and sends an ARP reply directly toa's MAC address: "192.0.2.2 is at 02:00:00:00:0b." Every other host ignores the request.- and 4. Now
acan send the ping in a frame tob's MAC address, andbanswers.bdoesn't need to ARP fora, as you'll see in a moment.
The whole exchange took about 20 microseconds here. On a real LAN, it usually takes well under a millisecond, but it's why the first ping to a new neighbor is sometimes a little slower than the rest.
Note that the frames carry no IP header. ARP sits directly on the link layer with its own EtherType, 0x0806.
The ARP message format
The figure shows the 28-byte message, four bytes per row. The list after it explains each field.

ARP was designed to map any network address to any hardware address, so the message starts by saying which kinds it holds:
- Hardware type: 1 for Ethernet (also used for Wi-Fi).
- Protocol type: the EtherType of the protocol being resolved,
0x0800for IPv4. - Hardware size and protocol size: address lengths in bytes, 6 and 4.
- Opcode: 1 for a request, 2 for a reply. (Codes 3 and 4 were for RARP, Reverse ARP, an old way for diskless machines to learn their own IP address, long since replaced by DHCP, article 29.)
- Sender hardware and protocol addresses: who is sending this message.
- Target hardware and protocol addresses: who it's about. In a request, the target MAC is unknown and is set to zeros.
Here is the lab's request, decoded:
Ethernet II, Src: 02:00:00:00:0a:01, Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Destination: Broadcast
Source: 02:00:00:00:0a:01
Type: ARP (0x0806)
Address Resolution Protocol (request)
Hardware type: Ethernet (1)
Protocol type: IPv4 (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: request (1)
Sender MAC address: 02:00:00:00:0a:01
Sender IP address: 192.0.2.1
Target MAC address: 00:00:00:00:00:00
Target IP address: 192.0.2.2
And its bytes. After the 14-byte Ethernet header (ff ff ff ff ff ff, a's MAC, 08 06), the 28-byte message begins with 00 01 08 00 06 04 00 01:
0000 ff ff ff ff ff ff 02 00 00 00 0a 01 08 06 00 01 ................
0010 08 00 06 04 00 01 02 00 00 00 0a 01 c0 00 02 01 ................
0020 00 00 00 00 00 00 c0 00 02 02 ..........
c0 00 02 01 is 192.0.2.1 (hex c0 = 12 × 16 + 0 = 192, then 0, 2 and 1) and c0 00 02 02 is 192.0.2.2. The frame is 42 bytes, which is below Ethernet's 60-byte minimum, so the network card pads it with zeros before sending (article 14). The capture shows it before padding.
The reply swaps the roles: b is now the sender, and a is the target, with its real MAC address:
Address Resolution Protocol (reply)
Hardware type: Ethernet (1)
Protocol type: IPv4 (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: reply (2)
Sender MAC address: 02:00:00:00:0b:01
Sender IP address: 192.0.2.2
Target MAC address: 02:00:00:00:0a:01
Target IP address: 192.0.2.1
The sender fields of the request already told b everything it needed about a. A host that receives a request for its own address also records the requester's address in its cache, because it will almost certainly have to answer. That's why b sent its ping reply without an ARP request of its own.
The ARP cache
Broadcasting before every packet would be wasteful, so each host keeps an ARP cache of recent answers. After the ping:
192.0.2.2 dev eth0 lladdr 02:00:00:00:0b:01 REACHABLE
on b: 192.0.2.1 dev eth0 lladdr 02:00:00:00:0a:01 DELAY
Each line gives the IP address, the interface, lladdr (the link-layer address, here the MAC) and the entry's state, explained below. On Linux, ip neigh show lists it (the older arp -n still works). Windows uses arp -a or Get-NetNeighbor in PowerShell, and macOS arp -a. Entries can also be added permanently by hand, which article 22 covers.
Linux treats ARP entries as part of a general neighbor table, shared with IPv6, with a small state machine called neighbor unreachability detection (NUD):
| State | Meaning |
|---|---|
| INCOMPLETE | A request has been sent and no reply has arrived yet. Packets for this address are queued. |
| REACHABLE | Recently confirmed to be reachable. Used without question. |
| STALE | Not confirmed for a while. Still used, but the next packet triggers a check. |
| DELAY | A packet was just sent using a stale entry. Wait briefly for confirmation from a higher layer. |
| PROBE | No confirmation came. Send unicast ARP requests to the cached address. |
| FAILED | No reply at all. Packets to this address fail. |
| PERMANENT | Configured by hand and never expires. |
b's entry for a was in DELAY: it had learned a from the request, then sent a packet (the ping reply) using that unconfirmed entry.
Confirmation can come from an ARP reply, but also from the layers above. When a TCP connection receives new acknowledgments from a neighbor, the kernel knows the neighbor is alive and refreshes the entry without any ARP traffic. Applications can confirm too: Linux's ping, after it gets a reply, marks its next request with a flag (MSG_CONFIRM) that refreshes the entry. A single ping, as in the lab below, gets no such help, so the entry has to be checked with ARP.
Timers
Linux's timers are per interface, under /proc/sys/net/ipv4/neigh/<interface>/:
base_reachable_time_ms 30000
delay_first_probe_time 5
gc_stale_time 60
mcast_solicit 3
ucast_solicit 3
retrans_time_ms 1000
- An entry stays REACHABLE for a random time between half and one and a half times
base_reachable_time_ms(30 s), so hosts don't all re-check at once. - After use in STALE, it waits
delay_first_probe_time(5 s) in DELAY before probing. - Probing sends up to
ucast_solicit(3) unicast requests,retrans_time_ms(1 s) apart. Resolving a new address sends up tomcast_solicit(3) broadcasts. - An unused STALE entry is removed by garbage collection after roughly
gc_stale_time(60 s), once the table holds enough entries for the collector to run.
To see a whole life cycle in under half a minute, the lab shortened two timers and watched the entry for b on a. The first list below is the entry's state over time, the second is the ARP traffic captured meanwhile, and the chart after them plots the first list:
0.0 s REACHABLE
7.7 s STALE
14.1 s DELAY
17.3 s REACHABLE
24.5 s STALE
0.0 s broadcast request from 192.0.2.1: who has 192.0.2.2?
0.0 s reply from 192.0.2.2
5.5 s unicast request (probe) from 192.0.2.2: who has 192.0.2.1?
5.5 s reply from 192.0.2.1
17.1 s unicast request (probe) from 192.0.2.1: who has 192.0.2.2?
17.1 s reply from 192.0.2.2

The first ping made the entry REACHABLE. A few seconds later (a random time between 3 and 9 seconds with these settings, so it differs from run to run) it became STALE, but stayed in the table and was still usable. The second ping at 14 seconds used the stale entry right away, without waiting for anything, and moved it to DELAY. After 3 seconds without confirmation, a sent a unicast ARP request straight to b's cached MAC address, got a reply, and the entry was REACHABLE again. The earlier probe, at about 5 seconds, came from b, checking its own entry for a in the same way. The PROBE state lasted only a fraction of a millisecond, so the 250 ms sampling never caught it.
Other systems use simpler rules. BSD-derived systems (descended from the Berkeley Software Distribution of Unix), including macOS, traditionally kept a resolved entry for 20 minutes, and Windows uses a random reachable time of 15 to 45 seconds, similar to Linux. The result is the same: entries are refreshed regularly, so a host that changes its MAC address is found again within a minute or so.
When nobody answers
What happens if a host on the same subnet doesn't exist, or is switched off? The lab pinged 192.0.2.99, an unused address on a's subnet:
PING 192.0.2.99 (192.0.2.99) 56(84) bytes of data.
From 192.0.2.1 icmp_seq=1 Destination Host Unreachable
From 192.0.2.1 icmp_seq=2 Destination Host Unreachable
From 192.0.2.1 icmp_seq=3 Destination Host Unreachable
From 192.0.2.1 icmp_seq=4 Destination Host Unreachable
--- 192.0.2.99 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3080ms
pipe 4
neighbor entry right after: 192.0.2.99 dev eth0 FAILED
0.000 s ARP, Request who-has 192.0.2.99 tell 192.0.2.1
1.032 s ARP, Request who-has 192.0.2.99 tell 192.0.2.1
2.056 s ARP, Request who-has 192.0.2.99 tell 192.0.2.1
3.080 s ARP, Request who-has 192.0.2.99 tell 192.0.2.1
4.104 s ARP, Request who-has 192.0.2.99 tell 192.0.2.1
In the ping output, +4 errors counts the four locally generated errors, and pipe 4 means up to four pings were waiting for an answer at the same time. a broadcast a request about once a second. After three requests without a reply, the entry went to FAILED and the waiting packet was dropped. The ping program then got "Destination Host Unreachable", generated locally by a itself (the From 192.0.2.1): no packet ever left a except the ARP requests. Each new ping restarted resolution, so requests kept coming as long as pings did. The FAILED entry stays for a while:
192.0.2.99 dev eth0 FAILED
A TCP connection to the missing host fails the same way, with "No route to host" (EHOSTUNREACH) after the requests time out:
bash: connect: No route to host
This is a useful clue when troubleshooting. "Destination Host Unreachable" from your own address means ARP got no answer on the local subnet: the target is down, has a different address, or is on a different VLAN. The same message from a router's address means the router itself couldn't resolve the target on its far-side subnet (article 40). For a remote destination, you'd see nothing like this, because your host only ARPs for the gateway.
Common questions
Does ARP work across routers?
No. ARP requests are link-layer broadcasts and never leave the local link. To reach another subnet, a host ARPs only for its router, and each router does its own ARP on the next link. (Proxy ARP, in article 22, is a special case where a router answers on behalf of hosts behind it.)
Why do I see ARP requests for addresses that don't exist on my network?
Common reasons: a host configured with a wrong subnet mask that thinks a remote address is local, a device with a stale configuration trying to reach an old gateway, scanning tools, or a network monitoring system sweeping the subnet.
Why does my cache show my router's MAC address for many IP addresses?
It normally shouldn't: you ARP only for the gateway, not for remote hosts. If several local IP addresses map to one MAC address, it's either one device with several addresses, a router doing proxy ARP, or an ARP spoofing attack (article 22).
How do I clear the ARP cache?
On Linux, ip neigh flush dev eth0 (or ip neigh del 192.0.2.2 dev eth0 for one entry). On Windows, arp -d * or netsh interface ip delete arpcache. On macOS, sudo arp -a -d. The cache fills again as soon as traffic flows.
Is ARP used on Wi-Fi?
Yes, IPv4 over Wi-Fi uses ARP exactly as over Ethernet. Many access points answer ARP requests for their associated clients themselves (proxy ARP or ARP offload), so sleeping phones don't have to wake up for every broadcast.
Why doesn't IPv6 use ARP?
IPv6 replaced it with Neighbor Discovery, which uses ICMPv6 messages sent to solicited-node multicast addresses instead of broadcasts, so only the few hosts whose addresses end in the same bits receive the question. ND also handles router discovery, address autoconfiguration and duplicate address detection, and it can be secured (article 42).
Summary
- ARP (RFC 826) maps a next-hop IPv4 address to a MAC address on a broadcast link. IPv6 uses Neighbor Discovery instead.
- A host ARPs only for the next hop: the destination itself on the same subnet, otherwise its router. MAC addresses change at every hop, IP addresses don't.
- A request is broadcast ("who has 192.0.2.2? tell 192.0.2.1"), and the reply is unicast from the owner. The target also caches the requester's address from the request.
- The 28-byte message for IPv4 over Ethernet holds the hardware and protocol types and lengths, an opcode (1 request, 2 reply), and the sender and target MAC and IPv4 addresses. It rides directly in Ethernet with EtherType
0x0806. - Hosts cache answers. Linux's neighbor states are INCOMPLETE, REACHABLE, STALE, DELAY, PROBE, FAILED and PERMANENT. Stale entries are still used, then re-checked with unicast probes, and confirmations from TCP avoid ARP traffic.
- If nobody answers after three requests about a second apart, the entry fails and the sender reports "Destination Host Unreachable" from its own address, or "No route to host" for TCP.
Practice questions
1. Host 192.0.2.10/24 with default gateway 192.0.2.1 sends a packet to 203.0.113.5. For which IP address does it send an ARP request, and what are the frame's destination MAC and the packet's destination IP?
Answer
It ARPs for 192.0.2.1, the gateway, because 203.0.113.5 isn't on its subnet. The frame goes to the gateway's MAC address, while the IP header's destination stays 203.0.113.5.
2. In an ARP request from 02:00:00:00:0a:01 (192.0.2.1) asking for 192.0.2.2, what are the four address fields and the Ethernet destination?
Answer
Sender MAC 02:00:00:00:0a:01, sender IP 192.0.2.1, target MAC 00:00:00:00:00:00 (unknown), target IP 192.0.2.2. The Ethernet destination is the broadcast address ff:ff:ff:ff:ff:ff.
3. Why doesn't the target of an ARP request usually need to send its own ARP request before replying to the requester's IP traffic?
Answer
The request's sender fields contain the requester's IP and MAC addresses, and RFC 826 says a host that is the target of a request should add or update the sender's entry in its cache. It can then answer the requester's packets right away.
4. A Linux host's entry for its gateway is STALE, and an application sends a packet to the Internet. Is the packet delayed? What happens to the entry next?
Answer
The packet isn't delayed: a stale entry is still used, so the packet goes out immediately to the cached MAC address. The entry moves to DELAY. If no confirmation (such as new TCP acknowledgments) arrives within delay_first_probe_time, it moves to PROBE and the host sends unicast ARP requests to the cached address. A reply makes it REACHABLE. With no reply, it becomes FAILED.
5. You ping a host on your own subnet and get "From 192.0.2.10 icmp_seq=1 Destination Host Unreachable", where 192.0.2.10 is your own address. What does it tell you, and what would you check?
Answer
Your own host generated the error because ARP for the target got no reply, so the problem is local to the subnet. Check that the target is powered on and connected, that its IP address and subnet are what you expect, that it's in the same VLAN, and that no firewall on it drops ARP (rare). A capture on your interface should show the unanswered ARP requests.
6. How large is an ARP request frame on the wire, including padding and FCS?
Answer
14 bytes Ethernet header + 28 bytes ARP = 42 bytes, padded to the 60-byte minimum, plus a 4-byte FCS (frame check sequence, Ethernet's CRC) = 64 bytes (and the preamble and gap on top). Captures usually show 42 bytes because the sender's capture sees the frame before padding.
Previous: Loopback, MTU and Tunnels: GRE, VXLAN and WireGuard
Next: Proxy ARP, Gratuitous ARP, Address Conflict Detection and ARP Attacks

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.