ARP, Reverse ARP, Inverse ARP, Proxy ARP, and Gratuitous ARP

Address Resolution Protocol

Address Resolution Protocol (ARP) is a communication protocol that works on the TCP/IP Layer 2.

  • ARP helps to get the MAC address of the connected router or gateway from the IP address.
  • ARP is a request-response protocol in which one device sends a request to another device asking for some information, the other device will respond/reply with the required information.
  • ARP packets are encapsulated by a link-layer and are distributed only in a specific network. ARP is said to be a link-layer protocol.

How Does ARP Work?

  • Before sending an IP packet, the sender must know the destination MAC address.
  • If the MAC address is not known, then the sender broadcasts the ARP discovery packet, requesting the MAC address of the intended destination.
  • Every host inside that network will get the message, but only the intended receiver host whose IP is associated will accept the IP packet; all others will discard the packet.
  • The receiver will send back a unicast packet with its MAC address to the sender of the ARP discovery packet.
  • The sender will receive the ARP reply and update the ARP check and start sending a unicast message to the destination.

Format of an ARP Packet

The following diagram shows the format of an ARP packet.

Hardware TypeProtocol
Hardware LengthProtocol LengthOperation ARP Request 1, ARP Reply 2
Sender Hardware Address(for example, 6 bytes for Ethernet)
Sender ProtocolAddress(for example, 4 bytes for IP)
Target Hardware Address(for example, 6 bytes for Ethernet. It is not filled in a request)
Target Protocol Address(for example, 4 bytes for IP)

Let's now find out the role of each field in an ARP packet −

  • Hardware Type: It is a 16-bit field that defines the type of network in which the ARP is running.
  • Protocol Type: It is a 16-bit field that defines protocol using ARP.
  • Hardware Length: It is an 8-bit field it defines the length of a physical address in bytes.
  • Protocol Length: It is an 8-bit field that defines the length of IP address in bytes.
  • Operation: It is a 16-bits field that defines the type of packet: (i)ARP Request and (ii) ARP Reply.
  • Sender Hardware Address: It is a variable length that defines the physical address of the target.
  • Target Hardware Address: It is a variable-length field that defines the logical address of the target.

Reserve Address Resolution Protocol (RARP)

RARP protocol is used by a device that knows its MAC address but does not know its IP address in a local area network (LAN).

  • A network administrator creates a table in a local area network (LAN) gateway router that maps the physical machine addresses to equivalent IP addresses.
  • When a new machine is set up, then its RARP client requests the IP address from the gateway router.
  • Assuming that an entry has been set up in the router table, the reserve ARP server will return the IP address to the machine which can store it for future use.

The problem of getting an IP address from a MAC address can be handled by the reserved address resolution protocol (RARP) which works similar to ARP.

To obtain the IP address, the host first broadcasts a RARP request packet containing its MAC address on the network. All the hosts in the network will receive the packets but only the server responds to the host by sending a RARP response packet containing the host MAC and IP address.

Inverse Address Resolution Protocol (InARP)

Inverse ARP is the opposite of ARP. Instead of using a layer-3 IP address to find a layer-2 MAC address, Inverse ARP uses layer-2 MAC addresses to find a layer-3 IP address.

Inverse ARP is mostly used by Frame relay and ATM Networks to map the DLCI to IP Address. So the router asks for the IP Address of the destination or other ends of PVC by listing DLCI for that router.

Proxy ARP

Proxy ARP is a technique using which a proxy server on a given network answers the ARP queries for an IP address that is not on that network.

  • For example, suppose the host is connected to the router over the Ethernet and the host has the address and the router has
  • The host wants to resolve the ARP for and thinks that the router is in the same subnet, so it will be able to get the MAC-address.
  • However, as routers, by design, limit broadcast domains, so it will not send the ARP reply back and it will reject the request.
  • But if another router has any other interface connected to the network and proxy ARP is enabled, then the router will send the ARP reply to the host by listing its own MAC address.It will act as a proxy for the destination network.

Gratuitous ARP

A gratuitous ARP is an unprompted address resolution protocol response.

When a new device joins the local area network (LAN), it broadcasts its MAC address to the whole network immediately after its network interfaces boot up.

Gratuitous ARP packet has both source and destination IP set to the IP address of the device issuing the packet, and the destination MAC is the broadcast address ff:ff:ff:ff:ff:ff or 00:00:00:00:00:00 based on the address resolution protocol (ARP) implementation.

No continuation packets are sent in response to a gratuitous ARP packet.