Network Layer · Computer Networks

Address Resolution Protocol (ARP)

Watch lectures
SVGVector Architecture Diagram (SVG)
COMPUTER NETWORKS · Module 3★ High PriorityAddress Resolution Protocol (ARP)IT Sem 6 · Code 100602 · IP to MACMNEMONICARP: known IP, find MAC. Request is broadcast, reply is unicast.Stays inside one broadcast domain; routers never forward it.Core BreakdownPurposeMaps a known Layer 3 IP address to the unknown Layer 2 MAC address.NICs deliver frames by MAC, routing uses IP, so both are needed.Request"Who has 192.168.1.50? Tell 192.168.1.10" in a broadcast frame.Destination MAC FF:FF:FF:FF:FF:FF; non-matching hosts drop it.ReplyTarget caches the sender mapping and replies by unicast."I have 192.168.1.50, my MAC is BB:BB:BB:BB:BB:BB".ARP cacheTable of IP to MAC pairs avoids a broadcast for every packet.Dynamic entries age out in about 15 to 20 minutes; static are permanent.VariantsProxy ARP: router answers with its own MAC for a remote host.Gratuitous ARP: sender IP = target IP, finds duplicate IP, updates caches.SecurityARP has no authentication: fake replies poison the cache.Attacker claims the gateway IP, enabling man-in-the-middle. Fix: DAI.Diagram: Request and ReplySender192.168.1.10Target192.168.1.501 ARP REQUEST (broadcast)Dst MAC FF:FF:FF:FF:FF:FF2 ARP REPLY (unicast)Who has .50? Tell .10ARP cache (aging 15-20 min):192.168.1.50 bb-bb-bb-bb-bb-bb dynamicProxy ARProuter MACGratuitousdup IP checkSpoofingfix: DAIEtherType 0x0806 · Opcode 1 req, 2 reply⚠️ Exam Traps & Viva Favorites① Why is request broadcast?The sender does not know the target MAC, so itmust ask everyone. The reply can be unicastbecause the request carried the sender MAC.② Does ARP cross routers?No. ARP rides in a Layer 2 broadcast frame, so itis confined to the local broadcast domain.Routers drop it.③ What is ARP spoofing?Fake replies map the gateway IP to the attackerMAC and redirect traffic (MitM). Managed switchesuse Dynamic ARP Inspection.Tip: ARP asks all, answers oneMaster Revision Table(learn it row by row!)FieldSize / valueMeaningExampleHardware type16 bits, 1Network type (Ethernet)Ethernet = 1Protocol type16 bits, 0x0800Upper protocol being resolvedIPv4HLEN / PLEN8 bits each: 6 and 4MAC length and IP length in bytes6 and 4Opcode16 bits1 = request, 2 = replyRequest = 1Sender HW / IP6 bytes / 4 bytesSender MAC and sender IPAA:AA..., .10Target HW / IP6 bytes / 4 bytesRequest: HW unknown (zeros)BB:BB..., .50QUICK FACTSARP RFC 826 · EtherType 0x0806 · request dst MAC FF:FF:FF:FF:FF:FFGratuitous ARP: Sender IP = Target IP = own IP (duplicate detection)Cache: dynamic 15 - 20 min aging, static permanent · Proxy ARP uses router MACVERIFIED★ Golden rule: ARP resolves IP to MAConly on the local network.

Address Resolution Protocol (ARP)


1. Purpose of ARP

In computer networks, logical (IP) addresses and physical (MAC) addresses operate at different architectural layers:

  • IP Address (Layer 3): Used for global routing across internetworks.
  • MAC Address (Layer 2): Required by hardware network adapters (NICs) to deliver frames across the physical medium.

The Address Resolution Protocol (ARP) (RFC 826) dynamically maps a known Layer 3 Logical IP address to an unknown Layer 2 Physical MAC address on the local broadcast domain.

MermaidDiagram
Rendering diagram…

2. The ARP Process: Request and Reply

MermaidDiagram
Rendering diagram…

