Open In App

How Address Resolution Protocol (ARP) works?

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Most computer programs/applications use logical addresses (IP Addresses) to send/receive messages. However, the actual communication happens over the Physical Address (MAC Address) that is from layer 2 of the OSI model. So our mission is to get the destination MAC Address which helps in communicating with other devices. This is where ARP comes into the picture, its functionality is to translate IP addresses to Physical Addresses.

ARP

ARP

Address Resolution Protocol (ARP)

The acronym ARP stands for Address Resolution Protocol which is one of the most important protocols of the Data link layer in the OSI model. It is responsible to find the hardware address of a host from a known IP address. There are three basic ARP terms.

Note: ARP finds the hardware address, also known as the Media Access Control (MAC) address, of a host from its known IP address. 

Address Resolution Protocol

Address Resolution Protocol

Important Terms Associated with ARP

Reverse ARP

Reverse Address Resolution Protocol is a protocol that is used in local area networks (LAN) by client machines for requesting IP Address (IPv4) from Router’s ARP Table. Whenever a new machine comes, which requires an IP Address for its use. In that case, the machine sends a RARP broadcast packet containing MAC Address in the sender and receiver hardware field.

Proxy ARP

Proxy Address Resolution Protocol work to enable devices that are separated into network segments connected through the router in the same IP to resolve IP Address to MAC Address. Proxy ARP is enabled so that the ‘proxy router’ resides with its MAC address in a local network as it is the desired router to which broadcast is addressed. In case, when the sender receives the MAC Address of the Proxy Router, it is going to send the datagram to Proxy Router, which will be sent to the destination device.

Inverse ARP

Inverse Address Resolution Protocol uses MAC Address to find the IP Address, it can be simply illustrated as Inverse ARP is just the inverse of ARP. In ATM (Asynchronous Transfer Mode) Networks, Inverse ARP is used by default. Inverse ARP helps in finding Layer-3 Addresses from Layer-2 Addresses.

How ARP Works?

Imagine a device that wants to communicate with others over the internet. What does ARP do? It broadcast a packet to all the devices of the source network. The devices of the network peel the header of the data link layer from the Protocol Data Unit (PDU) called frame and transfer the packet to the network layer (layer 3 of OSI) where the network ID of the packet is validated with the destination IP’s network ID of the packet and if it’s equal then it responds to the source with the MAC address of the destination, else the packet reaches the gateway of the network and broadcasts packet to the devices it is connected with and validates their network ID. The above process continues till the second last network device in the path reaches the destination where it gets validated and ARP, in turn, responds with the destination MAC address.

How-Address-Resolution-Protocol-ARP-works---gif-opt-(1)

ARP

  1. ARP Cache: After resolving the MAC address, the ARP sends it to the source where it is stored in a table for future reference. The subsequent communications can use the MAC address from the table.
  2. ARP Cache Timeout: It indicates the time for which the MAC address in the ARP cache can reside.
  3. ARP request: This is nothing but broadcasting a packet over the network to validate whether we came across the destination MAC address or not. 
    1. The physical address of the sender.
    2. The IP address of the sender.
    3. The physical address of the receiver is FF:FF:FF:FF:FF: FF or 1’s.
    4. The IP address of the receiver.
  4. ARP response/reply: It is the MAC address response that the source receives from the destination which aids in further communication of the data. 
  • CASE-1: 
    • The sender wants to send a packet to another host on the same network.
    • Use ARP to find another host’s physical address.
  • CASE-2: 
    • The sender is a host and wants to send a packet to another host on another network.
    • The sender looks at its routing table.
    • Find the IP address of the next hop (router) for this destination.
    • Find the IP address of the next hop (router) for this destination.
  • CASE-3: 
    • The sender is a router and received a datagram.
    • The router checks its routing table.
    • Calculate the IP of the next router.
    • Use ARP to find the next router’s physical address. 
  • CASE-4: 
    • The sender is a router that has received a datagram destined for a host in the same network.
    • Use ARP to find this host’s physical address. 

Note: An ARP request is broadcast, and an ARP response is a Unicast. 

Test Yourself

Internet Schema 1

Internet Schema 1

Connect two PC, say A and B with a cross cable. Now you can see the working of ARP by typing these commands: 

1. A > arp -a





There will be no entry at the table because they never communicated with each other. 

Blank Entry Table ARP

Blank Entry Table ARP

