Address Resolution Protocol (ARP)

In this lesson, we'll discuss how data link layer addresses are resolved in an IPv4 network

We'll cover the following

Introduction

While end hosts may use IP addresses to communicate with each other, the underlying data link layer uses its own naming schemes. So, end host interfaces have unique data link layer addresses. In order to get data to a host, a mechanism for converting IP addresses to the underlying data link layer address is needed. This entails that all sending hosts must know the data link-layer address of their destination hosts in order to send them a packet.

For example, the figure below shows four hosts attached to the same LAN configured with IPv4 addresses in the 10.0.1.0/24 subnet and data link layer addresses represented as a single character. In this network, if host 10.0.1.22/24 wants to send an IPv4 packet to the host with address 10.0.1.8, it must know that the data link layer address of this host is C.

Press + to interact
A simple LAN
A simple LAN

While manual configuration of the data link address of each host is possible in small networks such as the one above, it does not scale. Hence, IPv4 hosts and routers must be able to automatically obtain the data link layer address corresponding to any IPv4 address on the same LAN. This is the objective of the Address Resolution Protocol (ARP) defined in RFC 826. ARP is a data link layer protocol and relies on the ability of the data link layer service to broadcast a frame to all devices attached to the same LAN.

How It Works

The easiest way to understand the operation of ARP is to consider the simple network shown above and:

  • Assume that host 10.0.1.22/24 needs to send an IPv4 packet to host 10.0.1.8. To do so, the sending host must find the data link layer address that is attached to host 10.0.1.8.

  • Each IPv4 host maintains an ARP cache that contains all mappings between IPv4 addresses and data link layer addresses that it knows.

  • The sender, 10.0.1.22, first consults its ARP cache. As the cache does not contain the requested mapping, the sender sends a broadcast ARP query frame on the LAN.

  • The frame contains:

    • The data link layer address of the sender, which is A in our example,
    • The IPv4 address of the destination, which is 10.0.1.8 in the example.
  • This broadcast frame is received by all devices on the LAN. Every host upon receiving the ARP query inserts an entry for the sender’s IP address and data link layer address into their ARP cache.

  • Every host on the LAN segment receives the ARP query however, only the host that owns the requested IPv4 address replies by returning a unicast ARP reply frame with the requested mapping.

  • Upon reception of this reply, the sender updates its ARP cache and sends the IPv4 packet by using the data link layer service.

Note that to deal with devices that move or whose addresses are reconfigured, most ARP implementations remove the cache entries that have not been used for a few minutes. Some implementations also revalidate ARP cache entries from time to time by sending ARP queries.

Quick Quiz!

1

Suppose a host, A, sends an ARP request to a host C. Immediately after that, another host, D, wants to send a packet to host A. Will it send an ARP request assuming that there has not been any traffic on the LAN yet?

A)

Yes, because host D has not been in contact with host A yet

B)

It wouldn’t, because the entry for host A is in the ARP cache of host D.

C)

It wouldn’t, because host D already knows about every other host on the network

Question 1 of 20 attempted

In the next lesson, we’ll look at the dynamic host configuration protocol.

Get hands-on with 1400+ tech skills courses.