Address Resolution Protocol (ARP) is a protocol used for mapping an IP address to a physical machine address that is present in the local network, especially for IP Version 4 which has a 32 bits long address. However, in an Ethernet local area network, physical machine addresses ( Also known as Media Access Control or MAC address) for attached devices are of 48 bits length. To solve this issue, A table called the ARP cache is used to maintain a correlation between each IP address and it’s corresponding MAC address. Address Resolution Protocol provides the necessary protocol rules for making this correlation and provides address conversion in both directions.
How ARP Works
When an incoming packet was received by a host machine which is on a particular local area network at a gateway, then the gateway asks the ARP program to find a MAC address that exactly matches the IP address. The ARP program searches in it’s ARP cache. If it finds the address it was searching for, then it provides the address and the packet is converted to the right packet length and format and result is sent to the machine. If correct match for the IP address was not found, then ARP sends a request packet in a special format to all the machines in the LAN, to see if any machine knows that it has that IP address associated with it. If a machine recognizes that the IP address is its own , then it returns a reply so. ARP then updates the ARP cache for future reference and sends the packet to the MAC address that replied.
Since protocol details differ for each type of local area network, there are separate ARP Requests for Comments (RFC) for Ethernet, ATM, Fiber Distributed-Data Interface, HIPPI, and other protocols.
There is a Reverse ARP (RARP) for host machines that don’t know their IP address. RARP enables them to request their IP address from the gateway’s ARP cache.