Hee Sok, Han Department of Biomedical Engineering, Kyung-Hee University BRAIN STIMULATION.
1 Kyung Hee University Chapter 7 ARP and RARP. 2 Kyung Hee University Introduction The logical...
-
Upload
darren-barker -
Category
Documents
-
view
218 -
download
0
Transcript of 1 Kyung Hee University Chapter 7 ARP and RARP. 2 Kyung Hee University Introduction The logical...
11Kyung Hee University
Chapter 7Chapter 7ARP and RARPARP and RARP
22Kyung Hee University
IntroductionIntroduction
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
33Kyung Hee University
Introduction (cont’d)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 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)
44Kyung Hee University
ARP and RARPARP and RARP ARP (address resolution protocol)
RARP (reverse address resolution protocol)
55Kyung Hee University
Position of ARP and RARP in TCP/IP Protocol SuitePosition of ARP and RARP in TCP/IP Protocol Suite
66Kyung Hee University
ARP OperationARP Operation
77Kyung Hee University
ARP Operation (cont’d)ARP Operation (cont’d)
An ARP request is broadcast; an ARP reply is
unicast
88Kyung Hee University
The Format of ARP packetThe Format of ARP packet
99Kyung Hee University
The Format of ARP packet (cont’d)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
1010Kyung Hee University
The Format of ARP packet (cont’d)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
1111Kyung Hee University
The Format of ARP packet (cont’d)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
1212Kyung Hee University
Encapsulation of ARP PacketEncapsulation of ARP Packet
encapsulated directly into a data link frame
ARP packet encapsulated in an Ethernet frame
1313Kyung Hee University
Four Cases using ARPFour 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.
1414Kyung Hee University
Four Cases using ARP (cont’d)Four Cases using ARP (cont’d)
1515Kyung Hee University
Example 1Example 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
1616Kyung Hee University
Example 1 (cont’d)Example 1 (cont’d)
1717Kyung Hee University
Proxy ARPProxy 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
1818Kyung Hee University
7.2 ARP Package7.2 ARP Package
1919Kyung Hee University
ARP Design (cont’d)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
2020Kyung Hee University
ARP Design (cont’d)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
2121Kyung Hee University
ARP Design (cont’d)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. Extract the value of the hardware address from the entry
2. Send the packet and the hardware address to data link layer
3. Return
2. If (the state is PENDING)
1. Enqueue the packet to the corresponding queue
2. Return
4. 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
5. Return
2222Kyung Hee University
ARP Design (cont’d)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
2323Kyung Hee University
ARP Design (cont’d)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. Update the entry ( to RESOLVED)
2. While the queue is not empty1. Dequeue one packet
2. Send the packet and the hardware address to date link
2. If (the state is RESOLVED) // hardware address could have been changed
1. Update the entry
4. If (not found)
1. Create an entry
2. Add the entry to the table
5. If (the packet is a request)
1. Send an ARP reply
6. Return
2424Kyung Hee University
ARP Design (cont’d)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
2525Kyung Hee University
ARP Design (cont’d)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)
1. Increment the value of attempts by 1.2. If(attempts greater than maximum)
1. Change the state to FREE2. Destroy the corresponding queue.
3. If(not)1. Send an ARP request.
4. Continue.3. If (the state is RESOLVED)
1. Decrement the value of time-out by the value of 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.
2626Kyung Hee University
Examples of ARPExamples 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
The beginning cache table
2727Kyung Hee University
Examples of ARPExamples of ARPExample3
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
2828Kyung Hee University
Examples of ARPExamples of ARPExample 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
2929Kyung Hee University
Example of ARPExample 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
3030Kyung Hee University
Example of ARPExample of ARP
3131Kyung Hee University
7.3 RARP7.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.
3232Kyung Hee University
RARP (cont’d)RARP (cont’d)
3333Kyung Hee University
RARP (cont’d)RARP (cont’d) Packet Format
3434Kyung Hee University
RARP (cont’d)RARP (cont’d)
Encapsulation of RARP packet