ARP (Address Resolution Protocol) is a protocol for translating network addresses into link layer addresses. Most commonly it’s used for mapping an IPv4 address to a MAC address.
ARP maps a <protocol, address> pair to a link layer address .
To resolve addresses quickly, ARP builds and maintains a translation table with entries containing the protocol type, sender protocol address, and sender hardware address.
When a host wants to translate an IPv4 address to a MAC address, the host calls the Address Resolution module. The Address Resolution module checks its table for the <protocol type, target protocol address> pair. If the table contains the mapping, it will return the MAC address for the IPv4 address.
If the Address Resolution module is unable to find the pair, it must send an ARP request packet. In this case, the host will broadcast an ARP request packet over Ethernet .
Each host on the LAN will check to see if their address matches the target IP address in the ARP request. If a host is assigned the target protocol address, it updates its table with the details of the request sender, and sends an ARP reply to the sender .
ARP packets are sent in Ethernet frames, with the protocol version set to ARP .
There are two types of ARP packets: request and reply. Both share the same format.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hardware Type | Protocol Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HAL | PAL | Operation | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sender Hardware Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sender Protocol Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Target Hardware Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Target Protocol Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
In ARP, a protocol address is the address of the protocol that is being resolved (e.g. IPv4). The hardware address is the address of the link layer protocol (e.g. Ethernet).
The Hardware Type field specifies the hardware protocol type (Ethernet is
Protocol Type specifies the protocol type of the protocol addresses (IPv4 is
HAL (Hardware Address Length) is the length of the hardware address in octets.
PAL (Protocol Address Length) is the length of the protocol address in octets.
Operation is the operation that the sender is performing. Request is
1, reply is
Sender Hardware Address is the hardware address of the sender. In a reply, this is the hardware address of the host that the original sender was looking for.
Sender Protocol Address is the protocol address of the sender.
Target Hardware Address is the hardware address of the target protocol address. This is blank when the sender sends a request.
Target Protocol Address is the protocol address that is being resolved.
-  “An Ethernet Address Resolution Protocol: Or Converting Network Protocol Addresses to 48.bit Ethernet Address for Transmission on Ethernet Hardware,” no. 826. RFC Editor, Nov-1982.