You are on page 1of 37

7-1

Chapter 7

ARP and RARP


McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-2

ARP and RARP


Applications, which are above the layer 4, use logical address to identify the destination host, called IP address. The IP packets are encapsulated into frames. The delivery of frames across the links (source source, or source router, router router, , router destination) is based on local addresses called physical addresses (MAC numbers). The mapping of IP addresses into physical addresses is done through Address Resolution Protocol (ARP).

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-3

Position of ARP and RARP in TCP/IP protocol suite

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

ARP operation
(case: destination is on the same physical network) Link

7-4

The MAC address of destination is broadcast address: 0xFFFFFFFFFFFF

IP = 141.23.56.23

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

(Ethernet = 6)

ARP packet
4 bytes IPv4 = 4 IPv4 = 0x0800

7-5

(Ethernet = 1)

Opcode (1 = request, 2 = reply)

18 byte padding (to make frame payloads equal to 46 bytes)


McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-6

Encapsulation of ARP packet

46 bytes

Start Field Delimiter (10101011)

Why ARP packets are not encapsulated into IP datagrams? Because ARP packets never leave LAN
The McGraw-Hill Companies, Inc., 2000

McGraw-Hill

7-7

Four cases using ARP


(Case 1: Host to host)

The IP address of destination host is taken from the IP datagram.


McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-8

Four cases using ARP (cont.)


Case 2: Host to router)

(next hop)

The IP address of the destination (router) is not taken from the IP datagram. Instead it is taken from the next-hop column of the RT of the source host.
McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-9

Four cases using ARP (cont.)


(Case 3: Router to router)

The IP address of destination (router) is not taken from the IP datagram. Instead it is taken from the RT of the router
McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-10

Four cases using ARP (cont.)


(Case 4: Router to host)

The IP address of destination host is taken from the IP datagram.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-11

Example 1
A host with IP address 130.23.43.20 and physical address 0xB23455102210 has a packet to send to another host with IP address 130.23.43.25 and physical address 0xA46EF45983AB. The two hosts are on the same Ethernet network. Show the ARP request and reply packets encapsulated in Ethernet frames.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-12

Example 1: ARP request

ARP request 130.23.43.20


Dont know the destination MAC address

130.23.43.25

(48 bytes with padding)


McGraw-Hill

Broadcast address
The McGraw-Hill Companies, Inc., 2000

Example 1: ARP reply

7-13

ARP reply

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-14

ARP Cache Table


It would be very inefficient to use the ARP for each datagram. Therefore the most recent mappings are kept in a cache table. In order to be consistent with the network dynamics, the entry of ARP cache have a timeout value which helps to remove the aged entries. IP Address PA PB .... Physical Address MACA MACB .... Timeout TOA TOB ....

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

ARP Cache Table (cont.)


The ARP cache of a host can be displayed with the command:

7-15

arp a
(the command is the same on Windows and UNIX)

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

ARP Cache Table (cont.)


Implementation of ARP cache table requires more than the essential information shown on the previous two slides Number of the queue where packets are waiting for address resolution Number of ARP request sent

7-16

Life time of the entry (sec)

State Queue Attempt Time Protocol Out Address


R F P 14 5 201.11.56.7 5 900 180.3.6.1

Hardware Address
ACAE32457342

R = resolved, P = pending, F = free (time to leave has expired)

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

ARP Implementation

7-17

All modules are threads

IP datagram

Timer (5 sec)
MAC address of immediate destination (next hop or direct)
McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-18

Case: Sending a packet, destination IP has MAC in CT (state = R)


1

Each destination is given a queue (all packets with the same destination are in the same queue)

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-19

Case: Sending a packet, destination IP has not MAC in CT (state = P)


1

2 3 Put packet in existing queue

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Case: Sending a packet, destination IP is not in CT


1

7-20

2 3 Create a new queue

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Case: An ARP reply arrives, corresponding IP is in CT

7-21

3 2

Dequeue all packets

4 1

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Case: An ARP reply arrives, corresponding IP is not in CT

7-22

Create a new entry in CT

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Case from the previous slide:


an ARP reply arrives, corresponding IP is not in CT

7-23

When can this happen? The pending entry has been deleted because: (a) time-out expired (b) number of attempts exceeded

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Case: An ARP request arrives

7-24

2 1

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Cache-Control Module
Invoked by periodic timer (5 seconds)

