If (the state is PENDING)
Download
Report
Transcript If (the state is PENDING)
Chapter 7
ARP and RARP
Kyung Hee
University
1
Introduction
The logical addresses in TCP/IP protocol suite
are IP addresses
Physical address is usually implemented in
hardware
Ex) 48-bit MAC addresses in Ethernet and Token
ring protocols, which are imprinted on the NIC
installed in the host or router
Kyung Hee
University
2
Introduction (cont’d)
Mapping a logical address to its corresponding
physical address
Static mapping
means creating a table that associates a logical address
with a physical address
need to update periodically
Dynamic mapping
Kyung Hee
University
each time a machine knows one of the two addresses
(logical or physical), it can use a protocol to find the other
one
ARP (address resolution protocol), RARP (reverse address
resolution protocol)
3
ARP and RARP
ARP (address resolution protocol)
RARP (reverse address resolution protocol)
Kyung Hee
University
4
Position of ARP and RARP in TCP/IP Protocol Suite
Kyung Hee
University
5
ARP Operation
Kyung Hee
University
6
ARP Operation (cont’d)
An ARP request is broadcast; an ARP reply is
unicast
Kyung Hee
University
7
The Format of ARP packet
Kyung Hee
University
8
The Format of ARP packet (cont’d)
HTYPE(hardware type) : defining the type of
the network (16 bits)
ex) Ethernet : type 1
PTYPE(protocol type :16 bits)
the value of this field for the IPv4 protocol : 080016
HLEN (Hardware length : 8 bits)
defining the length of the physical address in bytes
for Ethernet, the value is six
Kyung Hee
University
9
The Format of ARP packet (cont’d)
PLEN (protocol length : 8bits)
defining the length of the logical address in bytes
ex) for the IPv4, the value is 4
OPER (operation : 16 bits)
defining the type of the packet
ARP request : 1, ARP reply : 0
SHA (sender hardware address)
variable length field defining the physical address of
the sender
Kyung Hee
University
10
The Format of ARP packet (cont’d)
SPA (sender protocol address)
variable-length field defining the logical address of
the sender
for the IP protocol, the field is 4
THA (target hardware address)
variable-length field defining the physical address of
the target
TPA (target protocol address)
variable-length field defining the logical address of
the target
Kyung Hee
University
11
Encapsulation of ARP Packet
encapsulated directly into a data link frame
ARP packet encapsulated in an Ethernet frame
Kyung Hee
University
12
Four Cases using ARP
Case 2. A host wants to send a packet to another host on another network.
It must first be delivered to the default router.
Kyung Hee
University
13
Four Cases using ARP (cont’d)
Kyung Hee
University
14
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
Kyung Hee
University
15
Example 1 (cont’d)
Kyung Hee
University
16
Proxy ARP
ARP that acts on behalf of a set of hosts
Whenever the router running a proxy ARP receives an ARP request
looking for the IP address of one of these hosts, router sends an
ARP reply announcing its own hardware (physical) address
Later, when the router receives the actual IP packet, it will send
the packet to the appropriate host or router
Kyung Hee
University
17
7.2 ARP Package
Kyung Hee
University
18
ARP Design (cont’d)
Cache table
When a host or router receives the corresponding
physical address for an IP datagram, the address can
be saved in the cache table.
This address can be used for the datagrams
destined for the same receiver within the next few
minutes
Queues
holding the IP address while ARP tries to resolve the
hardware address
Kyung Hee
University
19
ARP Design (cont’d)
Output Module
waiting for an IP packet from the IP software
checking the cache table to find an entry
corresponding to the destination IP address of this
packet
Kyung Hee
University
20
ARP Design (cont’d)
Output module
1.
Sleep until an IP packet is received from IP software
2.
Check the cache table to find an entry corresponding to this IP packet
3.
If (found)
1.
If (the state is RESOLVED)
1.
2.
3.
2.
If (the state is PENDING)
1.
2.
4.
5.
Extract the value of the hardware address from the entry
Send the packet and the hardware address to data link layer
Return
Enqueue the packet to the corresponding queue
Return
If (not found)
1.
Create a queue
2.
Enqueue the packet
3.
Create a cache entry with state set to PENDING and ATTEMPTS set to 1
4.
Send an ARP request
Return
Kyung Hee
University
21
ARP Design (cont’d)
Input Module
waiting until an ARP packet (request or reply)
arrives
checking the cache table to find an entry
corresponding to this ARP packet
Kyung Hee
University
22
ARP Design (cont’d)
Input Module
1.
Sleep until an ARP packet (request or reply) arrives
2.
Check the cache to find an entry corresponding to the this ARP packet
3.
If (found)
1.
If (the state is PENDING)
1.
2.
Update the entry ( to RESOLVED)
While the queue is not empty
1.
2.
2.
If (the state is RESOLVED) // hardware address could have been changed
1.
4.
5.
6.
Dequeue one packet
Send the packet and the hardware address to date link
Update the entry
If (not found)
1.
Create an entry
2.
Add the entry to the table
If (the packet is a request)
1. Hee
Send an ARP reply
Kyung
University
Return
23
ARP Design (cont’d)
Cache-control module
responsible for maintaining the cache table
periodically (for example, every five seconds)
checking the cache table, entry by entry
Kyung Hee
University
24
ARP Design (cont’d)
Cache-control module
1.
Sleep until the periodic timer matures.
2.
For every entry in the cache table
1.
If (the state is Free)
1.
Continue.
2.
If (the state is PENDING)
3.
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.
If(not)
1.
Send an ARP request.
4.
Continue.
If (the state is RESOLVED)
1.
1.
2.
3.
Decrement the value of time-out by the value of elapsed time.
If(time-out less than or equal to zero)
1.
Change the state to FREE.
2.
Destroy the corresponding queue
Return.
Kyung Hee
University
25
The beginning cache table
Examples of ARP
Example 2
1) ARP output module receives an IP datagram (from IP layer) with the
destination address 114.5.7.89.
2) Check the Cache table
3) Extract hardware address, which is 457342ACAE32 and sends packet and
the address to the data link layer for transmission
Kyung Hee
University
26
Examples of ARP
Example3
1)Twenty seconds later, the ARP out module receives an IP datagram with
destination address with 116.1.7.22 and creates a new queue
2) Send an ARP request to the data link layer
Kyung Hee
University
27
Examples of ARP
Example 4
1)
Fifteen seconds layer, ARP input module receives an ARP packet with
target protocol (IP) address 188.11.8.71.
2)
Change the state to RESOLVED, and time-out value to 900 and add the
target hardware address
3)
Access queue 18 and send all the packets in this queue to the data link
layer
Kyung Hee
University
28
Example of ARP
Example 4
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 time-out 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 pending entries, the value of the
attempts
Kyung Hee
University
29
Example of ARP
Kyung Hee
University
30
7.3 RARP
To create an IP datagram, a host or a router needs to
know its own IP address or addresses
The IP address of a machine is usually read from its
configuration file stored on a disk file
A diskless machine is usually booted from ROM, which
has minimum booting information
It cannot include the IP address because the IP addresses on
a network are assigned by the administrator.
The machine can get its physical address by reading its NIC.
Kyung Hee
University
31
RARP (cont’d)
Kyung Hee
University
32
RARP (cont’d)
Packet Format
Kyung Hee
University
33
RARP (cont’d)
Encapsulation of RARP packet
Kyung Hee
University
34