Address Resolution Protocol (ARP)

Understanding how devices in a local network discover each other's MAC addresses

Address Resolution Protocol (ARP)

Computer 1
IP:192.168.1.5
MAC:00:11:22:33:44:55
Computer 2
IP:192.168.1.10
MAC:11:22:33:44:55:66
Router
IP:192.168.1.1
MAC:00:1A:2B:3C:4D:5E

A computer needs to send data to an IP in the same network but doesn't know its MAC address

Address Resolution Protocol (ARP) is a communication protocol used to discover the link layer address, such as a MAC address, associated with a given internet layer address, typically an IPv4 address. This mapping is critical for data to be transmitted across a local network from one device to another.

Why ARP is Necessary

In networking, devices communicate at two different addressing levels:

IP Address (Network Layer)

A logical address assigned to a network interface that identifies the device on a larger network.

Characteristics:
  • 32-bit address (IPv4) or 128-bit address (IPv6)
  • Hierarchical structure with network and host portions
  • Globally routable (with public IPs)
  • Configured manually or via DHCP

MAC Address (Data Link Layer)

A physical address burned into network interface hardware that uniquely identifies the device.

Characteristics:
  • 48-bit address (6 bytes, usually displayed as 12 hexadecimal digits)
  • Globally unique (in theory)
  • Flat structure (no hierarchy)
  • Hardcoded into the network interface card

When data needs to be sent on a local network, the sender knows the recipient's IP address but needs the MAC address to create the proper Ethernet frame. ARP provides the mechanism to discover this MAC address.

How ARP Works

1. ARP Request

When a device wants to communicate with another device on the local network, it checks its ARP cache first. If the mapping isn't found, it broadcasts an ARP request packet to all devices on the local network asking: "Who has IP address x.x.x.x? Tell y.y.y.y."

2. ARP Reply

Only the device with the requested IP address responds with an ARP reply containing its MAC address: "IP address x.x.x.x is at MAC address aa:bb:cc:dd:ee:ff."

3. ARP Cache Update

The requesting device receives the reply and updates its ARP cache with the IP-to-MAC mapping for future reference.

4. Communication

With the MAC address now known, the device can create properly addressed Ethernet frames to send data directly to the target device.

ARP Cache

To reduce network traffic, devices maintain an ARP cache (or ARP table) that temporarily stores IP-to-MAC address mappings.

IP AddressMAC AddressTypeInterface
192.168.1.100:1A:2B:3C:4D:5EDynamiceth0
192.168.1.5AA:BB:CC:11:22:33Staticeth0
192.168.1.1011:22:33:44:55:66Dynamiceth0

ARP cache entries typically have timeouts and are removed after a period of inactivity to ensure freshness and handle network changes.

Types of ARP

Standard ARP

  • Used for mapping IPv4 addresses to MAC addresses
  • Operates on local networks (same broadcast domain)
  • Defined in RFC 826

Proxy ARP

  • A router answers ARP requests on behalf of devices in different subnets
  • Allows devices to communicate as if they were on the same network
  • Less common in modern networks due to security concerns

Reverse ARP (RARP)

  • Legacy protocol used to obtain an IP address based on a MAC address
  • Largely replaced by DHCP
  • Used in diskless workstations

Gratuitous ARP

  • Unsolicited ARP message sent to update other devices' ARP caches
  • Used when a device's IP or MAC address changes
  • Also used for detecting IP address conflicts

ARP Security Concerns

ARP has no authentication mechanism, which makes it vulnerable to various attacks including ARP spoofing, ARP cache poisoning, and man-in-the-middle attacks.

ARP Spoofing/Poisoning

An attacker sends falsified ARP messages to associate their MAC address with the IP address of a legitimate network resource, redirecting traffic through the attacker's device.

Mitigation Techniques
  • Static ARP entries for critical systems
  • ARP inspection and monitoring
  • Network segmentation
  • Encryption protocols like HTTPS and SSH
  • 802.1X port-based authentication

ARP in IPv6 Networks

In IPv6 networks, ARP is replaced by the Neighbor Discovery Protocol (NDP), which uses ICMPv6 messages for address resolution. NDP provides additional functionality beyond ARP, including router discovery, prefix discovery, and duplicate address detection.