π Introduction to ARP
When applications send or receive data, they usually deal with IP addresses. But under the hood, actual communication over a local network (LAN) requires MAC addresses. Think of it like this.
IP Address: Apartment Number (logical, easy for humans)
MAC Address: Street Address (physical, unique identifier for devices)
So, to communicate correctly, devices must know the MAC address of the destination device. This is where ARP comes inβit converts IP addresses into MAC addresses.
β What is Address Resolution Protocol (ARP)?
ARP stands for Address Resolution Protocol , a protocol defined in RFC 826 (1982) . It belongs to the Data Link Layer (Layer 2) of the OSI model. Its primary function is to determine the hardware address (MAC address) of a device based on its IP address.
π In short: ARP = IP β MAC Mapping.
Note: ARP is mainly used in IPv4 networks. In IPv6, ARP is replaced by the Neighbor Discovery Protocol (NDP).
π How ARP Works (Step-by-Step)
ARP Request (Broadcast)
ARP Reply (Unicast)
Cache Mapping
Communication
β‘ Example: Your laptop (192.168.1.10) wants to send data to a printer (192.168.1.20). Laptop asks the network, βWho has 192.168.1.20?β β Printer replies with its MAC β Laptop stores it β Communication begins.
π οΈ ARP Cases in Networking
Case 1: Same Network Communication
Sender and receiver are in the same LAN β ARP finds the receiverβs MAC.
Case 2: Different Networks (via Router)
If the destination is outside the LAN β ARP finds the MAC of the next-hop router .
Case 3: Router to Router
A router forwarding packets uses ARP to find the MAC of the next router.
Case 4: Router to Host in Same Network
A router uses ARP to find the final hostβs MAC.
Note: ARP request is always a broadcast , ARP reply is always a unicast .
π₯οΈ ARP Cache & Commands
When an IP is mapped to a MAC, ARP saves it in a table called the ARP Cache. This avoids repeated broadcasts.
π To check ARP cache on your computer.
arp -a
This will list IP addresses and their associated MAC addresses.
π Types of ARP
1. π Reverse ARP (RARP)
Used when a device knows only its MAC address but needs its IP address. Example: A new device requests its IP from the routerβs ARP table.
2. π§βπ» Proxy ARP
A router answers ARP requests on behalf of another device. This helps devices on different segments communicate as if they are on the same LAN.
3. π Inverse ARP (InARP)
The opposite of ARPβit finds the IP address of a device when its MAC is already known. Common in ATM and Frame Relay networks.
4. π’ Gratuitous ARP
A device sends an ARP message about its own IP-to-MAC mapping. This is often used for updating caches or preventing duplicate IP issues.
π Relationship Between ARP, DNS, and DHCP
DNS (Domain Name System): Converts a domain name into an IP address.
DHCP (Dynamic Host Configuration Protocol): Assigns IP addresses to devices dynamically.
ARP (Address Resolution Protocol): Converts IP addresses into MAC addresses.
π Complete flow: Domain β DNS β IP β ARP β MAC β Communication
β οΈ ARP Security Concerns
ARP is simple, but itβs also insecure. It can be exploited in attacks.
π History and Future of ARP
History: ARP was introduced in 1982 (RFC 826) by David C. Plummer. Initially designed for IPv4 and Ethernet.
Future: In IPv6, ARP is replaced by Neighbor Discovery Protocol (NDP), which is more secure and works with ICMPv6 messages.
β
Advantages of ARP
Automatically resolves IP-to-MAC mappings
Simple and widely supported
Works dynamically without manual intervention
Scales across different network sizes
β Disadvantages of ARP
Vulnerable to spoofing attacks
Broadcasts cause extra traffic in large networks
No built-in authentication of responses
π Summary
ARP (Address Resolution Protocol) is like a translator that ensures smooth communication in networks. It maps IP addresses (logical) to MAC addresses (physical). Without ARP, devices would not know how to deliver data packets over a LAN. Though efficient, ARP has weaknesses like spoofing, which makes security measures necessary. In IPv6, ARP is replaced by NDP, but for IPv4 networks, ARP remains a fundamental and widely used protocol.