Routelearn.net
Course menu

Unit 6: ARP and Local CommunicationLesson 6.1 (1 of 3 in this unit)31 of 84 in the Network Fundamentals course

ARP Fundamentals

To send an IP packet over Ethernet or Wi-Fi, a device needs the MAC address of the next device, but usually knows only its IP address. ARP (Address Resolution Protocol) fills that gap. This lesson covers the ARP request and reply, what is inside each message, and the ARP cache that remembers the answers.

Beginner · 15 min read · Before this: MAC addresses, What is an IP address?, The default gateway

ARP (Address Resolution Protocol) is the protocol an IPv4 device uses to find the MAC (hardware) address that belongs to an IPv4 address on its local network. It asks with a broadcast request and gets the answer in a unicast reply.

In simple terms: IP addresses get data to the right network. On that network, frames are delivered by MAC address, so ARP asks “who has this IP address?” and the owner replies with its MAC address.

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."

💡 In simple terms: you know a colleague's name but not where they sit, so you stand up and call out across the office: "Who is Sam? Please wave!" Everyone hears you, but only Sam waves back, and now you remember where Sam sits. The shout is the ARP request, the wave is the reply, and your memory is the ARP cache.

Why ARP exists

Every network device has two addresses that do different jobs:

  • 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.

Where ARP sits

ARP works on the local subnet only. 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 important parts

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 on the subnet 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 example network

DeviceIP addressMAC address
PC-A192.168.10.10/2402:00:00:00:00:aa
PC-B192.168.10.20/2402:00:00:00:00:bb
Default gateway (router R1)192.168.10.1/2402:00:00:00:00:01

Request and reply

SwitchPC-A192.168.10.10 · …:aaPC-B192.168.10.20 · …:bbGateway R1192.168.10.1 · …:01
  1. 1. Request: broadcast. PC-A doesn't know PC-B's MAC address, so it sends an ARP request to the broadcast address ff:ff:ff:ff:ff:ff.
  2. 2. Everyone receives it. The switch floods the broadcast out of every other port. The router sees that the request is not for its IP address and ignores it. It does not forward the request to other networks.
  3. 3. Reply: unicast. Only PC-B answers. It sends its own MAC address directly to PC-A's MAC address. PC-B also saves PC-A's IP and MAC addresses from the request.
  4. 4. Cached and sent. PC-A stores the answer in its ARP cache and sends the actual traffic. Later packets skip ARP until the entry expires.
Request to everyone, reply to one: the shape of every ARP exchange.

Step by step

1. PC-A wants to send to 192.168.10.20
Its subnet mask shows that .20 is local, so the next hop is .20 itself. For a remote host, the next hop would be the default gateway.
2. Check the ARP cache
If there is an entry for 192.168.10.20, use it and skip to step 6. If not, continue.
3. Broadcast an ARP request
Destination MAC address ff:ff:ff:ff:ff:ff. Meanwhile, the packet waiting to be sent is held in a queue.
4. Every device checks the target IP
Devices that don't own the target IP address ignore it. PC-B sees “that's me” and caches PC-A's IP and MAC addresses from the request.
5. PC-B sends a unicast ARP reply
Directly to 02:00:00:00:00:aa, saying that 192.168.10.20 is at 02:00:00:00:00:bb.
6. PC-A caches the answer and sends the frame
Destination MAC address 02:00:00:00:00:bb, destination IP address 192.168.10.20.
What happens inside PC-A and PC-B during one ARP exchange.

The same exchange as a message flow

Step 1 of 2 · ARP Request
PC-A
192.168.10.10
Switch
192.168.10.0/24
PC-B
192.168.10.20
PC-A's ARP cache now holds
192.168.10.20:
02:00:00:00:00:bb (dynamic)
Tap a message to see its fields.

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.

Hardware type16 bits1 = Ethernet
Protocol type16 bits0x0800 = IPv4
HW length8 bits6 (bytes)
Proto length8 bits4 (bytes)
Operation16 bits1 request · 2 reply
Sender MAC address48 bits (continues)
Sender MAC (end)
Sender IP address32 bits (continues)
Sender IP (end)
Target MAC address48 bits (continues)
Target MAC (end)
Target IP address32 bitsthe address being asked about
The ARP message for IPv4 over Ethernet (28 bytes). The 6-byte MAC and 4-byte IP fields don't line up with 32-bit rows, so they wrap.
FieldIn the requestIn the reply
Operation1 (request)2 (reply)
Sender MAC02:00:00:00:00:aa (PC-A)02:00:00:00:00:bb (PC-B)
Sender IP192.168.10.10192.168.10.20
Target MAC00:00:00:00:00:00 (unknown)02:00:00:00:00:aa (PC-A)
Target IP192.168.10.20192.168.10.10

