Mapping Internet Mapping Internet Addresses to Addresses to Physical Addresses Physical Addresses (ARP) (ARP) Chapter 5 Chapter 5
Transcript
Slide 1
Mapping Internet Addresses to Physical Addresses (ARP) Chapter
5
Slide 2
Each host has 32-bit address (IP address) Internet uses only
assigned addresses for packet sending and receiving Internet uses
only assigned addresses for packet sending and receiving Two
machines can communicate only if they know each others physical
address How does host (or router) map an IP address to a correct
physical address??
Slide 3
Address Resolution Problem Refers to problem of mapping
high-level addresses to physical addresses Suppose two machines A
and B are connected to the same physical network
A------------------------------------B I A I B I A I B P A P B P A
P B What if A only has Bs IP address? How does A map this to Bs
physical address?
Slide 4
Address mapping must occur at each step along a path as well In
general, two cases: Case 1: Case 1: Last step in delivering a
packet Last computer must map final destinations internet address
to the destinations physical address Case 2: Case 2: Any point
along the path when sending to intermediate router Sender must map
intermediate routers internet address to a physical address
Slide 5
Two basic types of physical addresses: proNET proNET Small,
easily configurable physical addresses Address resolution is easy
Ethernet Ethernet Large, fixed physical addresses Address
resolution is hard
Slide 6
Direct Mapping Resolution Consider a proNET token ring Uses
small integers for physical addresses Uses small integers for
physical addresses Allows user to choose hardware address Allows
user to choose hardware address Make address resolution easy by
making part of the IP & physical address the same Assign IP
addresses with hostid portion equal to 1, 2, 3, Assign IP addresses
with hostid portion equal to 1, 2, 3, When installing interface
card, select physical address of 1, 2, 3, When installing interface
card, select physical address of 1, 2, 3, IP 192.5.48.3 get
physical address 3
Slide 7
Mapping is easy Just extract host portion of IP address Just
extract host portion of IP address Conceptually, select a function
f that maps IP addresses to physical addresses Resolving IP address
I A means computing Resolving IP address I A means computing P A =
f (I A ) Want computation as efficient as possible Want computation
as efficient as possible
Slide 8
Dynamic Binding Resolution Consider an Ethernet Each interface
has a 48-bit physical address Each interface has a 48-bit physical
address Interface fails, address changes Interface fails, address
changes 48-bits cant be encoded into 32-bit IP addresses 48-bits
cant be encoded into 32-bit IP addresses Use Address Resolution
Protocol (ARP) Host sends packet requesting intended destination to
respond with its physical address Host sends packet requesting
intended destination to respond with its physical address All
receive; destination recognizes its IP address and responds All
receive; destination recognizes its IP address and responds
Slide 9
Slide 10
ARP: allows a host to find the physical address allows a host
to find the physical address of a target on the same physical
network of a target on the same physical network given only the
targets IP address given only the targets IP address Why not just
send the packet? The request for address is broadcast The request
for address is broadcast Too expensive to broadcast every packet
Too expensive to broadcast every packet All machines must process
the packet
Slide 11
ARP Cache Maintain a cache of recently acquired pairs Keep IP,
PhyAddr pairs to reduce comm costs Keep IP, PhyAddr pairs to reduce
comm costs Looks in cache before sending packet If have a binding,
use it If have a binding, use it If not, broadcast an ARP request
If not, broadcast an ARP request Since most communications involve
multiple packets, even a small cache helps
Slide 12
IP Address Hardware Address 197.15.3.20A:07:4B:12:82:36
197.15.3.30A:9C:28:71:32:8D 197.15.3.40A:11:C3:68:01:99
197.15.3.50A:74:59:32:CC:1F 197.15.3.60A:04:BC:00:03:28
197.15.3.70A:77:81:0E:52:FA Example Address Binding Table
Slide 13
Soft state Information becomes stale without warning
Information becomes stale without warning Example: Example:
Computer A gets binding for computer B B then crashes A does not
get notified A continues to send packets to B Ethernet does not
have guaranteed delivery! No way of knowing ARP cache is wrong
Slide 14
Responsibility for correctness lies with the owner of the
information Use timer to periodically delete old bindings Typical
timeout is 20 minutes (since set) Typical timeout is 20 minutes
(since set) Information must be removed Information must be removed
Two cases then: Two cases then: 1) If no more packets, nothing
happens 2) If have more packets, do another ARP broadcast If
destination reachable, will get new binding If destination
reachable, will get new binding If not, sender will know If not,
sender will know
Slide 15
Advantage of soft state is autonomy Computer knows to
revalidate bindings independent of other computers Computer knows
to revalidate bindings independent of other computers Sender does
not need communication with anyone to invalidate a binding Sender
does not need communication with anyone to invalidate a binding No
reliance on network hardware for reliable transfer No reliance on
network hardware for reliable transfer Disadvantage is delay Time
to detect a crash is potentially as large as the timeout window
Time to detect a crash is potentially as large as the timeout
window
Slide 16
Refinements to ARP Include own binding when send a request
Queried machine updates its ARP cache Queried machine updates its
ARP cache All machines can update as well All machines can update
as well After a crash, send out an ARP request as part of the
booting process
Slide 17
ARP is only one scheme for mapping Some network technologies
dont need it Some network technologies dont need it Really imposes
new address scheme on to of lower-level hardware address mechanism
Really imposes new address scheme on to of lower-level hardware
address mechanism Think of ARP as part of physical network system
(vs part of internet protocols) Think of ARP as part of physical
network system (vs part of internet protocols)
Slide 18
ARP Implementation Divided into two functional parts Mapping IP
address to physical address Mapping IP address to physical address
Answering requests Answering requestsMapping If have binding in
cache, use it If have binding in cache, use it If not, send
broadcast If not, send broadcast May not get reply (lost or machine
down) Must store outgoing packets If other programs run, must not
generate multiple requests for the same address currently waiting
on
Slide 19
When ARP reply arrives When ARP reply arrives Update ARP cache
Remove packet(s) from queue May have been packets from other
applications May have been packets from other applicationsSend
Slide 20
Answering requests First extract senders binding First extract
senders binding If cache entry exists, update it Next, process the
packet Next, process the packet If target of request, then answer
If not target, ignore rest of packet
Slide 21
ARP Encapsulation ARP messages travel in data portion of a
frame Sender assigns special type value in header
Slide 22
ARP Protocol Format ARP packets do not have fixed format header
Length of fields with addresses depend on the type of network
Header includes fixed fields near beginning Header includes fixed
fields near beginning Format is general enough to be used with
arbitrary physical addresses and arbitrary protocol addresses
Format is general enough to be used with arbitrary physical
addresses and arbitrary protocol addresses
Slide 23
Example ARP message format for Ethernet 0 8 16 24 31 Hardware
Type Protocol Type HLENPLENOperation Sender HA (octets 0-3) Sender
HA (octets 4-5) Sender IP (octets 0-1) Sender IP (octets 2-3)
Target HA (octets 0-1) Target HA (octets 2-5) Target IP (octets
0-3)
Slide 24
Automatic Cache Revalidation Jitter Variance in packet transfer
times Variance in packet transfer times ARP timer expires; next
datagram has extra delay ARP timer expires; next datagram has extra
delay Automatic revalidation Use a second (revalidation) timer for
each entry Use a second (revalidation) timer for each entry Goes
off early; sends ARP request Goes off early; sends ARP request Can
still use ARP cache entry If station replies, both timers reset If
no reply, act as normal when traditional timer expires
Slide 25
Reverse ARP (RARP) Operation field can specify Reverse ARP
Allows system to obtain its IP address at startup Allows system to
obtain its IP address at startup Computer can know its hardware
address, but perhaps not its IP address (ex.: diskless systems)
When booting, system broadcasts a RARP request RARP server has to
be configured and listening RARP server sends reply giving
requesters IP address RARP no longer used At one time was essential
for computers without stable storage (see DHCP, Chap. 22) At one
time was essential for computers without stable storage (see DHCP,
Chap. 22)
Slide 26
Summary IP addresses are independent of physical addresses To
send packets, must do mapping Direct mapping If physical addresses
smaller than IP addresses If physical addresses smaller than IP
addresses Dynamic mapping ARP performs dynamic address resolution
ARP performs dynamic address resolution
Slide 27
ARP broadcast finds physical addresses ARP broadcast finds
physical addresses All machines receive ARP broadcast All machines
receive ARP broadcast If IP address matches machines, answer
request Replies directed to one machine only (not broadcast) For
efficiency, bindings are cached For efficiency, bindings are cached
Cache helps eliminate many broadcast Early revalidation can be used
to avoid jitter RARP Could be used to obtain IP address at startup
Could be used to obtain IP address at startup Now obsolete Now
obsolete