7-25

for (every entry in CT){ switch (State){ case PENDING: increment Attempt; if (Attempt > max){ State = FREE; Destroy corresponding queue;} else Send an ARP request; break; If P-state extends a timer case RESOLVED: period (5 seconds) means that Decrement Time-Out; something is wrong send the request again if (Time-Out <= 0){ State = FREE; Destroy corresponding queue;} break; case FREE: } }
McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-26

Example 2
The ARP output module receives an IP datagram (from the IP layer) with the destination address 114.5.7.89. It checks the cache table and finds that an entry exists for this destination with the RESOLVED state (R in the table). It extracts the hardware address, which is 457342ACAE32, and sends the packet and the address to the data link layer for transmission. The cache table remains the same.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-27

Original Cache Table (Example 2)


State Queue Attempt Time Protocol Out Address
R P P R P F R P 9 18 3 60 19.1.7.82 188.11.8.71 4573E3242ACA 5 2 14 8 12 1 2 5 450 900 180.3.6.1 129.34.4.8 201.11.56.7 114.5.7.89 457342ACAE32 220.55.5.7

Hardware Address
ACAE32457342

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-28

Example 3
Twenty seconds later, the ARP output module receives an IP datagram (from the IP layer) with the destination address 116.1.7.22. It checks the cache table and does not find this destination in the table. The module adds an entry to the table with the state PENDING and the Attempt value 1. It creates a new queue for this destination and enqueues the packet. It then sends an ARP request to the data link layer for this destination.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-29

Updated CT (Example 3)

State Queue Attempt Time Protocol Out Address


R P P R P P R P 5 2 14 8 12 23 9 18 3 1 1 60 2 5 450 900 180.3.6.1 129.34.4.8 201.11.56.7 114.5.7.89 220.55.5.7 116.1.7.22 19.1.7.82 188.11.8.71

Hardware Address
ACAE32457342

457342ACAE32

4573E3242ACA

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-30

Example 4
Fifteen seconds later, the ARP input module receives an ARP packet with target protocol address 188.11.8.71. The module checks the table and finds this address. It changes the state of the entry to RESOLVED and sets the timeout value to 900. The module then adds the target hardware address (E34573242ACA) to the entry. Now it accesses queue 18 and sends all the packets in this queue, one by one, to the data link layer.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-31

Updated CT (Example 4)
State Queue Attempt Time Out
R P P R P P R R 5 2 14 8 12 23 9 18 1 1 60 900 2 5 450 900

Protocol Address
180.3.6.1 129.34.4.8 201.11.56.7 114.5.7.89 220.55.5.7 116.1.7.22 19.1.7.82 188.11.8.71

Hardware Address
ACAE32457342

457342ACAE32

4573E3242ACA E34573242ACA

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-32

Example 5
Twenty-five seconds later, the cache-control module updates every entry. The time-out values for the first three resolved entries are decremented by 60. The timeout value for the last resolved entry is decremented by 25. The state of the next-to-the last entry is changed to FREE because the time-out is zero. For each of the three entries, the value of the attempts field is incremented by one. After incrementing, the attempts value for one entry (the one with IP protocol address 201.11.56.7) is more than the maximum; the state is changed to FREE, the queue is deleted.
McGraw-Hill The McGraw-Hill Companies, Inc., 2000

7-33

CT Updated by Cache Control Module (Example 5)


Time-Out is decremented by 60 sec (20 + 15 + 25)

State Queue Attempt Time Out


R P P! F R P P R! F R 18 5 2 14 8 12 23 2 2 60! 0 900 3 6 390 840

Protocol Address
180.3.6.1 129.34.4.8 201.11.56.7 114.5.7.89 220.55.5.7 116.1.7.22 188.11.8.71

Hardware Address
ACAE32457342

457342ACAE32

E34573242ACA

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

RARP

7-34

Used when configuration file is not available (e.g. diskless machine)

Broadcast

Unicast

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-35

RARP packet

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-36

Encapsulation of RARP packet

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

7-37

Alternative Solutions to RARP


When a diskless computer is booted, it needs more information in addition to its IP address. It needs to know its subnet mask, the IP address of a router, and the IP address of a name server. RARP cannot provide this extra information. New protocols have been developed to provide this information. In Chapter 17 we discuss two protocols, BOOTP and DHCP, that can be used instead of RARP.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

You might also like