askvity

What is ARP code?

Published in ARP Protocol 2 mins read

The ARP (Address Resolution Protocol) code, more accurately the operation code within an ARP packet, specifies the type of ARP message being sent. According to the reference, for an ARP request, the operation code is 0x0001.

Essentially, the ARP code tells a device what action it should take upon receiving the ARP packet. Different operation codes exist for various ARP functions.

ARP Operation Codes Explained

The ARP operation code identifies the specific purpose of an ARP packet. Common operation codes include:

  • ARP Request (0x0001): Used to discover the MAC address associated with a known IP address. A host sends out an ARP request to find the MAC address for a host whose IP is known.
  • ARP Reply (0x0002): Sent in response to an ARP request, containing the requested MAC address.
  • RARP Request (0x0003): Used to discover the IP address associated with a known MAC address (Reverse ARP).
  • RARP Reply (0x0004): Sent in response to a RARP request, containing the requested IP address.

While less common, other ARP operation codes exist for advanced features.

ARP Request Example

When a computer wants to send data to another device on the local network but only knows the destination's IP address, it initiates an ARP request. This request broadcasts a message asking, "Who has IP address X.X.X.X? Tell Y.Y.Y.Y," where X.X.X.X is the target IP and Y.Y.Y.Y is the sender's IP. The ARP code in this packet would be 0x0001. The device with the matching IP address responds with its MAC address in an ARP reply.

Related Articles