Computer Networks Essentials / Network Protocols in Detail

ARP (Address Resolution Protocol)

πŸ€” What is ARP? (Basic Idea)

In a network:

  • Devices communicate using IP addresses (logical)

  • But actual data delivery happens using MAC addresses (physical)

πŸ“Œ Problem:

How does a device find the MAC address of another device when it only knows the IP address?

πŸ‘‰ Answer: ARP


🧠 Simple Definition

πŸ“Œ ARP (Address Resolution Protocol) is a protocol used to map an IP address to its corresponding MAC address within a local network.


🧠 Why ARP is Needed?

Let’s understand the mismatch:

Layer

Address Used

Network Layer

IP Address

Data Link Layer

MAC Address

πŸ“Œ IP is used for routing,

πŸ“Œ MAC is used for actual delivery.

πŸ‘‰ ARP acts as a bridge between these two layers.


🧠 Real-Life Analogy

🏠 House Address vs Door Number

  • You know someone’s house address (IP)

  • But to deliver a parcel, you need the door number (MAC)

πŸ‘‰ ARP finds the door number for you πŸ“¦


🧭 Where Does ARP Work?

  • ARP works between:

    • Network Layer

    • Data Link Layer

πŸ“Œ Often called a cross-layer protocol.


πŸ”’ What Addresses Does ARP Use?

  • Logical Address β†’ IP Address

  • Physical Address β†’ MAC Address

Example:

IPAddress:192.168.1.10
MACAddress:00:1A:2B:3C:4D:5E

🧾 ARP Table

πŸ“Œ Every device maintains an ARP table (ARP cache).

🧠 What is ARP Table?

  • Stores IP ↔ MAC mappings

  • Speeds up communication

  • Avoids repeated ARP requests

🧾 Example ARP Table

IP Address

MAC Address

192.168.1.1

AA:BB:CC:DD:EE:FF

192.168.1.10

00:1A:2B:3C:4D:5E

πŸ“Œ Entries have a timeout (TTL).


πŸ”„ How ARP Works (Step-by-Step)

Let’s say:

  • Device A wants to send data to Device B

  • Device A knows IP of B, not MAC


πŸͺœ ARP Working Steps

1️⃣ Device A checks its ARP table

2️⃣ MAC not found ❌

3️⃣ Device A sends ARP Request (Broadcast)

4️⃣ All devices receive request

5️⃣ Device B replies with ARP Reply (Unicast)

6️⃣ Device A stores MAC in ARP table

7️⃣ Data transmission starts

πŸ“Œ Simple and fast ⚑


πŸ“‘ ARP Request vs ARP Reply

Message

Type

Purpose

ARP Request

Broadcast

Ask β€œWho has this IP?”

ARP Reply

Unicast

Answer with MAC address


πŸ“¦ ARP Packet Format (Basic Idea)

ARP packet contains:

  • Sender IP

  • Sender MAC

  • Target IP

  • Target MAC

πŸ“Œ Used to exchange address information.


🧠 Types of ARP

  • Automatically learned

  • Stored temporarily in ARP table

πŸ“Œ Most common type βœ”οΈ

  • Manually configured

  • Permanent entry

πŸ“Œ More secure but less flexible.

  • Device announces its own IP–MAC mapping

  • Used to:

    • Detect IP conflicts

    • Update ARP tables


⚠️ ARP Security Issues (ARP Spoofing)

🧠 What is ARP Spoofing?

  • Attacker sends fake ARP replies

  • Victim updates ARP table wrongly

  • Attacker becomes man-in-the-middle

πŸ“Œ Very dangerous attack 🚨

πŸ›‘οΈ Prevention

  • Static ARP entries

  • ARP inspection

  • Switch security features


🧠 ARP vs RARP (Quick Note)

Protocol

Purpose

ARP

IP β†’ MAC

RARP

MAC β†’ IP

πŸ“Œ RARP is mostly obsolete.


🧠 Memory Tricks

  • ARP = Ask for MAC

  • Request = Broadcast πŸ“’

  • Reply = Unicast πŸ“©

  • IP β†’ MAC


⭐ One-Line Summary

πŸ”Ή ARP is a protocol that resolves an IP address into a MAC address to enable data delivery within a local network.