How ARP Works: Understanding ARP Requests, Replies, and ARP Cache
Address Resolution Protocol (ARP) is an essential protocol in the world of networking. It's responsible for mapping IP addresses to MAC addresses within a local area network (LAN).
๐ How ARP Works
When a host wants to communicate with another device, it needs the MAC address associated with the destination IP. If the MAC address is unknown, the host sends out a broadcast ARP Request asking:
๐จ️ “Who has IP address X.X.X.X? Tell me your MAC address.”
The device with the matching IP sends an ARP Reply with its MAC address, allowing communication to begin.
๐จ ARP Messages
ARP uses two packet types:
-
ARP Request
-
Destination MAC:
FF-FF-FF-FF-FF-FF
(broadcast) -
Target MAC:
00-00-00-00-00-00
(unknown)
-
-
ARP Reply
-
Uses unicast MAC addresses for both source and destination
-
Header Fields Include:
-
Source MAC and IP
-
Target MAC and IP
๐งช Real-World Examples
-
Host-to-Host on Same Network
PC2 wants to send data to PC3 (192.168.1.3), sends an ARP request, and receives PC3’s MAC address in reply. -
Host-to-Remote Host via Gateway
PC2 needs to reach Google, checks its default gateway (192.168.1.1), sends ARP request for it, and receives Router1’s MAC address. -
Router-to-Host on Local Network
Router receives data destined for a host on its connected LAN, sends ARP request to resolve the host's MAC. -
Router-to-Next-Hop in Another Network
Router2 resolves next-hop IP address (e.g., 34.43.12.1) via ARP to forward the packet.
๐งพ ARP Table (Cache)
Once a MAC is resolved, it's stored in the ARP table (cache) to prevent future broadcasts.
-
Default timeout: 240 minutes (can be configured)
-
Check ARP cache:
-
On Windows/Unix:
arp -a
in command prompt
-
๐ก Final Thoughts
ARP quietly enables devices to communicate in every modern IP network. Understanding its role, message types, and cache behavior helps build a solid foundation for network troubleshooting and design.
Comments