Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Working of ARP
2.1.
ARP Terms
3.
Advantages of ARP
4.
Frequently Asked Questions
4.1.
What is ARP?
4.2.
Why is ARP used?
4.3.
Where is the ARP table stored?
4.4.
How do I find my ARP table?
4.5.
Does the router use ARP?
5.
Conclusion
Last Updated: Mar 27, 2024

Address Resolution Protocol(ARP)

Computer Networks

Introduction

Address Resolution Protocol (ARP) is a process of mapping a dynamic IP address to a permanent physical machine (MAC)address in a local area network. The job of ARP is essentially to translate 32-bit addresses to 48-bit addresses and vice versa. This is necessary because IP addresses in IP version 4 (IPv4) are 32 bits, but MAC addresses are 48 bits.

The MAC address exists in Layer 2 of the OSI model, the data link layer. The IP address exists in Layer 3, the network layer. Thus, ARP works between Layers 2 and 3 of the OSI Model.

Also read, Basic Networking Commands

Working of ARP

  • The IP address locates a device on a local area network. Suppose a host wants to send a packet to another host in the LAN, it needs a MAC address to identify the actual device. At first, it checks its ARP cache to find if the IP to MAC address mapping already exists. If it does, then a new ARP request is not sent. If the translation does not exist, the request for network addresses is sent.
  • ARP broadcasts a request packet to all the nodes on the LAN, asks if any of the nodes are using that particular IP address, and asks for the MAC address of that particular device. 
  • When a node identifies the IP address as its own, it sends a reply so ARP can update the cache for future use and proceed with the communication.
  • ARP cache size is limited, and it cleans all entries periodically to free up space. Addresses try to stay in the cache for only a few minutes. Frequent updates enable other devices in the network to see when a physical host changes their requested IP addresses. In the cleaning process, unused entries are deleted and any unsuccessful attempts to communicate with computers that are not currently powered on.

ARP Terms

  • ARP Cache: After resolving the MAC address, the ARP sends it to the cache stored in a table to use in the future. The following communications can use the MAC address from the table.
  • ARP Cache Timeout: The time for which the MAC address in the ARP cache can reside.
  • ARP request: The broadcasting of a packet over the network to validate whether it reaches to the destination MAC address or not. The broadcasting of the packet is called an ARP request.
  • ARP response/reply: The MAC address response that the source receives from the destination aids in further communication of the data. This response is called the ARP response.

Advantages of ARP

Following are the advantages of using ARP:

  • If we use ARP, we can easily find the MAC address if the system's IP address is known.
  • We should configure End nodes to "know" MAC addresses. It can be found when needed.
  • ARP's goal is to enable each host on a network that allows you to build up a mapping between IP addresses and physical addresses.
  • The set of mappings or tables stored in the host is called ARP table or ARP cache.


Must Read Stop and Wait Protocol,Locked based protocol in DBMS

Frequently Asked Questions

What is ARP?

It is a communication protocol used to find the MAC address associated with a given IP address, typically IPv4.

Why is ARP used?

ARP is the Address Resolution Protocol, used to translate between Layer 2 MAC addresses and Layer 3 IP addresses. ARP resolves IPs to MAC addresses by asking, "Who has IP address 192.168.0.1.

Where is the ARP table stored?

The ARP table is stored in the RAM of the device. Each ARP table entry associates an IP address with a MAC address. The relationship between the two values is a map entry - it simply means that you can locate an IP address in the table and find the corresponding MAC address.

How do I find my ARP table?

Enter "arp -a" in the command prompt to display the ARP table in this system. 

Does the router use ARP?

Your router has a set of routes set up to route traffic to your internal network, but it also has a Default Gateway that points to a router in your ISP's network. Your router will use ARP to look up the MAC address of that default gateway. Then that router will do the same thing to find its "next hop."

Conclusion

In this article, we extensively learned about Address Resolution Protocol(ARP). We learned about the need and working of ARP. We learn about the advantages of using ARP. At the end of this blog, we also find out the outcome of ARP.

Recommended Readings:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Cheers!

Live masterclass