This is an introductory article on what the Address Resolution Protocol (ARP) is, what it is used for and how the ARP Tables work.
Please see the Related Articles section for more introductory networking articles.
What is ARP?
Network Hosts use the Address Resolution Protocol (ARP) to discover and map the hardware address of a local peer, to the destination IP address being reached.
In other words, ARP enables Hosts to insert the correct Destination MAC Address in the Layer-2 Frame, in order to reach the more universally recognized Destination IP Address in the Layer-3 Packet.
Before sending a Packet, a Host consults its ARP Cache, a Table containing a mapping of all known IP addresses, and the MAC Address to which they must be sent in order to reach the IP.
ARP on a Shared Layer-2 Network
If the Layer-3 Destination IP Address belongs to the same Local Network as the Source IP Address, then the Host sends out a Layer-2 broadcast packet, destined to FF:FF:FF:FF:FF:FF, asking all Local Peers: “if your IP Address matches the Destination IP address in this Packet, please send me your MAC Address”.
If the Host exists on the Local Network, then the ARP Reply will contain the Source MAC Address in the Layer-2 Frame Header.
An overview of ARP Discovery, Reply & Caching prior to sending unicast message to local host. The switch will flood the ARP request from Host 1 out of all its interfaces. Host 2 will respond to the ARP request because it uses the 10.0.0.12 address.
ARP on Layer-3 Networks
If the Destination IP Address belongs to a different Network than the Host’s Local Network, then the Packet is forwarded to the Local Gateway, complete with the Destination MAC Address of the Gateway, but the Destination IP Address of the Intended Layer-3 Host.
Also known as ANDing, this process of checking the Destination IP Address against the Network ID of the Sender is vitally important to moving internetwork traffic across Local Segments, from Gateway to Gateway, until the final hop reaches a Gateway who can locally reach the intended, original Layer-3 IP Recipient.
Host 1 will send the traffic for the 10.0.0.0 to its default gateway (Router). The Router will send an ARP request for both Host 2 and Host 1 and will store their IP and MAC addresses in its ARP cache. Note that the hosts do not know each other's MAC address, and that they will use the MAC address of the Router to communicate.
Read our other introductory networking articles in the Intro to Networking section.