2. A > ping 192.168.1.2

IP address of destination is 192.168.1.2
Reply comes from destination but one
packet is lost because of ARP processing.





Packet Loss ARP

Packet Loss ARP

Now, entries of the ARP table can be seen by typing the command. This is what the ARP table looks like: 

ARP Table

ARP Table

Types of ARP

A communication protocol called Address Resolution Protocol (ARP) is used to determine a device’s MAC (Media Access Control) address based on its IP address. There are mainly 4 types of ARP available:

1. Proxy ARP

A Layer 3 device can reply to an ARP request for a target that is on a different network than the sender by using a technique called proxy ARP. In response to the ARP, the router that has been set for Proxy ARP maps its MAC address to the target IP address, deceiving the sender into believing that the message has arrived at destination.

Because the packets have the required information, the proxy router at the backend forwards them to the correct location.

2. Gratuitous ARP

The host’s ARP request known as “gratuitous ARP” aids in locating duplicate IP addresses. This is a broadcast request for the router’s IP address. All other nodes are unable to use the IP address assigned to a switch or router in the event that it sends out an ARP request to obtain its IP address and receives no ARP answers in return. However, another node uses the IP address assigned to the switch or router if it sends an ARP request for its IP address and gets an ARP response.

3. Reverse ARP

In a local area network (LAN), the client system uses this networking protocol to ask the ARP gateway router table for its IPv4 address. The network administrator creates a table in the gateway-router that is used to correlate the IP address with the MAC address.

4. Inverse ARP

The purpose of inverse ARP, which is the opposite of ARP, is to deduce the nodes’ IP addresses from their data link layer addresses. Frame relays and ATM networks, where Layer 2 virtual circuit addressing is frequently obtained from Layer 2 signalling, are the primary applications for them. These virtual circuits can be used with the necessary Layer 3 addresses accessible.

Is there any Relationship between ARP , DNS and DHCP

As was previously noted, IP addresses are dynamic by design since doing so protects users’ privacy and security. IP address changes, though, shouldn’t happen at random. An IP address should be assigned according to rules from a predetermined range of numbers that are available in a particular network. By doing this, problems like two machines getting the same IP address are avoided. The Dynamic Host Configuration Protocol, or DHCP, is the name given to the regulations. Because IP addresses are required to do an internet search, they are significant as computer identities. Users utilise alphabetical names while searching for a domain name or Uniform Resource Locator (URL). Computers, on the other hand, link a domain name to a server using the numeric IP address. In order to link the two, an IP address is converted from a bewildering string of digits into a more legible, intelligible domain name by use of a Domain Name System (DNS) server, and vice versa.

ARP Spoofing and ARP Cache Poisoning

ARP Spoofing is a type of falseness of a device in order to link the attacker’s MAC Address with the IP Address of the computer or server by broadcasting false ARP messages by the hacker. Upon successful establishment of the link, it is used for transferring data to the hacker’s computer. It is simply called Spoofing. ARP can cause a greater impact on enterprises. ARP Spoofing attacks can facilitate other attacks like:

Local Area Network that uses ARP is not safe in the case of ARP Spoofing, this is simply called as ARP Cache Poisoning.

Frequently Asked Question on ARP – FAQs

What is MTM attack?

A “man in the middle” assault is one in which the hacker or attacker establishes a connection with the victims in order to communicate with them or maybe intercept all of the victims’ data packets. In this instance, the victims believe they are speaking with one another, but in actuality, the communication is being controlled by the malevolent attacker or hacker; in other words, a third party is in place to oversee and manage the communication flow between the client and server.

What is ARP cache?

An IP address and a Media Access Control (MAC) address for a physical computer or device on a local network are linked by use of an Address Resolution Protocol cache (ARP cache), which is a data repository. The ARP cache aids in directing packets to the appropriate endpoint and can store information for both Ethernet and wireless routing.

What is ARP time-out?

Network hosts maintain the Address Resolution Protocol (ARP) table, which retains ARP entries for a few hours.

What is ARP Spoofing?

Spoofing is a kind of attack where hackers infiltrate the target user’s system and utilise their trust to propagate dangerous malware and steal data, including PINs and passwords, that is saved on the system.In spoofing, the hacker’s primary goal is to psychologically influence the victim.

Is ARP provide security?

No ARP is not secure itself.



Last Updated : 13 Feb, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads