75
Working of ARP (Address Resolution Protocol)
Mostly, the computer programs use IP address (Logical address) to send or receive messages, hence the actual communication takes place over physical address (MAC address). So our aim is to find out the MAC address of the destination that allows us to communicate with other devices. In this case, the ARP is actually required as it converts the IP address to a physical address.
Working of ARP
- At the network layer, when the source wants to communicate with the destination. Firstly, the source needs to find out the MAC address (Physical Address) of the destination. For this, the source will check the ARP cache and ARP table for the MAC address of the destination. If the MAC address of the destination is present in the ARP cache or ARP table, then the source uses that MAC address for the communication.
- If the MAC address of the destination is not in the ARP cache or ARP table, then the Source generates an ARP Request message. The ARP Request message consists of the MAC address and the IP address of the source. It also contains the IP address and MAC address of the destination. The MAC address of the destination left null because the user has requested this.
- The ARP Request message will be broadcasted to the local network by the source computer. All the devices in the LAN network receive the broadcast message. Now, each device compares its own IP address with the IP address of the destination. If the IP address of the device match with the IP address of the destination, then that device will send an ARP to reply message. If the IP address of the device does not match the IP address of the destination, then the device will automatically drop the packet.
- The destination sends an ARP reply packet when the destination address matches the device. That ARP Reply packet consists of the MAC address of the device. The destination device automatically updates the table and stores the source’s MAC address because this address will be required for the communication from the source.
- Now the source acts as a target for the destination device, and the destination device sends the ARP Reply message.
- The ARP Reply message is unicast instead of broadcast. This is because the device (destination) that is sending the ARP Reply message knows the MAC address of the device (source) to which the ARP Reply message is sent.
- When the source device receives the ARP Reply message, then it will know the MAC address of the destination because the ARP Reply packet contains the MAC address of the destination along with the other addresses. The source will update the MAC address of the destination in the ARP cache. Now the sender is able to communicate directly to the destination.
Advantages of using ARP
- We can easily find out the MAC address of the device if we know the IP address of that device.
- It is not necessary to configure the address of the end nodes for the MAC address. We can find it when needed.
Disadvantages of using ARP
- ARP attacks such as ARP spoofing and ARP denial of service may occur.
Next TopicComputer Network