Mapping Internet Addresses to Physical Addresses (ARP)

27
Mapping Internet Mapping Internet Addresses to Addresses to Physical Addresses Physical Addresses (ARP) (ARP) Chapter 5 Chapter 5

description

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 - PowerPoint PPT Presentation

Transcript of Mapping Internet Addresses to Physical Addresses (ARP)

Page 1: Mapping Internet Addresses to Physical Addresses (ARP)

Mapping Internet Mapping Internet Addresses to Physical Addresses to Physical

Addresses (ARP)Addresses (ARP)

Chapter 5Chapter 5

Page 2: Mapping Internet Addresses to Physical Addresses (ARP)

Each host has 32-bit address Each host has 32-bit address (IP address)(IP address)

Internet uses only assigned addresses for packet Internet uses only assigned addresses for packet sending and receivingsending and receiving

Two machines can communicate only if Two machines can communicate only if they know each other’s they know each other’s physicalphysical address address

How does host (or router) map an IP How does host (or router) map an IP address to a correct physical address??address to a correct physical address??

Page 3: Mapping Internet Addresses to Physical Addresses (ARP)

Address Resolution ProblemAddress Resolution Problem

Refers to problem of mapping high-level Refers to problem of mapping high-level addresses to physical addressesaddresses to physical addressesSuppose two machines Suppose two machines AA and and BB are are connected to the same physical networkconnected to the same physical network

A------------------------------------BA------------------------------------B

IIAA IIBB

PPAA PPBB

What if A only has B’s IP address? How What if A only has B’s IP address? How does A map this to B’s physical address?does A map this to B’s physical address?

Page 4: Mapping Internet Addresses to Physical Addresses (ARP)

Address mapping must occur at each Address mapping must occur at each step along a path as wellstep along a path as well

In general, two cases:In general, two cases: Case 1:Case 1:

Last step in delivering a packetLast step in delivering a packet

Last computer must map final destination’s internet Last computer must map final destination’s internet address to the destination’s physical addressaddress to the destination’s physical address

Case 2:Case 2:Any point along the path when sending to intermediate Any point along the path when sending to intermediate routerrouter

Sender must map intermediate router’s internet Sender must map intermediate router’s internet address to a physical addressaddress to a physical address

Page 5: Mapping Internet Addresses to Physical Addresses (ARP)

Two basic types of physical addresses:Two basic types of physical addresses: proNETproNET

Small, easily configurable physical addressesSmall, easily configurable physical addresses

Address resolution is easyAddress resolution is easy EthernetEthernet

Large, fixed physical addressesLarge, fixed physical addresses

Address resolution is hardAddress resolution is hard

Page 6: Mapping Internet Addresses to Physical Addresses (ARP)

Direct Mapping ResolutionDirect Mapping Resolution

Consider a proNET token ringConsider a proNET token ring Uses small integers for physical addressesUses small integers for physical addresses Allows user to choose hardware addressAllows user to choose hardware address

Make address resolution easy by making Make address resolution easy by making part of the IP & physical address the samepart of the IP & physical address the same Assign IP addresses with hostid portion Assign IP addresses with hostid portion

equal to 1, 2, 3, …equal to 1, 2, 3, … When installing interface card, select When installing interface card, select

physical address of 1, 2, 3, …physical address of 1, 2, 3, …IP 192.5.48.3 get physical address 3IP 192.5.48.3 get physical address 3

Page 7: Mapping Internet Addresses to Physical Addresses (ARP)

Mapping is easyMapping is easy Just extract host portion of IP addressJust extract host portion of IP address

Conceptually, select a function Conceptually, select a function ff that maps that maps IP addresses to physical addressesIP addresses to physical addresses Resolving IP address Resolving IP address IIAA means computingmeans computing

PPAA = f = f ((IIAA )) Want computation as efficient as possibleWant computation as efficient as possible

Page 8: Mapping Internet Addresses to Physical Addresses (ARP)

Dynamic Binding ResolutionDynamic Binding Resolution

Consider an EthernetConsider an Ethernet Each interface has a 48-bit physical addressEach interface has a 48-bit physical address Interface fails, address changesInterface fails, address changes 48-bits can’t be encoded into 32-bit IP addresses48-bits can’t be encoded into 32-bit IP addresses

Use Address Resolution Protocol (ARP)Use Address Resolution Protocol (ARP) Host sends packet requesting intended Host sends packet requesting intended

destination to respond with its physical addressdestination to respond with its physical address All receive; destination recognizes its IP address All receive; destination recognizes its IP address

and respondsand responds

Page 9: Mapping Internet Addresses to Physical Addresses (ARP)
Page 10: Mapping Internet Addresses to Physical Addresses (ARP)

ARP:ARP: allows a host to find the physical addressallows a host to find the physical address of a target of a target on the same physical networkon the same physical network given only the target’s IP addressgiven only the target’s IP address

