This is an introductory article on the Address Resolution Protocol (ARP). Readers will learn about the workings and usage of the protocol.
Find a complete introductory guide on Routing and Switching in our Ubiquiti Broadband Routing & Switching Specialist (UBRSS) guide, downloadable in our Training section.
Table of Contents
What is ARP?
Devices use the Address Resolution Protocol (ARP) to discover other hosts on the network by mapping the hardware address to the destination IP address that is 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 that contains mappings of all known IP and MAC addresses.
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 an ARP Request to the Layer-2 broadcast address (FF:FF:FF:FF:FF:FF). In the example below, the ARP request is flooded on all ports by the switch.If the host to which the source IP belongs to exists on the local network, then an ARP Reply message is sent back. This reply message 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 Layer-3 destination IP address belongs to a different network than the host’s local network, then the packet is forwarded to the local gateway instead. Instead of sending the ARP Request as a broadcast, it is sent to the destination MAC address of the gateway. The ARP request will also contain the destination IP address of the remote Layer-3 host that the device is trying to reach.
Also known as ANDing, this process of checking the destination IP address against the network ID of the sender is vitally important in routing 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. Note that in the diagram below, the source and destination MAC addresses change, but the IP information remains the same.
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, instead using the MAC address of the Router to communicate.
See the Intro to Networking section for more introductory networking articles.