5.6 Address Resolution Protocol (ARP) & Reverse ARP (RARP)
💡 Core Intuition: The Classroom Roll Call
🍳 The Everyday Analogy: Name vs Desk Number
Imagine a teacher who needs to hand an exam paper to a student:
- The teacher knows the student's legal name: "Alice Smith" (the Logical Layer 3 IP Address).
- However, to physically deliver the paper, the teacher must know which specific physical chair Alice occupies: "Row 2, Desk 4" (the Physical Layer 2 MAC Address).
- If the teacher does not know where Alice sits, the teacher stands at the front of the classroom and speaks aloud to the entire room:
- Every student hears the announcement. Thirty students realize their name is not Alice and remain silent.
- Alice hears her name, raises her hand, and speaks directly back to the teacher:
- The teacher hands the paper to Desk 4 and writes down
Alice Smith -> Desk 4in a notebook (ARP Cache) so they never have to shout to the entire room again!
💻 Bridging to Computer Science: Bridging the Layer 3 to Layer 2 Gap
Applications and routing tables operate entirely in the domain of 32-bit Logical IP Addresses.
- However, physical hardware network interface cards (NICs), switches, and Ethernet cables know nothing about IP addresses.
- An Ethernet frame traveling across a local area network (LAN) can only be delivered if the frame header contains the correct 48-bit Physical Hardware (MAC) Address.
The Address Resolution Protocol (ARP) serves as the critical Layer 2.5 "glue" that dynamically discovers and binds a host's physical MAC address to its known IP address.
📑Table of Contents
- 🔬 The 28-Byte ARP Packet Architecture (RFC 826)
- 🔄 The ARP Operational Cycle: Request vs Reply
- ⚡ Advanced ARP Variants: Proxy ARP & Gratuitous ARP
- 🏛️ The Evolutionary Hierarchy: RARP \to BOOTP \to DHCP
- 🏭 Real-World Production Context: ARP Spoofing (Poisoning) & Dynamic ARP Inspection (DAI)
- 📐 Numerical Applications & Worked Examples
- 🎯 Exam & Interview Pitfall Check
🔬 The 28-Byte ARP Packet Architecture (RFC 826)
ARP is encapsulated directly inside a Data Link Layer frame (such as Ethernet II with EtherType = 0x0806), bypassing the IP protocol entirely.
Standard 28-Byte ARP Packet Format (RFC 826)
Hardware and Protocol address mapping structured across 32-bit word boundaries
Identifies link-layer protocol. Set to 1 for Ethernet.
🔄 The ARP Operational Cycle: Request vs Reply
When Host A (192.168.1.10, MAC_A) wants to send an IP datagram to Host B (192.168.1.20, MAC_B) on the same local subnet:
ARP Resolution: Broadcast Request and Unicast Reply Cycle
Host A broadcasts to all nodes; Host B unicasts its hardware MAC address directly back to Host A
1. ARP Request: The Broadcast Phase
- Host A checks its local OS ARP Cache Table. If no entry exists for
192.168.1.20, Host A generates an ARP Request:- Sender MAC:
MAC_A - Sender IP:
192.168.1.10 - Target MAC:
00:00:00:00:00:00(Unknown) - Target IP:
192.168.1.20 - Opcode:
1(Request)
- Sender MAC:
- Host A encapsulates the packet inside an Ethernet frame with:
- The Layer 2 switch receives the frame on port 1 and floods it across all active ports.
2. Processing at Receiving Hosts
- Host C (
192.168.1.30): Receives the broadcast frame, decapsulates the ARP payload, and comparesTarget IPagainst its own IP address. Because192.168.1.20 != 192.168.1.30, Host C silently drops the packet. - Host B (
192.168.1.20):- Inspects the packet and detects a match:
Target IP == My IP. - Proactive Cache Update: Host B extracts Host A's mapping (
192.168.1.10 -> MAC_A) from the request and installs or refreshes it in its own ARP cache! - Formats an ARP Reply.
- Inspects the packet and detects a match:
3. ARP Reply: The Unicast Phase
Because Host B already learned Host A's physical address from the incoming request, Host B does not need to broadcast:
- Sender MAC:
MAC_B - Sender IP:
192.168.1.20 - Target MAC:
MAC_A - Target IP:
192.168.1.10 - Opcode:
2(Reply) - Encapsulated inside an Ethernet frame with:
The switch forwards the frame directly to Host A's port. Host A updates its ARP cache with
192.168.1.20 -> MAC_B.
⚡ Advanced ARP Variants: Proxy ARP & Gratuitous ARP
1. Proxy ARP (RFC 1027)
Proxy ARP is a technique where a router answers an ARP Request on behalf of a target host that resides on a completely different subnet:
Proxy ARP Interception Mechanics
Router intercepts ARP on behalf of a remote subnet and responds with its own MAC address
Host A (Misconfigured /16)
Believes Host B is on local LAN; broadcasts ARP Request for 192.168.2.20.
Router Egress Interface
Intercepts request and replies with its own MAC address to rescue Host A.
Host B (Remote Subnet)
Resides on 192.168.2.0/24; receives forwarded packets seamlessly.
- The Problem: A legacy host is misconfigured with a
/16subnet mask instead of/24. When it wants to reach192.168.2.20, it believes the destination is on the local LAN and broadcasts an ARP Request instead of sending to its default gateway! - The Proxy Solution: The intermediate router knows how to reach subnet
192.168.2.0/24. It intercepts the ARP Request and transmits an ARP Reply containing the router's own MAC address! - Host A transparently sends packets to the router's MAC, which then forwards them across subnets.
2. Gratuitous ARP
A Gratuitous ARP is an anomalous ARP packet where a host broadcasts an ARP Request or Reply for its own IP address:
Gratuitous ARP serves two vital production functions:
- Duplicate Address Detection (DAD):
- When a machine boots or receives a new IP address, it immediately broadcasts a Gratuitous ARP request.
- If any machine replies, the operating system instantly alerts: "IP Address Conflict Detected" and shuts down the interface.
- High-Availability Cluster Failover (VRRP / CARP / VIPs):
- When an active load balancer or database server crashes, the backup server takes over the shared Virtual IP (VIP).
- The backup server immediately broadcasts a Gratuitous ARP announcement with the VIP and its own MAC address.
- Every switch on the network updates its MAC address table, and every server updates its ARP cache instantly, redirecting production traffic in under without dropping TCP connections.
🏛️ The Evolutionary Hierarchy: RARP BOOTP DHCP
In early computing, diskless workstations lacked hard drives and stored only a burned-in MAC address in ROM. To communicate on the network, they needed to discover their assigned IP address upon boot.
The Architectural Evolution: RARP vs BOOTP vs DHCP
From physical Layer 2 ROM bindings to enterprise Layer 4 dynamic configuration pools
Reverse ARP (RARP - RFC 903)
- •Resolves known 48-bit MAC address to unknown 32-bit IP address.
- •Operates directly on raw Ethernet (EtherType 0x8035); cannot cross routers.
- •Requires a dedicated RARP server on every physical cable segment.
- •Supplies strictly an IP address; cannot provide subnet mask or gateway.
Dynamic Host Configuration (DHCP - RFC 2131)
- •Successor to BOOTP; provides complete network configuration in 4 steps (DORA).
- •Traverses routers via DHCP Relay Agents (ip helper-address).
- •Dynamic IP lease pools: automatically allocates, reclaims, and renews IPs.
- •Delivers IP, Subnet Mask, Default Gateway, DNS servers, NTP, and domain names.
The DORA Process in DHCP
DHCP (which evolved from BOOTP) runs entirely over UDP Port 67 (Server) and Port 68 (Client):
- Discover: Client broadcasts
DHCPDISCOVER(255.255.255.255, source0.0.0.0). - Offer: DHCP Server reserves an IP and unicasts/broadcasts
DHCPOFFER. - Request: Client broadcasts
DHCPREQUESTformalizing its choice. - Acknowledge: Server responds with
DHCPACKgranting the lease and configuration parameters.
🏭 Real-World Production Context: ARP Spoofing (Poisoning) & Dynamic ARP Inspection (DAI)
1. The ARP Cache Poisoning Attack (Man-in-the-Middle)
Because ARP was designed without authentication, an operating system will blindly accept an ARP reply even if it never sent an ARP request:
- An attacker on the local Wi-Fi sends continuous unsolicited ARP replies to Host A:
- The attacker also sends unsolicited ARP replies to the Default Gateway:
- Result: Host A sends all outbound Internet traffic to the attacker; the gateway sends all inbound return traffic to the attacker. The attacker sniffs or tampers with the traffic before relaying it (Man-in-the-Middle).
ARP Cache Poisoning & Man-in-the-Middle (MitM) Interception
Attacker emits forged gratuitous ARP replies to redirect all bidirectional LAN traffic
Host A (192.168.1.10)
ARP cache poisoned: believes Gateway MAC is attacker MAC.
Attacker (Eavesdropper)
Inspects, alters, or logs cleartext packets before relaying.
Router (192.168.1.1)
ARP cache poisoned: believes Host A MAC is attacker MAC.
2. Enterprise Mitigation: Dynamic ARP Inspection (DAI)
Modern enterprise switches (Cisco, Arista, Juniper) eradicate ARP spoofing using Dynamic ARP Inspection (DAI) coupled with DHCP Snooping:
- The switch monitors all DHCP transactions on access ports and builds a trusted DHCP Snooping Binding Table recording
(Port, MAC, IP, VLAN). - When any host transmits an ARP packet, the switch hardware intercepts the frame and validates:
- If an attacker attempts to claim another host's IP address, the switch instantly drops the packet in hardware and disables the port (
err-disable), stopping MitM attacks at line-rate.
📐 Numerical Applications & Worked Examples
Example 1: Full Ethernet Frame Analysis for an ARP Request
Problem Statement: Host A emits an ARP Request on a standard Ethernet II network.
- What is the exact payload size of the ARP packet?
- How many bytes of padding must the network interface append?
- What is the total length of the frame transmitted on the physical wire including physical layer preamble, SFD, and Inter-Frame Gap (IFG)?
Step-by-Step Solution:
- Analyze Base Frame Sizes:
- ARP Packet Size .
- Ethernet II Header (Destination MAC + Source MAC + EtherType ).
- Ethernet FCS (CRC-32) .
- Ethernet II requires a minimum payload of to achieve the minimum frame size of ().
- Calculate Padding:
- Total Ethernet Frame Size (Header + ARP + Padding + FCS) .
- Calculate Total Wire Overhead:
- Preamble .
- Start Frame Delimiter (SFD) .
- Ethernet Frame .
- Inter-Frame Gap (IFG) equivalent.
Example 2: Inter-Subnet Hop-by-Hop Address Mutation Across Routers
Problem Statement: Host (IP_S: 10.0.1.5, MAC_S) on Subnet 1 wants to transmit an HTTP request to Server (IP_D: 10.0.2.8, MAC_D) on Subnet 2.
The subnets are connected by Router , with interface eth0 on Subnet 1 (IP_R1: 10.0.1.1, MAC_R1) and interface eth1 on Subnet 2 (IP_R2: 10.0.2.1, MAC_R2).
Trace the exact Source IP, Destination IP, Source MAC, and Destination MAC on:
- Subnet 1 (from Host to Router ).
- Subnet 2 (from Router to Server ).
Step-by-Step Solution:
-
Analyze Address Roles Across Routing Boundaries:
- Logical IP Addresses: Define end-to-end identity between original source and final destination. They NEVER change during normal hop-by-hop forwarding!
- Physical MAC Addresses: Define local link-layer hop between adjacent physical interfaces. They change at EVERY router hop!
-
Frame on Subnet 1 ():
- Host determines that is on a remote subnet. It performs ARP for its Default Gateway ().
-
Frame on Subnet 2 ():
- Router strips the Ethernet header, looks up in its routing table, and performs ARP for on interface
eth1.
- Router strips the Ethernet header, looks up in its routing table, and performs ARP for on interface
Example 3: ARP Cache Invalidation & Flooding Evaluation
Problem Statement: A switched LAN consists of active workstations. Host 1 sends a packet to Host 2. Neither host has any entries in their ARP caches.
- How many hosts receive the ARP Request frame?
- How many hosts process the ARP Request up to the Network/ARP layer?
- How many hosts update their ARP cache upon receiving the request?
- How many hosts receive the ARP Reply frame?
Step-by-Step Solution:
- ARP Request Reception:
- Because the ARP Request has destination MAC
FF:FF:FF:FF:FF:FF, the switch floods it to all ports. - All remaining hosts receive the frame.
- Because the ARP Request has destination MAC
- ARP Processing:
- Every NIC recognizes the broadcast MAC and passes the payload to the OS ARP subsystem.
- All hosts process the ARP Request.
- ARP Cache Update:
- Standard RFC 826 specifies that hosts only update their cache if they already have an existing entry for the sender, or if they are the target of the request.
- Host 2 is the intended target; it installs Host 1's mapping into its cache.
- Therefore, exactly host (Host 2) installs the new entry.
- ARP Reply Reception:
- The ARP Reply is unicast directly to Host 1's MAC address. The switch forwards it strictly to Host 1's physical port.
- Exactly host (Host 1) receives the ARP Reply frame.
🎯 Exam & Interview Pitfall Check
-
Why is an ARP Request broadcast while an ARP Reply is unicast?
An ARP Request must be broadcast because the sender does not know which physical machine owns the target IP address; every machine on the local link must receive the query to check if it is the intended owner. The ARP Reply is unicast because the replying host learned the sender's physical MAC address directly from the incoming ARP Request, making a wasteful broadcast unnecessary. -
Does an ARP packet cross a Layer 3 router?
No! Routers do not forward Layer 2 broadcasts (FF:FF:FF:FF:FF:FF). An ARP packet is strictly confined to the local broadcast domain (VLAN / subnet). To reach a host on a remote subnet, the sender ARPs for the MAC address of its local default gateway router.
-
Trap: Believing that ARP operates at Layer 3 or Layer 2.
Debunked: ARP is classified as a Layer 2.5 protocol. It is encapsulated directly inside Layer 2 data link frames (without an IP header), yet its sole purpose is to translate and bind Layer 3 logical IP addresses. -
Trap: Confusing Proxy ARP with Default Gateway routing.
Debunked: In standard Default Gateway routing, the sending host knows the destination IP is on another subnet and intentionally sends the packet to the router's MAC address. In Proxy ARP, the sending host is fooled into believing the remote destination is on the local LAN, and the router secretly answers the ARP request with its own MAC address to rescue the misconfigured host.