Why not just send the packet?Why not just send the packet? The request for address is broadcastThe request for address is broadcast Too expensive to broadcast every packetToo expensive to broadcast every packet

All machines must process the packetAll machines must process the packet

Page 11: Mapping Internet Addresses to Physical Addresses (ARP)

ARP CacheARP Cache

Maintain a cache of recently acquired pairsMaintain a cache of recently acquired pairs Keep IP, PhyAddr pairs to reduce comm costsKeep IP, PhyAddr pairs to reduce comm costs

Looks in cache before sending packetLooks in cache before sending packet If have a binding, use itIf have a binding, use it If not, broadcast an ARP requestIf not, broadcast an ARP request

Since most communications involve Since most communications involve multiple packets, even a small cache helpsmultiple packets, even a small cache helps

Page 12: Mapping Internet Addresses to Physical Addresses (ARP)

IP AddressIP Address Hardware AddressHardware Address

197.15.3.2197.15.3.2 0A:07:4B:12:82:360A:07:4B:12:82:36

197.15.3.3197.15.3.3 0A:9C:28:71:32:8D0A:9C:28:71:32:8D

197.15.3.4197.15.3.4 0A:11:C3:68:01:990A:11:C3:68:01:99

197.15.3.5197.15.3.5 0A:74:59:32:CC:1F0A:74:59:32:CC:1F

197.15.3.6197.15.3.6 0A:04:BC:00:03:280A:04:BC:00:03:28

197.15.3.7197.15.3.7 0A:77:81:0E:52:FA0A:77:81:0E:52:FA

Example Address Binding Table

Page 13: Mapping Internet Addresses to Physical Addresses (ARP)

Soft stateSoft state Information becomes stale without warningInformation becomes stale without warning Example:Example:

Computer A gets binding for computer BComputer A gets binding for computer B

B then crashesB then crashes

A does not get notifiedA does not get notified

A continues to send packets to BA continues to send packets to B

Ethernet does not have guaranteed delivery!Ethernet does not have guaranteed delivery!

No way of knowing ARP cache is wrongNo way of knowing ARP cache is wrong

Page 14: Mapping Internet Addresses to Physical Addresses (ARP)

Responsibility for correctness lies with the Responsibility for correctness lies with the owner of the informationowner of the information

Use timer to periodically delete old bindingsUse timer to periodically delete old bindings Typical timeout is 20 minutes (since Typical timeout is 20 minutes (since setset)) Information must be removedInformation must be removed Two cases then:Two cases then:

1) If no more packets, nothing happens1) If no more packets, nothing happens

2) If have more packets, do another ARP broadcast2) If have more packets, do another ARP broadcast If destination reachable, will get new bindingIf destination reachable, will get new binding If not, sender will knowIf not, sender will know

Page 15: Mapping Internet Addresses to Physical Addresses (ARP)

Advantage of soft state is autonomyAdvantage of soft state is autonomy Computer knows to revalidate bindings Computer knows to revalidate bindings

independent of other computersindependent of other computers Sender does not need communication with Sender does not need communication with

anyone to invalidate a bindinganyone to invalidate a binding No reliance on network hardware for reliable No reliance on network hardware for reliable

transfertransfer

Disadvantage is delayDisadvantage is delay Time to detect a crash is potentially as large Time to detect a crash is potentially as large

as the timeout windowas the timeout window

Page 16: Mapping Internet Addresses to Physical Addresses (ARP)

Refinements to ARPRefinements to ARP

Include own binding when send a requestInclude own binding when send a request Queried machine updates its ARP cacheQueried machine updates its ARP cache All machines can update as wellAll machines can update as well

After a crash, send out an ARP request as After a crash, send out an ARP request as part of the booting processpart of the booting process

Page 17: Mapping Internet Addresses to Physical Addresses (ARP)

ARP is only one scheme for mappingARP is only one scheme for mapping Some network technologies don’t need itSome network technologies don’t need it Really imposes new address scheme on to of Really imposes new address scheme on to of

lower-level hardware address mechanismlower-level hardware address mechanism Think of ARP as part of physical network Think of ARP as part of physical network

system (vs part of internet protocols)system (vs part of internet protocols)

Page 18: Mapping Internet Addresses to Physical Addresses (ARP)

ARP ImplementationARP Implementation

Divided into two functional partsDivided into two functional parts Mapping IP address to physical addressMapping IP address to physical address Answering requestsAnswering requests

MappingMapping If have binding in cache, use itIf have binding in cache, use it If not, send broadcastIf not, send broadcast

May not get reply (lost or machine down)May not get reply (lost or machine down)Must store outgoing packetsMust store outgoing packetsIf other programs run, must not generate multiple If other programs run, must not generate multiple requests for the same address currently waiting onrequests for the same address currently waiting on

Page 19: Mapping Internet Addresses to Physical Addresses (ARP)

