Introduction to Address Resolution Protocol
Address Resolution Protocol is address mapping technique used to dynamically map logical address to a physical address i.e. convert the logical address (IP address) used at network layer to physical address (MAC address) used at data link layer. Package of Address Resolution protocol consist of cache table, queues, output module, input module and cache control module. Address Resolution protocol consist of Hardware type, protocol type, Hardware length, protocol length, operations like request and reply, hardware address of sender, protocol address of sender, hardware address of target and protocol address of target.
Address Resolution Protocol packet format
The below tables is the ARP packet format:
ARP packet format is shown as follows:
- Hardware type: It is a 16-bit field that defines the type of network on which address resolution protocol is running.
- Protocol type: It is a 16-bit field that defines the type of protocol. For e.g. for the IPv4 protocol, this field contains 0800 bases 16.
- Hardware length: It is an 8-bit field that defines the physical address length in bytes.
- Protocol length: It is an 8-bit field that defines the logical address length in bytes.
- Operations: It is a 16-bit field that defines the types of packets. There are two types of packets ARP request (1) and ARP reply (2).
- Sender hardware address: It is a variable-length field that defines the physical address of the sender.
- Sender protocol address: It is a variable-length field that defines the logical address of the sender.
- Target hardware address: It is a variable-length field that defines the physical address of the receiver.
- Target protocol address: It is a variable-length field that defines the logical address of the receiver.
Address Resolution Protocol Operations
In this section, we are going to see the ARP process and four different cases where host or router need to use address resolution protocol.
Below is a list of steps involved in the ARP process:
Step 1: The sender knows the IP address of the receiver.
Step 2: Internet protocol asks ARP to create an ARP request message that contains information like sender physical address, receiver physical address field is filled with 0s, the sender IP address and receiver IP address.
Step 3: ARP request message is sent to the data link layer where the message is encapsulated in the frame using the sender’s physical address as a source address and broadcast address as a destination address.
Step 4: Each and every host receives the frame because the frame contains a broadcast destination address. All hosts check the address with their address. If the match founds the packet is dropped to that host otherwise it passes to the address resolution protocol.
Step 5: After receiving the packet target host reply with ARP reply message that contains the target physical address. The message in this step is unicast.
Step 6: When the sender receives a reply message from the target it knows the physical address of the target.
Step 7: Now the IP Datagram carries data for the target machine that is encapsulated and sends in the unicast form to the destination.
Four different cases
Below is the list of four cases where address resolution protocol services can be used.
From the above picture, we can see that the sender is a host and wants to send a packet to another host that lies on the same network. In this case, mapping the logical address to the physical address is a destination IP address should be in the datagram header.
As we can see in the above picture, the sender is a host and wants to send a packet to another host that lies on another network. In this case, the sender host looks into the routing table to find the IP address of the next host for the destination. The IP address of the host becomes the logical address that must be mapped to a physical address. If the sender host does not have a routing table, it looks at the IP address of the default host.
As we can see in the above picture, the sender is a router that received a datagram for another host that lies on another network. In this case, the router looks into the routing table and finds the IP address of the next router. The IP address of the router becomes the logical address that must be mapped to a physical address.
As we can see in the above picture, the sender is a router that received a datagram for another host that lies on the same network. In this case, the IP address of datagram becomes the logical address that must be mapped to a physical address.
Address Resolution Protocol Package
Address Resolution Protocol Package has five components –
3.Output module 4
Below is the Diagram of Address Resolution Protocol Package
Let’s discuss the components of the ARP package in detail.
1. Cache Table in ARP
When the host receives the corresponding physical address of IP datagram, the Cache table saves this physical address in its table. The storing of a physical address in the cache table is limited for a specific amount of time rather than an unlimited time. The cache table is consists of an array of entries. Each entry has the following mentioned field.
- State: It shows the state of each entry. State can be Free, Resolved or Pending. Free state means the time to live for entry has expired. That space is allocated to a new entry. Resolved state means the entry is completed. An entry has the destination physical address. Packages that are waiting to be sent to this destination can use the information in the entry. Pending state means the request for the entry has been stated and waiting for the reply.
- Hardware type: It defines the type of network on which the ARP package is running.
- Protocol type: It defines the type of protocol on which the ARP package is running.
- Hardware length: It defines the length of the physical address.
- Protocol length: It defines the length of the logical address.
- Hardware address: It shows the destination physical address.
- Protocol Address: It shows the destination logical address.
- Interface number: It is an interface number that the router uses to connect with a different network.
- Queue number: Address resolution protocol use queue number to enqueuer the packets that are waiting for address resolution.
- Time-out: It shows the lifetime of each entry in the second.
- Attempts: It shows the number of times the ARP request has been sent for each entry.
Address Resolution Protocol contains a set of queues for destination i.e one queue for each destination to hold the IP package while Address Resolution Protocol resolves the physical address. The output module sends unresolved packets to their corresponding queues.
3. Output Module
- The output model waits for IP packets. As soon as the IP packet receive, it checks the cache table to find the corresponding IP address of the destination present in the packet. The destination IP address of the packet must match the protocol address of the entry.
- If the matching entry founds and state of the entry is RESOLVED, then the packet with destination hardware address is passed to the data link layer for transmission.
- If the matching entry founds and the state of the entry are PENDING, then the packet waits until the hardware address of the destination is found.
- If the matching entry does not find, the output module creates a queue and enqueues the packet. It creates a new entry and gives the state a PENDING and set attempts to 1. It broadcast the ARP request packet for the destination address.
4. Input Module
- Input Module waits for the address resolution protocol packet. As soon as the address resolution packet arrives it check the entry corresponding to the address resolution packet in the cash table. The protocol address of the target must match the protocol address of the entry.
- If the matching entry is found and the state of the entry is RESOLVED, the input module updates the entry and time outfield. Entry is updated because there can be chances of change in the hardware address.
- If the matching entry is found and the state of the entry is PENDING, the input module updates the entry by copying the hardware address of the target to the hardware address field of the entry and update the state field to RESOLVED. It also updates the timeout field of the entry.
- If the matching entry does not found the input module create a new entry and add it to the table. It updates the state field to RESOLVED and time outfield of the entry.
- Then the input module checks whether the ARP packet that is received is a reply or request. If it is an ARP request, the input module immediately creates an ARP reply and sends it to the sender. ARP reply packet is created by changing the value of the packet from request to reply.
5. Cache-Control Module
- The cache-control module maintains the cache table. It checks the cache table entry by entry periodically i.e. five seconds.
- If the state field of the entry is FREE, it checks another entry.
- If the state field of the entry is PENDING, the cache-control module increases the value of the attempt field by 1. It then checks the value of the attempt field. If the value of the attempt field is greater than the maximum limit that is allowed, it updates the state field to FREE and destroys the corresponding queue.
- If the state field of the entry is RESOLVED, the cache-control module decreases the value of time outfield by 1. It then checks the value of the time outfield. If the value of time outfield is less than or equal to zero, it updates the state field of entry to FREE and destroys the corresponding queue.
In this article, we have seen what is Address Resolution Protocol, packet format in ARP and it’s operation with images and explanation in the sub-topics for better understanding.
This has been a guide to Address Resolution Protocol. Here we have discuss packet format, operations, as well as components of ARP package. You can also go through our other suggested articles to learn more –