address resolution protocol (arp). mapping ip address to data-link address how does a machine map...

21
Address Resolution Protocol (ARP)

Post on 22-Dec-2015

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Address Resolution Protocol (ARP)

Page 2: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Mapping IP Address to Data-Link Address

How does a machine map an IP address to its Data-Link layer (hardware or MAC) address?

This is needed by the source host A who needs to send an IP packet to another host B if B is on same IP network as A, address frame to B.

Thus, DL-Address of B is needed. if B on a separate network, address frame to a

router. Thus, DL-Address of router is needed. ARP is also used by routers (See next slide)

Page 3: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Four cases using ARP

Page 4: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Address Resolution Some protocol suites adopt one of the following:

Keep mapping tables in each machine Hardware (physical) addresses are encoded in the

high level addresses Both are ad-hoc, awkward solutions

Page 5: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Resolution Through Dynamic Binding

Ethernet uses 48-bit physical addresses Addresses assigned by manufacturers Replacing a faulty interface card meant a change

to the machine physical address Can’t encode 48-bit long address into a 32-bit long IP

address TCP/IP solution: Address Resolution Protocol (ARP)

Page 6: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP Exploits broadcast capability of Ethernet Allows a host to find the Ethernet address of a

target host on the same network, given the target’s IP address

Allows machines to be added or removed with no code recompilation

Builds and maintains dynamically a table to translate IP addresses into Ethernet physical addresses

Page 7: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP operation

Page 8: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP (contd.) Hosts that use ARP maintain a small cache of

recently acquired (IP,Hardware) address bindings Cache is updated dynamically

Timer for each entry Whenever a new binding is received, update the

corresponding table entry and reset the associated timer

ARP is a low level protocol that hides the underlying network physical addressing, permitting us to assign IP addresses of our choosing to every machine

Page 9: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP (contd.) We think of it as part of the physical network and not

as part of the internet protocols Functionally ARP is divided in two parts

One part that determines physical address of the destination of the outgoing packet

One part answers requests from other machines

Page 10: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP Implementation (contd.)

Address resolution of outgoing packet IF dest. IP address is in cache THEN

Get corresponding physical address Construct an Ethernet frame

Else Broadcast an ARP request Wait for an ARP reply

Page 11: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP Implementation (contd.)

Two types of incoming ARP packets A Request

IF this machine is the target of ARP Request THEN Generate ARP Reply and send it to requester

ELSE Ignore the request A Reply

Determine if we need to create a cache entry or update existing entry

Match Reply with initial Request

Page 12: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP Encapsulation in Ethernet Frame

Eth. DA (Ethernet Destination Address) :

For ARP Request it is set to FF FF FF FF FF FF

Page 13: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP Packet Format (contd.)

80 16 24 31

Hardware Type Protocol Type

HALEN PALENOperation (1/2: ARP-Req,/Rep,

3/4: RARP-Req/Rep)

SENDER HA (Bytes 0-3)

SENDER HA (Bytes 4-5) SENDER IP (Bytes 0-1)

SENDER IP (Bytes 2-3) TARGET HA (Bytes 0-1)

TARGET HA (Bytes 2-5)

TARGET IP (Bytes 0-3)

(0x0001: Ethernet) (0x0800: IP)

Page 14: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

ARP Packet Format To allow ARP to be used with a variety of network

technologies, header of ARP messages does not have a fixed format First fields in the header specify the length of

succeeding fields On Ethernet, 28-octet ARP message format is used

Page 15: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

A host with IP address 130.23.43.20 and physical address B2:34:55:10:22:10 has a packet to send to another host with IP address 130.23.43.25 and physical address A4:6E:F4:59:83:AB. The two hosts are on the same Ethernet network. Show the ARP request and reply packets encapsulated in Ethernet frames.SolutionFigure shows the ARP request and reply packets. Note that the ARP data field in this case is 28 bytes, and that the individual addresses do not fit in the 4-byte boundary. That is why we do not show the regular 4-byte boundaries for these addresses.

Example

Page 16: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

an ARP request and reply

Page 17: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Additional Notes about ARP Every host that receives the broadcast ARP request

caches the Sender's IP Address/Hardware Address When a station boots it sends a broadcast ARP

request with target IP address matching its own

This enables other hosts to cache the sender's info. If the station gets a reply, it knows that its IP address is

used by some other host and thus we know of duplicate IP addresses

Page 18: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Determining an IP Address at Startup

Diskless machines use IP addresses to communicate with the file server

Also, many diskless machines use TCP/IP FTP protocols to obtain their initial boot image, thus requiring that they obtain and use IP addresses

Designers keep both the bootstrap code and initial OS images free from specific IP addresses for portability

Page 19: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Determining IP Address at Startup (contd.)

How does a diskless machine determine its IP address?

When bootstrap code starts execution on a diskless machine, it must use the network to contact a server to obtain the machine’s IP address

Usually, a machine’s IP address is kept on disk where OS finds it at startup

Page 20: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

Reverse Address Resolution Protocol (RARP)

RARP is the protocol used to solve the reverse problem solved by ARP Given a physical address, get the corresponding

IP address RARP uses the same message format as ARP RARP messages are sent encapsulated in Ethernet

frames These days, DHCP (Dynamic Host Configuration

Protocol) is a newer protocol that is used as a replacement for RARP. Thus, we can say that DHCP has rendered RARP (but not ARP) obsolete

Page 21: Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or

RARP (contd.)

DAYX C

RARP_Request RARP_Replies

RARP Server