IP Addresses & Routing

ARP: How Devices Find Each Other on a Local Network

Learn how ARP turns a local IP address into a hardware address, how to read the cache and what to check when devices can't be reached.

Key takeaways

  • ARP maps an IPv4 address to a MAC address on the same local network.
  • The request is broadcast to everyone; the reply normally goes straight back to the asker.
  • Results are cached for a short time, and you can view and clear that cache.
  • For destinations outside your subnet, your device resolves the router's address instead.
  • ARP trusts whatever it hears, which is why untrusted networks need other protections.

The Address Resolution Protocol, ARP, answers one question: "I need to send to this IP address on my local network, so which hardware address should I put on the frame?" Your device asks everyone on the segment, and the owner of that address replies.

It runs quietly many times a day, defined since the early 1980s in RFC 826. When it goes wrong, the symptoms are strange: one device can't reach another although both look connected.

Why it is needed

Applications and routers think in IP addresses. Ethernet and Wi-Fi deliver frames using MAC addresses. MAC addresses vs. IP addresses covers why both exist. Something has to connect the two, and on IPv4 networks that something is ARP.

It doesn't use IP itself. ARP messages are carried directly in Ethernet frames with their own type value, 0x0806, so routers never forward them beyond the local network.

The exchange

Say your laptop at 192.168.1.20 wants to print to a printer at 192.168.1.50.

Finding a printer with ARP (example addresses)
Laptop .20 Other devices Printer .50 Who has 192.168.1.50? 1 Broadcast: everyone on the segment receives it Same broadcast arrives here 2 Includes the laptop's own IP and MAC 192.168.1.50 is at my MAC 3 A reply sent directly to the laptop Print data in unicast frames 4 The answer is cached for later Laptop .20 Other devices Printer .50 Who has 192.168.1.5 0? 1 Broadcast: everyone on the segment receives it Same broadcast arrives here 2 Includes the laptop's own IP and MAC 192.168.1.50 is at my MAC 3 A reply sent directly to the laptop Print data in unicast frames 4 The answer is cached for later

The broadcast is sent to ff:ff:ff:ff:ff:ff. Devices that don't own the requested address ignore it. The owner learns the asker's details from the request itself, so it can reply immediately without a lookup of its own.

Local or not?

Before using ARP, your device decides whether the destination is on its own subnet, using its address and subnet mask.

Whose hardware address do you need?
Is the destination inside your own subnet? YES Resolve the destination's own MAC address and send directly. 1 NO Is there a more specific route via another local router? YES Resolve that router's MAC address and hand it the packet. 2 NO Is a default gateway configured? YES Resolve the gateway's MAC address and send everything else there. 3 NO Nowhere to send it The system reports that the network is unreachable. Is the destination inside your own subnet? 1 IF YES Resolve the destination's own MAC address and send directly. NO Is there a more specific route via another local router? 2 IF YES Resolve that router's MAC address and hand it the packet. NO Is a default gateway configured? 3 IF YES Resolve the gateway's MAC address and send everything else there. NO Nowhere to send it The system reports that the network is unreachable.

So when you browse a distant website, no ARP request is ever made for the website's address. Your device only needs the MAC of your default gateway.

A wrong mask causes odd results here. If it's too broad, your device broadcasts for addresses that are actually elsewhere and gets no answer. If too narrow, it sends local traffic through the router.

The ARP cache

Asking every time would flood the network, so each device keeps a table of recent answers. View it on Windows or macOS with:

arp -a

On Linux:

ip neigh show

Linux labels each entry with a state:

State Meaning
REACHABLE Recently confirmed
STALE Known, but will be checked before long reliance
INCOMPLETE A request is out and unanswered
FAILED No answer came
PERMANENT Added by hand

Clearing the cache forces fresh lookups, useful after swapping a device or router. Each of these needs administrator rights:

Windows:  arp -d *
Linux:    sudo ip neigh flush all
macOS:    sudo arp -a -d

Your connection may pause for a moment while entries are rebuilt.

Special uses of ARP

Probing for conflicts. Before using an address, a device can ask whether anyone already has it, in a form of request that doesn't claim the address yet. RFC 5227 describes this.

Announcements. A device can broadcast its own mapping without being asked, often called gratuitous ARP. Failover pairs of routers or servers use it so neighbors learn quickly that an address has moved to new hardware.

Proxy ARP. A router answers on behalf of an address that is elsewhere, so a device sends to the router thinking it is local. It can patch over unusual designs, but it can also hide misconfigurations.

ARP and switches

A switch learns which MAC address is on which port by watching source addresses. Broadcasts, including ARP requests, go out every port in the same network segment. On very large flat networks that background chatter adds up, one of several reasons to divide networks with VLANs, each its own broadcast domain.