The frames that carry them

ARP Request frame

Broadcast

Layer 2 · Ethernet header (this hop)
Destination MAC
ff:ff:ff:ff:ff:ff
everyone
Source MAC
02:00:00:00:00:aa
PC-A
EtherType
0x0806
ARP (not IPv4)
Payload
ARP message · op 1 · sender 192.168.10.10 / …:aa · target 192.168.10.20 / 00:00:00:00:00:00

ARP Reply frame

Unicast

Layer 2 · Ethernet header (this hop)
Destination MAC
02:00:00:00:00:aa
PC-A only
Source MAC
02:00:00:00:00:bb
PC-B
EtherType
0x0806
ARP
Payload
ARP message · op 2 · sender 192.168.10.20 / …:bb · target 192.168.10.10 / …:aa

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.

Local or remote?

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

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:

Example output from a Windows PC (PC-A), written for this lesson
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
What to look for: there are only static entries for broadcast and multicast addresses, which Windows adds by itself. No other device is known yet.

After PC-A has talked to PC-B and to the internet:

Example output from a Windows PC (PC-A), written for this lesson
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
What to look for: the two new dynamic entries, for the default gateway (192.168.10.1) and PC-B. They were learned with ARP and will expire. Windows writes MAC addresses with dashes.
Example output from a Linux PC, written for this lesson
$ 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
Linux calls the ARP cache the neighbour table. What to look for: 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.
Example output · based on Cisco documentation; exact format varies by platform and software version
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
What to look for: a dash in the Age column marks the router's own address. A number shows how many minutes ago the entry was learned or last refreshed. A router keeps ARP entries for every subnet it is connected to.
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

SituationWhat you seeWhy
The target is off or unplugged, or the IP address is wrongPing: "Reply from 192.168.10.10: Destination host unreachable"; Linux neighbour state FAILED or INCOMPLETENobody 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 addressConnections that work and then drop; an "IP address conflict" warningBoth devices answer ARP requests, and caches switch between the two MAC addresses.
Stale entry after a device is replacedThe new device is unreachable for a few minutesOthers still send to the old MAC until the entry expires. Clearing the cache fixes it.
Wrong default gateway addressLocal destinations work; remote ones failThe 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

Troubleshooting ARP

  1. Ping the address you can't reach. This triggers an ARP request if there is no cache entry.
  2. Look at the ARP cache with arp -a or ip neigh. Is there an entry for the next hop (the host itself, or the default gateway for remote traffic)?
  3. 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.
  4. 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.

Common mistakes

  • 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 broadcasts stay in their own subnet.
✅ Key takeaways
  • 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.

Check yourself

Predict · scenario 1

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?

Predict · scenario 2

You capture the traffic while PC-A resolves PC-B's MAC address. How are the ARP request and reply delivered?

Predict · scenario 3

In PC-A's ARP request for 192.168.10.20, what is in the Target MAC field?

Predict · scenario 4

PC-A pings 192.168.10.30, which is switched off. What does Windows show?

FAQ

Is ARP a Layer 2 or a Layer 3 protocol?
It sits between the two. ARP messages travel directly inside Ethernet frames (EtherType 0x0806), not inside IP packets, but their job is to link Layer 3 IP addresses to Layer 2 MAC addresses. Many people call it a Layer 2 protocol, and some call it Layer 2.5.
Does ARP work across routers?
No. ARP requests are broadcasts, and routers don't forward broadcasts. A host only sends ARP requests for addresses on its own subnet: the destination itself, or the default gateway for anything remote.
How long do ARP cache entries last?
It depends on the system. Windows and Linux treat an entry as confirmed for somewhere between about 15 seconds and a few minutes, then check it again before relying on it. Cisco routers keep entries for 4 hours by default.
Does IPv6 use ARP?
No. IPv6 uses Neighbor Discovery (part of ICMPv6) instead. Its Neighbor Solicitation and Neighbor Advertisement messages do the same job as the ARP request and reply, but the solicitation is sent to a multicast address instead of a broadcast.