You are on page 1of 19

Chapter 7

ARP and RARP


Objectives
Upon completion you will be able to:
Understand the need for ARP Understand the cases in which ARP is used Understand the components and interactions in an ARP package Understand the need for RARP

TCP/IP Protocol Suite

Figure 7.1

ARP and RARP

TCP/IP Protocol Suite

Figure 7.2

Position of ARP and RARP in TCP/IP protocol suite

TCP/IP Protocol Suite

7.1 ARP
ARP associates an IP address with its physical address. On a typical physical network, such as a LAN, each device on a link is identified by a physical or station address that is usually imprinted on the NIC.

The topics discussed in this section include:


Packet Format Encapsulation Operation

TCP/IP Protocol Suite

Figure 7.3

ARP operation

TCP/IP Protocol Suite

Figure 7.4

ARP packet

TCP/IP Protocol Suite

Figure 7.5

Encapsulation of ARP packet

TCP/IP Protocol Suite

Note:
An ARP request is broadcast; an ARP reply is unicast.

TCP/IP Protocol Suite

7.2 ARP PACKAGE


In this section, we give an example of a simplified ARP software package to show the components and the relationships between the components. This ARP package involves five modules: a cache table, queues, an output module, an input module, and a cache-control module.

The topics discussed in this section include:


Cache Table Queues Output Module Input Module Cache-Control Module

TCP/IP Protocol Suite

Figure 7.9

ARP components

TCP/IP Protocol Suite

10

Output Module: 1. Waits until an IP packet is recived from IP software 2. Check cache table for an entry corresponding to the destination of this IP packet. 3. If ( found)

1. Retrieve the hardware address of this entry. 2. Send the packet along with the hardware address to the data link layer. 3. Return. 2. If (state is PENDDING) 1. Packet waits until the destination hardware address found. 2. Enqueue the packet to the corresponding queue. 3. Return. 4. If (not found) 1. Create a cache entry with state PENDING and ATTEMPTS set to 1. 2. Create a queue. 3. Enqueue the packet. 4. Send the request. 5. return.
TCP/IP Protocol Suite

1. If (state is RESOLVED)

11

Input Module: 1. Waits until ARP (request or reply) packet arrives. 2. Check the cache table to find an entry corresponding to the ARP packet. 3. If (found) 1. If ( the state is PENDING) 1. Update the entry (with RESOLVED state and TIMEOUT value) 2. While the queue is not empty 1. dequeue one packet 2. Send the packet and hardware address to the data link. 2. If ( the state is RESOLVED) 1. Update the entry with new hardware address and reset the TIMEOUT 4. If (not found) 1. Create an entry 2. Add the entry to the table (with resolved state and TIMEOUT) 5. If (the packet is a request) 1. Send an ARP reply immediately. 6. Return.

TCP/IP Protocol Suite

12

Cache Control Module:

It is responsible for maintaining the cache table. 1. Periodically check the cache table entry by entry. 2. For every entry in the cache table 1. If ( the state is FREE) 1. continue. 2. If ( the state is PENDING) 1. Increment the value of ATTEMPTS by 1. 2. If (ATTEMPTS greater than maximum) 1. change the state to FREE. 2. Destroy the corresponding queue. 3. Else 1. send an ARP packet. 3. If ( the state is RESOLVED) 1. Decrement the value of time-out by the value of the elapsed time. 2. If (time- out less than or equal to zero) 1. change the state to FREE. 2. Destroy the corresponding queue. 3. Return

TCP/IP Protocol Suite

13

Table 7.1 Original cache table used for examples

TCP/IP Protocol Suite

14

7.3 RARP
RARP finds the logical address for a machine that only knows its physical address.

The topics discussed in this section include:


Packet Format Encapsulation RARP Server Alternative Solutions to RARP

TCP/IP Protocol Suite

15

Note:

The RARP request packets are broadcast;


the RARP reply packets are unicast.

TCP/IP Protocol Suite

16

Figure 7.10

RARP operation

TCP/IP Protocol Suite

17

Figure 7.11 RARP packet

TCP/IP Protocol Suite

18

Figure 7.12

Encapsulation of RARP packet

TCP/IP Protocol Suite

19

You might also like