ARP Packet Format: Understanding the Structure of ARP Messages

Deep dive into the structure and fields of an ARP (Address Resolution Protocol) packet. This guide details the header components of ARP request and response packets, explaining how this structured format enables efficient IP-to-MAC address resolution on a local area network.



ARP Packet Format: Understanding the Structure of ARP Messages

Introduction

The Address Resolution Protocol (ARP) uses a specific packet format to request and respond to MAC address queries. This format contains information essential for mapping IP addresses to MAC addresses on a local area network (LAN).

ARP Packet Structure

An ARP packet carries either an address resolution request or response. Its size varies based on the network and data link layer address lengths. The key fields in the header are:

Header Fields:

Field Size (bits) Description
HTYPE (Hardware Type) 16 Specifies the type of network hardware (e.g., Ethernet, Wi-Fi, etc.). Some common values are shown in the table below.
PTYPE (Protocol Type) 16 Identifies the higher-layer protocol using the IP address (e.g., IPv4, IPv6).
HLEN (Hardware Address Length) 8 Length of the hardware (MAC) address in bytes (typically 6 for Ethernet).
PLEN (Protocol Address Length) 8 Length of the protocol (IP) address in bytes (typically 4 for IPv4).
OPER (Operation Code) 16 Indicates whether it's a request (1) or a reply (2).

Hardware Type (HTYPE) Values:

Value Network Type
1 Ethernet
6 IEEE 802 Networks (Wi-Fi, etc.)
7 ARCNET
15 Frame Relay
16 ATM (Asynchronous Transfer Mode)
17 HDLC (High-Level Data Link Control)
18 Fibre Channel
20 Serial Line

Operation Codes (OPER):

Opcode ARP Message Type
1 ARP Request
2 ARP Reply
3 RARP (Reverse ARP) Request
4 RARP Reply
5 DRARP (Dynamic Reverse ARP) Request
6 DRARP Reply
7 DRARP Error
8 InARP (Inverse ARP) Request
9 InARP Reply

Payload Fields:

  • SHA (Sender Hardware Address): The sender's MAC address.
  • SPA (Sender Protocol Address): The sender's IP address.
  • THA (Target Hardware Address): The target's MAC address (all zeros in a request).
  • TPA (Target Protocol Address): The target's IP address.

Conclusion

The ARP packet format is designed for efficient address resolution. The structured fields allow devices to quickly request and respond to MAC address queries, enabling seamless communication within a local network.