When ARP reply arrivesWhen ARP reply arrivesUpdate ARP cacheUpdate ARP cache

Remove packet(s) from queueRemove packet(s) from queue May have been packets from other May have been packets from other

applicationsapplications

SendSend

Page 20: Mapping Internet Addresses to Physical Addresses (ARP)

Answering requestsAnswering requests First extract sender’s bindingFirst extract sender’s binding

If cache entry exists, update itIf cache entry exists, update it Next, process the packetNext, process the packet

If target of request, then answerIf target of request, then answer

If not target, ignore rest of packetIf not target, ignore rest of packet

Page 21: Mapping Internet Addresses to Physical Addresses (ARP)

ARP EncapsulationARP Encapsulation

ARP messages travel in data portion of a frameARP messages travel in data portion of a frame

Sender assigns special type value in headerSender assigns special type value in header

Page 22: Mapping Internet Addresses to Physical Addresses (ARP)

ARP Protocol FormatARP Protocol FormatARP packets do not have fixed format ARP packets do not have fixed format headerheader

Length of fields with addresses depend Length of fields with addresses depend on the type of networkon the type of network Header includes fixed fields near beginningHeader includes fixed fields near beginning Format is general enough to be used with Format is general enough to be used with

arbitrary physical addresses and arbitrary arbitrary physical addresses and arbitrary protocol addressesprotocol addresses

Page 23: Mapping Internet Addresses to Physical Addresses (ARP)

Example ARP message format for EthernetExample ARP message format for Ethernet

0 8 16 24 310 8 16 24 31

Hardware TypeHardware Type Protocol TypeProtocol Type

HLENHLEN PLENPLEN OperationOperation

Sender HA (octets 0-3)Sender HA (octets 0-3)

Sender HA (octets 4-5)Sender HA (octets 4-5) Sender IP (octets 0-1)Sender IP (octets 0-1)

Sender IP (octets 2-3)Sender IP (octets 2-3) Target HA (octets 0-1)Target HA (octets 0-1)

Target HA (octets 2-5)Target HA (octets 2-5)

Target IP (octets 0-3)Target IP (octets 0-3)

Page 24: Mapping Internet Addresses to Physical Addresses (ARP)

Automatic Cache RevalidationAutomatic Cache Revalidation

JitterJitter Variance in packet transfer timesVariance in packet transfer times ARP timer expires; next datagram has extra delayARP timer expires; next datagram has extra delay

Automatic revalidationAutomatic revalidation Use a second (revalidation) timer for each entryUse a second (revalidation) timer for each entry Goes off early; sends ARP request Goes off early; sends ARP request

Can still use ARP cache entryCan still use ARP cache entry

If station replies, both timers resetIf station replies, both timers reset

If no reply, act as normal when traditional timer expiresIf no reply, act as normal when traditional timer expires

Page 25: Mapping Internet Addresses to Physical Addresses (ARP)

Reverse ARP (RARP)Reverse ARP (RARP)

OperationOperation field can specify Reverse ARP field can specify Reverse ARP Allows system to obtain its IP address at startupAllows system to obtain its IP address at startup

Computer can know its hardware address, but perhaps Computer can know its hardware address, but perhaps not its IP address (ex.: diskless systems)not its IP address (ex.: diskless systems)

When booting, system broadcasts a RARP requestWhen booting, system broadcasts a RARP request

RARP server has to be configured and listeningRARP server has to be configured and listening

RARP server sends reply giving requester’s IP addressRARP server sends reply giving requester’s IP address

RARP no longer usedRARP no longer used At one time was essential for computers without At one time was essential for computers without

stable storage (see DHCP, Chap. 22)stable storage (see DHCP, Chap. 22)

Page 26: Mapping Internet Addresses to Physical Addresses (ARP)

SummarySummaryIP addresses are independent of physical IP addresses are independent of physical addressesaddresses

To send packets, must do mappingTo send packets, must do mapping

Direct mappingDirect mapping If physical addresses smaller than IP addressesIf physical addresses smaller than IP addresses

Dynamic mappingDynamic mapping ARP performs dynamic address resolutionARP performs dynamic address resolution

Page 27: Mapping Internet Addresses to Physical Addresses (ARP)

ARP broadcast finds physical addressesARP broadcast finds physical addresses All machines receive ARP broadcastAll machines receive ARP broadcast

If IP address matches machine’s, answer requestIf IP address matches machine’s, answer request

Replies directed to one machine only (not Replies directed to one machine only (not broadcast)broadcast)

For efficiency, bindings are cachedFor efficiency, bindings are cachedCache helps eliminate many broadcastCache helps eliminate many broadcast

Early revalidation can be used to avoid jitterEarly revalidation can be used to avoid jitter

RARPRARP Could be used to obtain IP address at startupCould be used to obtain IP address at startup Now obsoleteNow obsolete