For IPv4 addresses to resolve to MAC addresses, the frames placed in a LAN environment must be the destination MAC address.
When a packet is sent to the data link layer to be enclosed in a frame, the node queries a table in its memory to find the address of the data link layer assigned to the destination IPv4 address. This table is called the ARP table or ARP cache. The ARP table is stored in the RAM hardware of the device.
Each entry or row in the ARP table links an IP address to a MAC address. The relationship between the two values is called a map, meaning you can find an IP address in the table and the corresponding MAC address. The ARP table temporarily stores device assignments (cached) in the local LAN.
To begin processing, a transmitting node attempts to find the MAC address assigned to an IPv4 destination. If this map is in the table, the node uses the MAC address as the target MAC in the frame containing the IPv4 packet. The frame is then encoded in the network environment.
Understanding ARP (Address Resolution Protocol)
The ARP table is maintained dynamically. There are two ways in which a device can collect MAC addresses. The first is to monitor the traffic that occurs in the segment of the local network. Because a node receives frames from the media, it can save the source IP and MAC addresses as mappings in the table. The device completes the ARP table with address pairs when frames are transmitted on the network.
As shown in the figure, a device can also receive address pairs by sending a request. An ARP request is a Layer 2 broadcast transmitted to all devices on an Ethernet LAN. The ARP request includes the IP address and the broadcast MAC address of the target host, FFFF.FFFF.FFFF.
Because it is a broadcast, all nodes in the Ethernet LAN receive and examine the content. The IP address responds to the node that matches the IP address in the request. The response is a unicast frame containing the MAC address corresponding to the IP address in the request. This response is used to create a new entry in the ARP table of the sending node.
The entries in the ARP table have a timestamp similar to the MAC table entries in the switches. If a device does not receive a frame from a particular device before the time stamp expires, its entry is removed from the table.
Additionally, static assignment entries can be entered in a table, which is uncommon. Static entries in the ARP table do not expire over time and must be manually removed.
How Does ARP Protocol Work?
What does the node do when a frame needs to create a structure, and the ARP cache does not include an IP address assigned to a destination MAC address? When the ARP receives a request to map an IPv4 address to a MAC address, it searches for the map stored in the table. If no input is found, IPv4 packet encapsulation is not performed, and Layer 2 operations notify the ARP that a map is needed.
The ARP then sends a request packet to find the MAC address of the target device of the local network. If a device receiving the request has a destination IP address, it responds with a response. A map is created in the table. Packets of this IPv4 address can now be placed in frames.
The packet is discarded if no device responds to a request because no frames can be created. This encapsulation error is reported to the upper layers of the device.