ARP (Address Resolution Protocol)

1. Introduction to ARP

The Address Resolution Protocol (ARP) is essential for local IPv4 communication.

So how does Address Resolution Protocol work in practice? Let’s break it down with a simple example between PC1 and PC2 on a local network.

Imagine this: You’re sitting behind PC1 and you want to ping your friend’s device PC2, on the same network.

You already know PC2’s IP address (192.168.1.2), so you can send a ping request. But there’s a problem : your device doesn’t know PC2’s MAC address !

Now, take a moment to think. Why is the MAC address important?

Your device needs both the IP address and the MAC address of the destination device to send data. Without the MAC address, your message won’t know where to go at the data link layer.

This is exactly why the Address Resolution Protocol (ARP) was created. ARP maps IP addresses to MAC addresses, allowing devices to communicate.

In our case, it helps PC1 find the MAC address of PC2 (192.168.1.2) so they can exchange data successfully.

2. How ARP Works

Let’s break it down step by step. You’re about to send a ping from PC1 to PC2. What exactly happens?

Step 1: Checking the ARP Table

You type the command ping 192.168.1.2 and press Enter! The first thing your computer (PC1) does is check its ARP table.

How does Address Resolution Protocol work – PC1 checking ARP table before pinging PC2

The ARP table is a table stored in your computer that contains known IP-to-MAC address mappings.

Your device will search for the MAC address associated with 192.168.1.2 before sending the ping request.

To view the ARP table on Windows, open the terminal and type:

C:\> arp -a

Interface: 192.168.1.1  0xb
  Internet Address      Physical Address      Type

But in our case, the ARP table is empty meaning PC1 doesn’t know the MAC address of PC2 (192.168.1.2).

At this point, we’re stuck. We need PC2’s MAC address to send the request and this is where the ARP protocol help us !

Step 2: ARP Request

If the MAC address is not found in the ARP table, your device will send an ARP Request, asking:

How does Address Resolution Protocol work – ARP Request sent from PC1 to identify MAC address of 192.168.1.2

This ARP Request message is broadcasted to every device on the network.

Understanding the ARP Request Fields

The ARP Request contains multiple fields that help the receiver understand that we are trying to find its MAC address.

In the ARP Request, we have multiple fields filled to ensure the receiver knows we are trying to find its MAC address.

FieldValue
Source MACAA:AA:AA:AA:AA:AA (PC1’s MAC address)
Destination MACFF:FF:FF:FF:FF:FF (Broadcast address)
Source IP192.168.1.1 (PC1’s IP address)
Target IP192.168.1.2 (PC2’s IP address)
Target MAC00:00:00:00:00:00 (Unknown, because PC1 doesn’t know PC2’s MAC address yet)

Here’s what happens in this request:

  • Target IP: The IP address of PC2 (192.168.1.2), the device we are looking for.
  • Target MAC: Set to all zeros (00:00:00:00:00:00) because PC1 doesn’t know PC2’s MAC address yet.
  • Destination MAC: A broadcast address (FF:FF:FF:FF:FF:FF), meaning every device on the network receives the message.

Step 3: ARP Reply

Now, let’s switch to PC2’s perspective.

When PC2 receives the ARP Request, it checks if the Target IP field matches its own IP address (192.168.1.2).

If this is the case, that means someone is asking for its MAC address.

How does Address Resolution Protocol work – ARP Reply from PC2 to PC1 with MAC address of 192.168.1.2

PC2 then sends an ARP Reply directly to PC1, announcing its MAC address !

Understanding the ARP Reply Fields

FieldValue
Source MACBB:BB:BB:BB:BB:BB (PC2’s MAC address)
Destination MACAA:AA:AA:AA:AA:AA (PC1’s MAC address)
Source IP192.168.1.2 (PC2’s IP address)
Target IP192.168.1.1 (PC1’s IP address)
Target MACAA:AA:AA:AA:AA:AA (PC1’s MAC address)
Here’s what happens in this request:
  • PC2 provides its MAC address (BB:BB:BB:BB:BB:BB) to PC1.
  • Unlike the ARP Request (which was broadcasted to all devices), the ARP Reply is a unicast message meaning it is sent only to PC1.

Step 4: Updating the ARP Table

Once PC1 receives the ARP Reply, it updates its ARP table with PC2’s MAC address as you can see below.

C:\> arp -a

Interface: 192.168.1.1  0xb
  Internet Address      Physical Address      Type
  192.168.1.2           BB-BB-BB-BB-BB-BB     dynamic

This entry allows PC1 to communicate with PC2 without needing another ARP Request. However, ARP table entries are temporary and the MAC Address will be removed if they remain unused for a certain period.

3. Successful Ping

Now that PC1 has learned PC2’s MAC address, it can finally send the ping request.

When you ping 192.168.1.2, your device first checks its ARP table to retrieve PC2’s MAC address. Then, it sends the packet directly to PC2.

How does Address Resolution Protocol work – ARP table updated and ping reply sent from PC2 to PC1

4. Conclusion

The Address Resolution Protocol (ARP) is a simple but essential mechanism in local networks. It acts as the bridge between IP addresses and MAC addresses, enabling devices to communicate on the same subnet.

Understanding how Address Resolution Protocol works gives you insight into one of the core processes behind IPv4 communication. Without ARP, sending data over Ethernet would be impossible, even if you knew the destination IP address.

🔹 Key points to remember:

  • Once resolved, communication can occur directly over the data link layer communication.
  • ARP connects the logical and physical layers by mapping IP addresses to MAC addresses.
  • If the MAC address is unknown, ARP sends a request to find it dynamically.