Chapter 5

advertisement
Mapping Internet
Addresses to Physical
Addresses (ARP)
Chapter 5
Each host has 32-bit address (IP address)

Internet uses only assigned addresses for packet
sending and receiving
Two machines can communicate only if
they know each other’s physical address
How does host (or router) map an IP
address to a correct physical address??
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
IA
IB
PA
PB
What if A only has B’s IP address? How
does A map this to B’s physical address?
Address mapping must occur at each
step along a path as well
In general, two cases:

Case 1:
Last step in delivering a packet
Last computer must map final destination’s internet
address to the destination’s physical address

Case 2:
Any point along the path when sending to intermediate
router
Sender must map intermediate router’s internet
address to a physical address
Two basic types of physical addresses:

proNET
Small, easily configurable physical addresses
Address resolution is easy

Ethernet
Large, fixed physical addresses
Address resolution is hard
Direct Mapping Resolution
Consider a proNET token ring


Uses small integers for physical addresses
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, …
When installing interface card, select
physical address of 1, 2, 3, …
IP 192.5.48.3 get physical address 3
Mapping is easy

Just extract host portion of IP address
Conceptually, select a function f that maps
IP addresses to physical addresses


Resolving IP address IA means computing
PA = f (IA )
Want computation as efficient as possible
Dynamic Binding Resolution
Consider an Ethernet



Each interface has a 48-bit physical address
Interface fails, address changes
48-bits can’t be encoded into 32-bit IP addresses
Use Address Resolution Protocol (ARP)


Host sends packet requesting intended
destination to respond with its physical address
All receive; destination recognizes its IP address
and responds
ARP:



allows a host to find the physical address
of a target on the same physical network
given only the target’s IP address
Why not just send the packet?


The request for address is broadcast
Too expensive to broadcast every packet
All machines must process the packet
ARP Cache
Maintain a cache of recently acquired pairs

Keep IP, PhyAddr pairs to reduce comm costs
Looks in cache before sending packet


If have a binding, use it
If not, broadcast an ARP request
Since most communications involve
multiple packets, even a small cache helps
IP Address
Hardware Address
197.15.3.2
0A:07:4B:12:82:36
197.15.3.3
0A:9C:28:71:32:8D
197.15.3.4
0A:11:C3:68:01:99
197.15.3.5
0A:74:59:32:CC:1F
197.15.3.6
0A:04:BC:00:03:28
197.15.3.7
0A:77:81:0E:52:FA
Example Address Binding Table
Soft state


Information becomes stale without warning
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
Responsibility for correctness lies with the
owner of the information
Use timer to periodically delete old bindings



Typical timeout is 20 minutes (since set)
Information must be removed
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 not, sender will know
Advantage of soft state is autonomy



Computer knows to revalidate bindings
independent of other computers
Sender does not need communication with
anyone to invalidate a binding
No reliance on network hardware for reliable
transfer
Disadvantage is delay

Time to detect a crash is potentially as large
as the timeout window
Refinements to ARP
Include own binding when send a request


Queried machine updates its ARP cache
All machines can update as well
After a crash, send out an ARP request as
part of the booting process
ARP is only one scheme for mapping



Some network technologies don’t need it
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)
ARP Implementation
Divided into two functional parts


Mapping IP address to physical address
Answering requests
Mapping


If have binding in cache, use it
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

When ARP reply arrives
Update ARP cache
Remove packet(s) from queue
 May have been packets from other
applications
Send
Answering requests

First extract sender’s binding
If cache entry exists, update it

Next, process the packet
If target of request, then answer
If not target, ignore rest of packet
ARP Encapsulation
ARP messages travel in data portion of a frame
Sender assigns special type value in header
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
Format is general enough to be used with
arbitrary physical addresses and arbitrary
protocol addresses
Example ARP message format for Ethernet
0
8
16
24
31
Hardware Type
Protocol Type
HLEN
PLEN
Operation
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)
Automatic Cache Revalidation
Jitter


Variance in packet transfer times
ARP timer expires; next datagram has extra delay
Automatic revalidation


Use a second (revalidation) timer for each entry
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
Reverse ARP (RARP)
Operation field can specify Reverse ARP

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 requester’s IP address
RARP no longer used

At one time was essential for computers without
stable storage (see DHCP, Chap. 22)
Summary
IP addresses are independent of physical
addresses
To send packets, must do mapping
Direct mapping

If physical addresses smaller than IP addresses
Dynamic mapping

ARP performs dynamic address resolution


ARP broadcast finds physical addresses
All machines receive ARP broadcast
If IP address matches machine’s, answer request
Replies directed to one machine only (not
broadcast)

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
Now obsolete
Download