Step 1: ARP Request (Broadcast)

  • The sender creates an ARP request packet asking: "Who has IP 192.168.1.50? Tell 192.168.1.10."
  • Encapsulated inside an Ethernet frame with Broadcast Destination MAC FF:FF:FF:FF:FF:FF.
  • Every host on the local physical switch port receives and processes the frame. All hosts whose IP does not match silently drop it.

Step 2: ARP Reply (Unicast)

  • The target host recognizing its own IP address updates its local ARP table with the sender's details.
  • It formulates an ARP Reply: "I have 192.168.1.50, my MAC is BB:BB:BB:BB:BB:BB."
  • Sent back as a Unicast Frame directly to the sender's MAC address.

3. ARP Cache and Aging

To avoid broadcasting an ARP request for every single outbound packet, each computer maintains an in-memory ARP Cache (Table):

  ARP Cache Table:
  Internet Address      Physical (MAC) Address     Type        TTL (Expiry)
  192.168.1.1           00-14-22-01-23-45          Dynamic     15 min
  192.168.1.50          bb-bb-bb-bb-bb-bb          Dynamic     18 min
  192.168.1.255         ff-ff-ff-ff-ff-ff          Static      Permanent
  • Dynamic Entries: Learned automatically via ARP replies. Associated with an Aging Timer (typically 15−20 minutes15 - 20\text{ minutes}) to remove outdated entries if network adapters change.
  • Static Entries: Manually added by network administrators for permanent servers.

4. Special ARP Variants

A. Proxy ARP

  • A router configured with Proxy ARP answers ARP requests on behalf of a host that resides on a remote network or different subnet.
  • The router replies with its own MAC address, tricking the local sender into sending traffic to the router, which then forwards the packets across subnets.

B. Gratuitous ARP

  • An unsolicited ARP broadcast where a host announces its own mapping:
    • Sender IP=Target IP=Own IP\text{Sender IP} = \text{Target IP} = \text{Own IP}.
  • Uses:
    1. Duplicate IP Detection: If any node responds to the gratuitous ARP, an IP conflict exists on the LAN.
    2. Cache Update: Informs switches and gateway routers of a MAC address change (e.g., failover in High Availability clusters).

C. ARP Spoofing / Poisoning (Security Vulnerability)

  • Because ARP has no authentication, an attacker can broadcast fake ARP replies claiming their MAC address belongs to the Default Gateway.
  • All local traffic is redirected to the attacker's machine, enabling Man-in-the-Middle (MitM) attacks.
  • Mitigation: Dynamic ARP Inspection (DAI) on managed enterprise switches.

5. ARP Packet Format

SVGVector Architecture Diagram (SVG)
Hardware Type (1=Ethernet) Protocol Type (0x0800=IPv4) HLEN (6) PLEN (4) Opcode (1=Req, 2=Reply) Sender Hardware Address (Bytes 0-3) Sender HW (4-5) Sender IP Address (Bytes 0-1) Sender IP (2-3) Target Hardware Address (0-1) Target Hardware Address (Bytes 2-5) Target IP Address (Bytes 0-3)

Frequently Asked Questions

QWhy is an ARP Request broadcast while an ARP Reply is unicast?

The sender does not know the MAC address of the target, so it must broadcast to all nodes (FF:FF:FF:FF:FF:FF). The target receives the request containing the sender's known MAC address, allowing it to send the reply directly back via unicast.

QDoes an ARP packet travel across routers to different subnets?

No. ARP packets are encapsulated in Layer 2 broadcast frames and are strictly confined to the local broadcast domain. Routers drop Layer 2 broadcasts and do not forward ARP requests to outside networks.

QWhat is Gratuitous ARP?

An ARP broadcast where a host announces its own IP-to-MAC mapping, used to update neighbor ARP caches and detect duplicate IP conflicts upon bootup.

QWhat is ARP spoofing and how is it mitigated?

ARP has no authentication, so an attacker can send fake ARP replies claiming the gateway's IP maps to the attacker's MAC and redirect traffic (man-in-the-middle). Managed switches mitigate it with Dynamic ARP Inspection (DAI).

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.

← All Computer Networks modules