ARP

Address Resolution Protocol (ARP) is a required TCP/IP standard defined in RFC 826, which resolves IP addresses used by TCP/IP-based software to media access control addresses used by LAN hardware. ARP provides the following protocol services to hosts located on the same physical network

Media access control addresses are obtained by using a network broadcast request. When an ARP request is answered, both the sender of the ARP reply and the original ARP requester record each other's IP address and media access control address as an entry in a local table called the ARP cache for future reference. Address Resolution Protocol (ARP) cache contains one or more tables that are used to store IP addresses and their resolved Ethernet physical addresses. There is a separate ARP cache for each network adapter. The ARP cache can contain both dynamic and static entries. Static entries are useful for hosts that are frequently used and remain in the cache until the computer is restarted. Dynamic entries are added and removed automatically over time.

IP to MAC address resolution process

When both the source and destination hosts are located on the same physical network, based on the contents of the routing table on Host A, IP determines the forwarding IP address to be used to reach Host B. Host A then checks its own local ARP cache for a matching hardware address for Host B. If Host A finds no mapping in the cache, it broadcasts an ARP request frame to all hosts on the local network which contains both IP and MAC address of Host-A. Each host on the local network receives the ARP request and checks for a match to its own IP address and the Host B sends an ARP reply message containing its hardware address directly back to Host A and also adds a hardware/software address mapping for Host A to its local ARP cache. When Host A receives the ARP reply message from Host B, it updates its ARP cache with a hardware/software address mapping for Host B.

When both the source and destination hosts are located on different physical network, ARP resolves the media access control address of the default gateway on the local network from the IP address. The router then forwards the traffic to Host B through the same ARP process.