This article is essential for Network administrators who need to understand the ARP protocols, its types and usage in networking field. This becomes vital for those engaged in Layer 2 and Layer 3 of OSI model. ARP acts as key link across both the OSI layers hence it becomes imperative to understand the technology and its flavors. Broadly, ARP flavors have been enlisted below –
- Gratuitous ARP
When a computer in LAN needs to send data to another device (computer or Router etc.) it must first find the physical address (also called MAC Address) of the destination device. Generally the IP address of the destination device is known to source. This is where ARP comes to play. The ARP protocol will make a broadcast out to the network asking for the MAC address of the destination IP address. The machine with the IP address will respond with its MAC address.
ARP’s job is to basically discover and associate IP addresses to physical MAC addresses. ARP is used for mapping a network address (e.g. an IPv4 address) to a physical address like an Ethernet address (also named a MAC address).
The ARP Request will contain:
- Source IPv4 Address;
- Source data-link identifier address (MAC Address )
- Destination IPv4 Address;
- Destination data-link identifier (MAC Address)
ARP was defined by RFC 826 in 1982
Below is diagram of ARP packet format –
- Hardware Type – this is 1 for Ethernet.
- Protocol Type – the protocol used at the network layer.
- Hardware Address Length – this is the length in bytes, so it would be 6 for Ethernet.
- Protocol Address Length – For TCP/IP th value is 4 bytes.
- Operation Code – this code indicates whether the packet is an ARP Request or an ARP Response.
- Senders Hardware Address – hardware address of the source node.
- Senders Protocol Address – layer 3 address of the source node.
- Target Hardware Address – used in a RARP request, the response carries both the destination’s hardware and layer 3 addresses.
- Target Protocol Address – used in an ARP request, the response carries both the destination’s hardware and layer 3 addresses.
RARP is the opposite of ARP, it maps an IPv4 Address to a know MAC Address. Hosts like diskless workstations only have their hardware interface addresses, or MAC address, but not their IP addresses. They must discover their IP addresses from an external source, usually via RARP protocol. RARP is defined in RFC 903.The RARP uses the same packet format as the ARP and uses an Ethertype value of 0x8035 to indicate it being a RARP.
RARP Request will contain:
- Source and Destination data-link identifier (MAC Address in this example) will be the local host MAC Address;
- Source and Destination IP Address will be set to 0.0.0.0.
Proxy ARP a technique by which a Layer 3 device can respond to ARP requests for a destination which is not in same network in which sender resides.The Router configured for Proxy ARP can respond to the ARP and map the router’s MAC address with the destination IP address and fool the sending station that it has found its destination.
AT the backend , the proxy router forwards the packets to the correct destination since it has the relevant information.
For eg – 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 replies to Host A with its own MAC address addressing itself as destination, 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.
RFC 1027 describes Proxy ARP.
Gratuitous ARP is an ARP request of hosts own IP address and is used to check for a duplicate IP address. If there is a duplicate address then the stack does not complete initialisation.Generally, hosts on a network will send out a Gratuitous ARP when they are booting up their IP stack
Some of primary use case of Gratuitous ARP are below –
- To update other devices ARP Table (when a device receives an ARP Request with an IP, the cache will be updated with the new information;
- HSRP Routers becoming Master or Active will send Gratuitous ARP out the network to update the cache table of other devices ;
- To check for duplicate addresses i.e. if the host receives a response, it´ll know that some other device is using the same IP Address