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
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)
ARP and RARP • ARP (address resolution protocol) • RARP (reverse address resolution protocol)
ARP Operation (cont’d) • An ARP request isbroadcast; an ARP reply is unicast
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
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
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 bytes long • 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
Encapsulation of ARP Packet • encapsulated directly into a data link frame • ARP packet encapsulated in an Ethernet frame
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.
Example 1 • A host with IP address 184.108.40.206 and physical address 0xB23455102210 has a packet to send to another host with IP address 220.127.116.11 and physical address 0xA46EF45983AB. The two hosts are on the same Ethernet network. Show the ARP request and reply packets encapsulated in Ethernet frames
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
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
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
ARP Design (cont’d) Output module • Sleep until an IP packet is received from IP software • Check the cache table to find an entry corresponding to this IP packet • If (found) • If (the state is RESOLVED) • Extract the value of the hardware address from the entry • Send the packet and the hardware address to data link layer • Return • If (the state is PENDING) • Enqueue the packet to the corresponding queue • Return • If (not found) • Create a queue • Enqueue the packet • Create a cache entry with state set to PENDING and ATTEMPTS set to 1 • Send an ARP request • Return
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
ARP Design (cont’d) Input Module • Sleep until an ARP packet (request or reply) arrives • Check the cache to find an entry corresponding to the this ARP packet • If (found) • If (the state is PENDING) • Update the entry ( to RESOLVED) • While the queue is not empty • Dequeue one packet • Send the packet and the hardware address to date link • If (the state is RESOLVED) // hardware address could have been changed • Update the entry • If (not found) • Create an entry • Add the entry to the table • If (the packet is a request) • Send an ARP reply • Return
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
ARP Design (cont’d) Cache-control module • Sleep until the periodic timer matures. • For every entry in the cache table • If (the state is Free) • Continue. • If (the state is PENDING) • Increment the value of attempts by 1. • If(attempts greater than maximum) • Change the state to FREE • Destroy the corresponding queue. • If(not) • Send an ARP request. • Continue. • If (the state is RESOLVED) • Decrement the value of time-out by the value of elapsed time. • If(time-out less than or equal to zero) • Change the state to FREE. • Destroy the corresponding queue • Return.
Examples of ARP The beginning cache table Example 2 1) ARP output module receives an IP datagram (from IP layer) with the destination address 18.104.22.168. 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
Examples of ARP Example3 1)Twenty seconds later, the ARP out module receives an IP datagram with destination address with 22.214.171.124 and creates a new queue 2) Send an ARP request to the data link layer
Examples of ARP Example 4 • Fifteen seconds layer, ARP input module receives an ARP packet with target protocol (IP) address 126.96.36.199. • Change the state to RESOLVED, and time-out value to 900 and add the target hardware address • Access queue 18 and send all the packets in this queue to the data link layer
Example of ARP 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 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 field is incremented by one. - An entry having more than the maximum is deleted.
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.
RARP (cont’d) • Packet Format
RARP (cont’d) • Encapsulation of RARP packet
Summary (1) • Delivery of a packet to a host or router requires two levels of addresses : logical and physical. • A logical address identifies a host or router at the network level. TCP/IP calls this logical address an IP address. • A physical address identifies a host or router at the physical level. • Mapping of a logical address to a physical address can be static or dynamic. • Static mapping involves a list of logical and physical address correspondences, maintenance of the list requires high overhead. • The address resolution protocol(ARP) is a dynamic mapping method that finds a physical address given a logical address. • An ARP request is broadcast to all devices on the network. • An ARP reply is unicast to the host requesting the mapping.
Summary (2) • In proxy ARP, a router represents a set of hosts. When an ARP request seeks the physical address of any host in this set, the router sends its own physical address. This creates a subnetting effect. • The ARP software package consists of five components: a cache table, queues, an output module, an input module, and a cache-control module. • The cache table has an array of entries used and updated by ARP messages. • A queue contains packets going to the same destination. • The output module takes a packet from the IP layer and sends it either to the data link layer or to a queue. • The input module uses an ARP packet to update the cache table. The input module can also send an ARP reply. • The cache-control module maintains the cache table by updating entry fields. • Reverse address resolution protocol (RARP) is a form of dynamic mapping in which a given physical address is associated with a logical address.