On Wi-Fi, some access points answer ARP on behalf of sleeping clients or limit broadcasts to save airtime. A buggy implementation of this can make one wireless device intermittently unreachable.

The trust problem

ARP has no authentication. A device on the same segment can send replies claiming addresses that aren't its own, and others may update their caches. This is called ARP spoofing or poisoning, and it can redirect local traffic through the wrong machine, as discussed in man-in-the-middle attacks.

Warning signs include:

  • the gateway's MAC address changing without any equipment change,
  • two different IP addresses, one of them the gateway, showing the same MAC unexpectedly,
  • repeated certificate warnings on a network,
  • connections that become erratic for several devices at once.

None of these proves an attack. Routers with several roles, failover pairs and virtual machines produce similar patterns legitimately.

Defenses work at several levels. Managed switches can offer dynamic ARP inspection, usually paired with DHCP snooping, which discards claims that don't match known assignments. Wi-Fi client isolation stops guests talking to each other. Separate networks keep untrusted devices away from important ones. Above all, use encrypted protocols such as HTTPS, so redirected traffic can't be read or silently altered, and don't click past certificate warnings.

Troubleshooting with ARP

If you can't reach a local device:

  1. Ping it, then immediately check the ARP table. A ping may fail because of the target's firewall while ARP still succeeds, which tells you the device is present.
  2. If the entry is incomplete or missing, check power, cabling, Wi-Fi band and whether both are on the same network. A guest network is usually separate.
  3. If the MAC isn't what you expect, look for two devices using one IP address. Disconnect the intended device; if something still answers, you've found the other.
  4. If entries are right but traffic fails, move up a layer: ports, services and firewalls.

A worked example: the replaced router

Say you swap in a new router and keep the same address, 192.168.1.1. A desktop that stayed powered on can't reach the internet for a short while, though your phone works at once.

The desktop's cache still maps 192.168.1.1 to the old router's hardware address. Frames sent there reach nobody. The entry normally corrects itself: the system notices that it can't confirm the neighbor and asks again, or the new router announces itself. If you're impatient, clearing the cache or toggling the network connection fixes it immediately.

The same thing happens upstream. After you change equipment connected to a provider, the provider's router may hold the old mapping for longer than you would like, which is one reason restarting the modem and waiting a few minutes is such common advice. Server administrators meet it when moving an address between machines: sending an announcement from the new owner shortens the gap.

Watching ARP yourself

On a network you manage, a packet capture shows the whole exchange. In Wireshark, type arp in the display filter. With tcpdump on Linux or macOS:

sudo tcpdump -n -e arp

The -e option prints the hardware addresses on each line. You'll see "who-has" requests followed by "is-at" replies. A device repeating the same request with no answer is looking for something that is off, gone or on another segment. A flood of requests for many consecutive addresses is usually a scanner or inventory tool; on your own network, find out which one.

Capture only on networks you own or have permission to examine, since other traffic can reveal information about the people using them.

Static entries

You can pin a mapping by hand so replies on the network don't change it:

Linux:  sudo ip neigh replace 192.168.1.50 lladdr 00:00:5e:00:53:10 dev eth0 nud permanent
macOS:  sudo arp -s 192.168.1.50 00:00:5e:00:53:10

Replace the interface and addresses with your own. These entries generally vanish at reboot unless your network configuration adds them again. Static entries suit a few narrow cases, such as sending a wake packet to a sleeping machine from a particular tool, or protecting one critical mapping on a small fixed network.

As a general defense they scale badly. Every hardware replacement means finding and updating each pinned entry, and a forgotten one produces exactly the kind of silent failure that is hardest to diagnose. Switch-based protections and encrypted protocols are better places to spend the effort.

Entries that look odd but are normal

An ARP table often lists a few addresses you never configured. On Windows you will usually see entries for multicast addresses beginning 224. or 239. and for the broadcast address, marked static. Their hardware addresses are derived by rule from the IP address, so no request is needed. Addresses starting 169.254. indicate a neighbor that assigned itself a link-local address, often because it couldn't reach a DHCP server, which address errors explains. A device missing from the table isn't necessarily offline either: if you haven't talked to it recently, there's simply no reason for an entry to exist.

What happens in IPv6

IPv6 doesn't use ARP. It replaces it with Neighbor Discovery, built on ICMPv6 and using multicast so that far fewer devices are interrupted by each query. It also handles router discovery. It inherits a similar trust question, with its own switch protections. On a network running both protocols, you may need to check both tables; ip -6 neigh on Linux and netsh interface ipv6 show neighbors on Windows show the IPv6 side.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in IP Addresses & Routing →

Latest news on this topic