ARP (Address Resolution Protocol)
Address Resolution Protocol (ARP) discovers the link-layer address, usually a MAC address, that a device needs to deliver an IPv4 packet to another device on the same link.
What ARP resolves
A host makes a routing decision before it uses ARP. If the destination is on a directly connected Ethernet network, the host resolves that destination's IPv4 address. If the route points through a gateway, it resolves the gateway's address instead. The remote server's MAC address is not needed on the local link.
An ARP request is normally broadcast on that Layer 2 network. The device that owns the requested IPv4 address can answer with its MAC address, allowing the sender to populate a neighbor-cache entry. A proxy ARP configuration can answer on another device's behalf, so a reply alone does not identify the final destination host.
Worked example
A laptop has address 192.0.2.20/24 and gateway 192.0.2.1. It needs to reach 198.51.100.8 through that gateway.
- The laptop's route lookup selects
192.0.2.1as the next hop. - If the gateway's MAC is unknown, the laptop broadcasts an ARP request for
192.0.2.1. - The gateway replies, for example with
02:00:00:00:02:01. - The laptop sends an Ethernet frame to that MAC. The packet inside still has destination IP
198.51.100.8.
When the packet leaves another router interface, it is placed in a new link-layer frame for that next link.
Inspect the neighbor cache
On Linux, these read-only commands show IPv4 neighbor entries and the selected route:
ip -4 neigh show
ip -4 route get 198.51.100.8
An INCOMPLETE or FAILED neighbor entry is a reason to investigate local-link reachability, VLAN membership and the next-hop address. It does not, by itself, diagnose a remote application problem.
Common confusions
ARP maps addresses on a local link; it does not choose the Internet route or assign an IP address. IPv6 uses Neighbor Discovery rather than ARP. Because ordinary ARP has no built-in authentication, receiving a mapping is not proof that the sender is trustworthy.