220 likes | 325 Views
CSCI 4550/8556 Computer Networks. Comer, Chapter 19: Binding Protocol Addresses (ARP). Introduction. The upper levels of a protocol stack use protocol addresses . The network hardware must use a hardware address for eventual delivery.
E N D
CSCI 4550/8556Computer Networks Comer, Chapter 19: Binding Protocol Addresses (ARP)
Introduction • The upper levels of a protocol stack use protocol addresses . • The network hardware must use a hardware address for eventual delivery. • Protocol addresses must be translated into hardware addresses for delivery; will discuss three methods of achieving this translation.
Address Translation • Upper levels use only protocol addresses to • provide a “virtual network” addressing scheme, and to • hide hardware details. • The address translation occurs at the data link layer: • the upper layer hands down a protocol address of the destination, and • the data link layer translates it into a hardware address for use by hardware layer.
Address Resolution • Finding the hardware address for a protocol address • is called address resolution, because • the data link layer resolves the protocol address to the hardware address. • Resolution is local to a network. • The network component only resolves addresses for other components on same network.
Address Resolution Example • A resolves protocol address for B for protocol messages from an application on A sent to an application on B . • A does not resolve a protocol address for F . • Through the internet layer, A delivers to F by routing through R1 and R2 • A resolves R1 hardware address. • Network layer on A passes packet containing destination protocol address F for delivery to R1 .
Address Resolution Techniques • The association between a protocol address and a hardware address is called a binding . • There are three techniques to finding the binding: • Table lookup • Bindings stored in memory with protocol address as key • Data link layer looks up protocol address to find hardware address • Closed-form computation • Protocol address based on hardware address • Data link layer derives hardware address from protocol address • Dynamic • Network messages used for "just-in-time" resolution • Data link layer sends message requesting hardware address; destination responds with its hardware address
Table Lookup • Use a simple list containing IP address and hardware address for each host on net. • Search on the IP address and extract the corresponding hardware address. • Note that all IP addresses have same prefix; we can save space by dropping the prefix.
Table Lookup (continued) • A sequential search may be prohibitively expensive. • We can use indexing or hashing for faster lookup. • Indexing – use the hostid part of an IP address as a list (array) index. • Hashing – use a hashing function on hostid to generate a list index.
Closed-form Computation • If the hardware technology uses a small, configurable hardware address, the network administrator can choose the hardware address based on the IP address. • Example – the hardware uses a one octet address that can be configured. • Now simply choose hardware address to be hostid . • Thus any host can determine a hardware address as:hardware_address = ip_address & 0xff;
Dynamic Resolution • This technique uses the network to resolve IP addresses! • A message exchange with other computer(s) returns the hardware address to the source of the query. • Two designs: • Server-based – a computer sends a query message to a server to resolve an address. This design requires to users to • know the addresses of a list of servers, or • broadcast to locate the servers. • Distributed - all computers participate; the destination machine provides its hardware address to the host that asked for it.
Dynamic Resolution Techniques • Server-based - centralized, easier to manage, used on non-broadcast media (e.g., ATM). • Distributed - requires no dedicated computers, no administration. • T = table lookup • C = closed form • D = dynamic
ARP • IP uses a distributed resolution technique. • Address Resolution Protocol (ARP) – essentially a part of the TCP/IP protocol suite. • It is a two-part protocol: • A request is sent from the source asking for the hardware address for an IP address. • A reply from the destination provides the hardware address.
ARP Message Exchange • The ARP request message is dropped into a hardware frame and broadcast. • It sses separate protocol type in hardware frame (Ethernet = 0x0806) • The sender inserts the desired IP address into the message and broadcasts it. • Every other computer on the (local) network examines the request. • The computer whose IP address is in the request responds: • It puts its hardware address in the response frame, and • unicasts the frame to the sender. • The original requester can then extract the hardware address and send the desired IP packet to the destination.
ARP Message Contents • Maps protocol address to hardware address . • Both protocol address and hardware address sizes are variable: • Ethernet = 6 octets • IP = 4 octets • ARP can be used for other protocols and hardware types.
ARP Message Format • HARDWARE ADDRESS TYPE = 1 for Ethernet • PROTOCOL ADDRESS TYPE = 0x0800 for IP • OPERATION = 1 for request, 2 for response • Contains both target and sender mappings from protocol address to hardware address • Request sets hardware address of target to 0 • Target can extract hardware address of sender (saving an ARP request) • Target exchanges sender/target in response
Sending an ARP Message • The sender constructs an ARP message. • The ARP message is then carried as data in a hardware frame – this technique is called encapsulation .
Caching ARP Packets • Using ARP for each IP packet adds two packets of overhead for each IP packet. • To minimize this overhead, a computer caches ARP responses, but • flushes cache at system startup time, and • periodically discards old entries. • The cache is searched prior to sending an ARP request.
Identifying ARP Frames • ARP uses a separate frame type. • Ethernet, for example, uses frame type 0x0806.
Processing ARP Messages • The receiver extracts sender's hardware address and updates local ARP table • The receiver checks the type operation - request or response: • If a response: • Adds sender's address to the local cache. • Sends pending IP packet(s). • If a request: • If receiver is the target of the ARP query, it forms the response, and • unicasts the response to the sender, and • the sender's address is added to the local cache. • Note: • Target computers are likely to respond “soon.” • Computers have finite storage for the ARP cache. • Only the target adds sender to cache; others only update their caches if the target is already in the cache.
Layering and Address Resolution • Address resolution (ARP) is a network interface layer function. • Protocol addresses are used in all higher layers. • Address resolution hides the ugly details and allows generality in upper layers.
Summary • Address resolution - translates protocol addresses to hardware addresses • Three techniques • Static - table lookup • Computation - extract a hardware address from a protocol address • Dynamic - use network messages to resolve a protocol address • ARP - TCP/IP protocol for address resolution.