Address Resolution Protocol (ARP)

Address Resolution Protocol (ARP) is a protocol for mapping an Internet Protocol address (IP address) to a physical machine address that is recognized in the local network. A table, usually called the ARP cache, is used to maintain a correlation between each MAC address and its corresponding IP address. ARP provides the protocol rules for making this correlation and providing address conversion in both directions

How ARP Works?

How ARP WORKS?

When an incoming packet destined for a host machine on a particular local area network arrives at a gateway, the gateway asks the ARP program to find a physical host or MAC address that matches the IP address. The ARP program looks in the ARP cache and, if it finds the address, provides it so that the packet can be converted to the right packet length and format and sent to the machine. If no entry is found for the IP address, ARP broadcasts a request packet in a special format to all the machines on the LAN to see if one machine knows that it has that IP address associated with it. A machine that recognizes the IP address as its own returns a reply so indicating. ARP updates the ARP cache for future reference and then sends the packet to the MAC address that replied.

Types of ARP

1. ARP:
ARP is a address resolution protocol, It’s mapping of Layer 3 address to a Layer 2 address. When a computer wants to send data to an IP address it requires a MAC address to send the frame to. To get a corresponding Layer 2 (MAC address) it looks at its ARP table. If the MAC address is not found in the Arp table the computer sends a broadcast (ARP Request)requesting the host with that IP address to reply with his MAC address. This process is called ARP.

2. RARP:
The Reverse Address Resolution Protocol (RARP) is an obsolete computer networking protocol used by a client computer to request its Internet Protocol (IPv4) address from a computer network, when all it has available is its link layer or hardware address, such as a MAC address.

3. IARP:
Inverse ARP is used to find the Layer 3 address from a Layer 2 address (the DLCI in frame relay). With frame, when using. inverse ARP, you know the DLCI of the remote router but you don't know its IP address. Inverse ARP sends a request to obtain that IP address and map it to the Layer 2 frame-relay DLCI.

4. Proxy ARP: Host A wants to send data to Host B which is not on that network, Host A sends an ARP to get a MAC address for host B. Router (gateway) replies to Host A with its own MAC address stating itself as destination (something like a proxy roll call when you respond as present to a roll call of your friend), hence when the data is sent to the destination by Host A it would be sending to the gateway (as destination MAC is given as Gateway's MAC) which would in-turn send to host B. This is called proxy arp.

5. Gratious ARP:
The GARP can be used to detect duplicate address by sending an ARP packet with destination as its own IP address and if it gets any reply back that means there is another device with same IP address. Also this is seen when an IP address is changed on a device, once the change of an IP address is done the GARP is generated and switch can make an entry in the MAC table.