DEV Community

Buddika Abeykoon
Buddika Abeykoon

Posted on

ARP Explained - How IP Addresses Find MAC Addresses

Devices on a network communicate at the hardware level using MAC addresses but applications and users work with IP addresses. When a device wants to send data to another device on the same local network (LAN) example of SFTP, HTTP etc, it needs to know the destination's MAC address — ARP handles that translation.

ARP stands for Address Resolution Protocol. It's a network protocol used to map an IP address (logical address) to a MAC address (physical/hardware address) on a local network.

The way the Data Link layer and Network layer work together is very important for communication in networks.

Data Link Layer: Operates at the hardware level using MAC (Media Access Control) addresses.
Network Layer: Works with IP (Internet Protocol) addresses that are more user-friendly.

Here's how ARP actually works, step by step, with the mechanisam behind it.

Check the ARP cache first

Before sending anything, a device checks its local ARP cache (a table of IP-to-MAC mappings it already knows). If the mapping exists, it uses that directly — no need to ask the network again.

If not cached, broadcast an ARP Request

The device creates an ARP request packet and sends it as a broadcast (destination MAC: FF:FF:FF:FF:FF:FF), meaning every device on the local network receives it.

The request essentially says,

"I am 192.168.1.10 (MAC: AA:BB:CC:DD:EE:02). Who has IP 192.168.1.1? Send me your MAC address."

Every device inspects the request

All devices on the LAN receive the broadcast but only the device whose IP matches will respond. Everyone else silently discards it.

The target sends an ARP Reply

The matching device replies directly (unicast, not broadcast) to the requester,

"I am 192.168.1.1, my MAC address is AA:BB:CC:DD:EE:01."

Cache update

The original requester stores this mapping in its ARP cache. Both sides often update their caches at this point (the responder also now knows the requester's MAC).

Data transmission begins

Now that Device 192.168.1.1 has Device 192.168.1.10's MAC address, it can encapsulate the IP packet into an Ethernet frame addressed directly to that MAC.

Top comments (0)