:::: MENU ::::

Sunday, December 13, 2020

Contents:


Introduction to ARP Protocol:

ARP stands for Address Resolution Protocol. It is the protocol for resolving MAC address from IPv4 address. If the network is on the IPv4 communication Protocol. The ARP is the only one that maps IPv4 addresses to MAC addresses.

Every IP device on an Ethernet network has a unique Ethernet MAC address. When a device sends an Ethernet Layer 2 frame, it contains these two addresses:

  • Destination MAC address - The Ethernet MAC address of the destination device on the same local network segment. If the destination host is on another network, then the destination address in the frame would be that of the default gateway (i.e., router).
  • Source MAC address - The MAC address of the Ethernet NIC on the source host.

To send a packet to another host on the same local IPv4 network or remote network, a host must know the IPv4 address and the MAC address of the destination device. Device destination IPv4 addresses are either known or resolved by device name. However, MAC addresses must be discovered. 

The protocol is used to discover the MAC addresses corresponding IPv4 addresses is called Address Resolution Protocol or ARP. 


ARP Operations:

A device uses Address Resolution Protocol (ARP) to determine the destination MAC address of a local device when it knows its IPv4 address.

ARP provides two basic functions:

  • Resolving IPv4 addresses to MAC addresses
  • Maintaining a table of IPv4 to MAC address mappings


Resolving IPv4 addresses to MAC addresses
        Depending on the destination IPv4 address, sender searches the destination MAC address corresponding to destination IPv4 address in the ARP table.

    • If the packet’s destination IPv4 address is on the same network as the source IPv4 address, the device will search the ARP table for the destination IPv4 address.
    • If the destination IPv4 address is on a different network than the source IPv4 address, the device will search the ARP table for the IPv4 address of the default gateway.

In both cases, the search is for an IPv4 address and a corresponding MAC address for the device.

Each entry, or row, of the ARP table, binds an IPv4 address with a MAC address. We call the relationship between the two values a map. This simply means that you can locate an IPv4 address in the table and discover the corresponding MAC address. The ARP table temporarily saves (caches) the mapping for the devices on the LAN.

If the device locates the IPv4 address, its corresponding MAC address is used as the destination MAC address in the frame. If there is no entry is found, then the device sends an ARP request.


ARP plays two Role based on Network.

  •  If the destination network is a local network, then ARP request is for the direct destination MAC address corresponding to destination IPv4 address.
  • If the destination network is remote, the ARP request is generated for the default gateway router.

ARP messages type are:
        
        1.   ARP request message
                ARP messages are encapsulated directly within an Ethernet frame. There is no IPv4 header. The ARP request is encapsulated in an Ethernet frame using the following header information:
    • Destination MAC address – This is a broadcast address FF-FF-FF-FF-FF-FF requiring all Ethernet NICs on the LAN to accept and process the ARP request.
    • Source MAC address – This is the MAC address of the sender of the ARP request.
    • Type - ARP messages have a type field of 0x806. This informs the receiving NIC that the data portion of the frame needs to be passed to the ARP process.
        2.    ARP reply message 
                    Only the device with the target IPv4 address associated with the ARP request will respond with an ARP reply. The ARP reply is encapsulated in an Ethernet frame using the following header information:
    • Destination MAC address – This is the MAC address of the sender of the ARP request.
    • Source MAC address – This is the MAC address of the sender of the ARP reply.
    • Type - ARP messages have a type field of 0x806. This informs the receiving NIC that the data portion of the frame needs to be passed to the ARP process.
Maintaining a table of IPv4 to MAC address mapping:
        When a packet is sent to the data link layer to be encapsulated into an Ethernet frame, the device refers to a table in its memory to find the MAC address that is mapped to the IPv4 address. This table is stored temporarily in RAM memory and called the ARP table or the ARP cache.
        Each entry of the ARP table is updated after a certain time-stamp. If the entry is kept idle within that certain period, then that entry will be removed Otherwise for each use of that entry, Operating system sets new time-stamp for that entry. Newer Windows operating systems store ARP table entries between 15 and 45 seconds. 


Note. If the network communication protocol is IPv6, then Neighbor Discovery Protocol (ND) is used replacing ARP Protocol.





4 comments: