The Address Resolution Protocol (ARP) is a communication protocol for discovering the link layer address, such as a MAC address, associated with an internet layer address, typically an IPv4 address. The protocol, part of the Internet protocol suite, was defined in 1982 by RFC 826, which is Internet Standard STD 37. ARP enables a host to send, for example, an IPv4 packet to another node in the local network by providing a protocol to get the MAC address associated with an IP address. The host broadcasts a request containing the target node's IP address, and the node with that IP address replies with its MAC address. ARP has been implemented with many combinations of network and data link layer technologies, such as IPv4, Chaosnet, DECnet and Xerox PARC Universal Packet (PUP) using IEEE 802 standards, FDDI, X.25, Frame Relay and Asynchronous Transfer Mode (ATM). In Internet Protocol Version 6 (IPv6) networks, the functionality of ARP is provided by the Neighbor Discovery Protocol (NDP).
Operating scope The Address Resolution Protocol is a request–response protocol. Its messages are directly encapsulated by a link-layer protocol. It is communicated within the boundaries of a single subnetwork and is never routed.
Packet structure The Address Resolution Protocol uses a simple message format containing one address resolution request or response. The packets are carried at the data link layer of the underlying network as raw payload. In the case of Ethernet, a 0x0806 EtherType value is used to identify ARP frames. The size of the ARP message depends on the link layer and network layer address sizes. The message header specifies the types of network in use at each layer as well as the size of addresses of each. The message header is completed with the operation code for request (1) and reply (2). The payload of the packet consists of four addresses: the hardware and protocol addresses of the sender and receiver hosts. The principal packet structure of ARP packets is shown in the following table, which illustrates the case of IPv4 networks running on Ethernet. In this scenario, the packet has 48-bit fields for the sender hardware address (SHA) and target hardware address (THA), and 32-bit fields for the corresponding sender and target protocol addresses (SPA and TPA). The ARP packet size in this case is 28 bytes.
Hardware Type (HTYPE): 16 bits This field specifies the network link protocol type. In this example, a value of 1 indicates Ethernet. Protocol Type (PTYPE): 16 bits This field specifies the internetwork protocol for which the ARP request is intended. For IPv4, this has the value 0x0800. The permitted PTYPE values share a numbering space with those for EtherType. Hardware Length (HLEN): 8 bits Length (in octets) of a hardware address. For Ethernet, the address length is 6. Protocol Length (PLEN): 8 bits Length (in octets) of internetwork addresses. The internetwork protocol is specified in PTYPE. In this example: IPv4 address length is 4. Operation (OPER): 16 bits Specifies the operation that the sender is performing: 1 for request, 2 for reply. Sender Hardware Address (SHA): 48 bits Media address of the sender. In an ARP request, this field is used to indicate the address of the host sending the request. In an ARP reply, this field is used to indicate the address of the host that the request was looking for. Sender Protocol Address (SPA): 32 bits Internetwork address of the sender. Target Hardware Address (THA): 48 bits Media address of the intended receiver. In an ARP request, this field is ignored. In an ARP reply, this field is used to indicate the address of the host that originated the ARP request. Target Protocol Address (TPA): 32 bits Internetwork address of the intended receiver. ARP parameter values have been standardized and are maintained by the Internet Assigned Numbers Authority (IANA). The EtherType for ARP is 0x0806. This appears in the Ethernet frame header when the payload is an ARP packet and is not to be confused with PTYPE, which appears within this encapsulated ARP packet.
Layering ARP's placement within the Internet protocol suite and the OSI model may be a matter of confusion or even of dispute. RFC 826 places it into the link layer and characterizes it as a tool to inquire about the "higher level layer", such as the Internet layer. RFC 1122 also discusses ARP in its link layer section. Richard Stevens places ARP in the OSI's data link layer while newer editions associate it with the network layer or introduce an intermediate OSI layer 2.5.
Example Two computers, A and B, are connected to the same local area network with no intervening gateway or router. A has a packet to send to IP address 192.168.0.55 which happens to be the address of B. Before sending the packet to B, A broadcasts an ARP request message – addressed with the broadcast MAC address FF:FF:FF:FF:FF:FF and requesting response from the node with IP address 192.168.0.55. All nodes of the network receive the message, but only B replies since it has the requested IP address. B responds with an ARP response message containing its MAC addresses which A receives. A sends the data packet on the link addressed with B's MAC address. Typically, a network node maintains a lookup cache that associates IP and MAC addresses. In this example, if A had the lookup cached, then it would not need to broadcast the ARP request. Also, when B received the request, it could cache the lookup to A so that if B needs to send a packet to A later, it does not need to use ARP to look up its MAC address. Finally, when A receives the ARP response, it can cache the lookup for future messages addressed to the same IP address.
… excerpt ends here. Continue reading the full article.
