Address Resolution Protocol (ARP)

Address Resolution Protocol (ARP)

ARP is a layer 2 protocol (Data Link Layer) for mapping an IP address to a MAC address on a local area network.

Example → 10.10.123.32 →7A-89–76-E0-B1–23

Basically, ARP is a program used by a computer to find the physical MAC address of another computer based on its IP address.

When a computer wants to communicate with some computer on a different network, then it will use the IP address, otherwise for communicating locally, it needs a MAC address of the other computer.

Time for an analogy, An IP address is like your home address and your MAC address could be your name. You might need a home address for a friend residing in some different city, but you will call him/her using their name if they were right next to you.

Notice there is no MAC address

Let’s see how ARP works,

When a client wants to talk to the server on the same broadcast domain, the client first checks its ARP cache, a table with previously connected IP address along with their corresponding MAC addresses.

You can view your ARP table on Windows machine by this command:

arp -a

If there is no entry in the ARP cache, the client sends a broadcast message because the destination MAC address is a broadcast address (The MAC address used for broadcast (broadcast MAC address) is ff:ff:ff:ff:ff:ff. Broadcast MAC address is a MAC address consisting of all binary 1s. Broadcast is “one to all” type of communication).

The message says “Hello ‘so-and-so IP address’, if you can hear me please give me your MAC address. And here are my IP and MAC addresses.”

Other devices over the same network ignore the message.

The supposed friend or the server we need, after getting the client’s message sends a unicast message to share its MAC address. Now the client can send its request for connection to the selected server or any other device for that matter, simultaneously updating its ARP cache.