1
Address Resolution Protocol
(ARP)
Relates to Lab 2.
This module is about the address resolution protocol.
2Network
Layer
Link Layer
IP
ARP
Network
Access
RARP
Media
ICMP IGMP
Transport
Layer
TCP UDP
Overview
3
IP and LAN addresses
•The Internet is based on 32bit IP addresses
•Applications only deal with IP addresses
•But all Internet devices connect to a physical link via
hardware-Network Interface Card (NIC), that has an
address.
•Data link protocols (Ethernet, Frame Relay) have different
addresses
Nature of MAC addresses
•Hardare address allocation administered by IEEE
•Manufacturer buys portion of hardware address space (to
assure uniqueness)
•Analogy of Internet Addresses:
Hardware address: like Social Security Number
IP address: like postal address
Hardware: flat address ➜portable
assigned once, un-chageable, goes with you, move from
one physical location to another it doesn’t change
•IP: hierarchical address -> notportable
address assigned based on physical location, i.e., IP
subnet to which device is attached, changes when you
move from one network to another 4
IP and MAC Addresses
5
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
LAN
137.196.7.23
137.196.7.78
137.196.7.14
137.196.7.88
71-65-F7-2B-08-53
•IP addresses are “generally” known –i.e., application can find
it in DNS database.
•How do we find a device’s hardwareaddress?
•Use a ”dynamic binding” procedure -an address resolution
processthat finds hardware address for an IP address.
Address Resolution Protocol -ARP
•Standard for dynamic address resolution in the Internet
•The ARP protocol performs the translation between 32 bit IP
addresses and link layer addresses to reach the physical
location of a device on the same “single segment” network
(i.e., all devices that have same IP network prefix)
–Physical address burned in NIC ROM, sometimes software settable
or firmware.
–Example of an address on an Ethernet link (48bits):
•1A-2F-BB-76-09-AD
•hexadecimal (base 16) notation (each “number”represents 4 bits)
•Isolates hardware address at low level
•Allows application programs to use IP addresses
6
ARP Description
•Allows device A to find device B’s hardware address
•Technique: broadcast query and obtain unicast response
•Query: sent as a “hardware” broadcast (link layer broadcast)
–limited broadcast: ARP only used to map addresses within a single
physical/segment network, never across multiple (IP) networks
–Query contains A’s hardware address and B’s IP address
•Response: sent as a unicast to A’s hardware address
–contains B’s hardware address
7
ARP Operation
•A wants to send datagram to B
–A starts with B’s IP address
–A knows B is on the local network (resolved by A using network prefix)
•A broadcastsARP query packet, containing B's IP address
–dest address in Ethernet frame = FF-FF-FF-FF-FF-FF
–source address in Ethernet frame = A’s hardware address
–all nodes on data link/single segment network, receive ARP query
–Query (ARP packet) contains A’s hardware address and B’s IP
address
•B receives A’s ARP query packet, recognizes its IP address,
replies to A with its (B's) hardware address
–frame sent to A’s hardware address (unicast) containing B’s hardware
address
8
9
ARP Packet FormatDestination
address
6
ARP Request or ARP Reply
28
Source
address
6 2
CRC
4
Type
0x8060
Padding
10
Ethernet II header Hardware type (2 bytes)
Hardware address
length (1 byte)
Protocol address
length (1 byte)
Operation code (2 bytes)
Target hardware address*
Protocol type (2 bytes)
Source hardware address*
Source protocol address*
Target protocol address*
* Note: The length of the address fields is determined by the corresponding address length fields
18
ARP Packet Format
•General: can be used with
–Arbitrary hardware address (not just Ethernet)
–Arbitrary protocol address (not just IP)
•Variable length address fields (depends on type of datalink
protocol)
10
11
Address Translation with ARP
ARP Request:
Argon broadcasts an ARP request to all stations on the
network: “What is the hardware address of
128.143.137.1?”Argon
128.143.137.144
00:a0:24:71:e4:44
Router137
128.143.137.1
00:e0:f9:23:a8:20
ARP Request:
What is the MAC address
of 128.143.71.1?
128.143.137.1?
12
Address Translation with ARP
ARP Reply:
Router 137 responds with an ARP Reply which contains the
hardware addressArgon
128.143.137.144
00:a0:24:71:e4:44
Router137
128.143.137.1
00:e0:f9:23:a8:20
ARP Reply:
The MAC address of 128.143.71.1
is 00:e0:f9:23:a8:20
128.143.137.1?
Retention of Bindings
•Sending an ARP request/reply for each IP datagram (to same
IP address) is inefficient.
•Solution -> maintain a table of bindings
–devices maintain a cache of currently used IP addresses and their
corresponding hardware addresses.
•A device caches IP-to-hardware address pairs in a table until
information becomes old (times out)
–Soft state: information times out (goes away) unless refreshed (i.e.,
everytime an IP address is looked up in the table)
–The entries expire after X minutes. Initially X=20, but because of
mobility, it is now very short, sometimes just 30secs.
•Effect
–Use ARP one time, place results in table, then quick lookup many
times (every packet sent to that same IP address)
14
Note on Bindings
•If A ARPs B, B keepsA’s information
–B will probably send a packet to A soon
•If A ARPs B, A keepsB’s information
–A will probably send more packets to B
•Other machines do not keep A’s information (even though
they all see the broadcast with A’s information)
–Avoids clogging ARP caches needlessly
15
16
ARP Cache (table)
•Contents of the ARP Cache:
(128.143.71.37) at 00:10:4B:C5:D1:15 [ether] on eth0
(128.143.71.36) at 00:B0:D0:E1:17:D5 [ether] on eth0
(128.143.71.35) at 00:B0:D0:DE:70:E6 [ether] on eth0
(128.143.136.90) at 00:05:3C:06:27:35 [ether] on eth1
(128.143.71.34) at 00:B0:D0:E1:17:DB [ether] on eth0
(128.143.71.33) at 00:B0:D0:E1:17:DF [ether] on eth0
•ARP is “plug-and-play”:
–nodes create their ARP tables without intervention from net
administrator
17
Things to know about ARP
•What happens if an ARP Request is made for a non-existing
host?
Several ARP requests are made with increasing time
intervals between requests. Eventually, ARP gives up.
•What if a host sends an ARP request for its own IP address?
Know as gratuitous ARP
No response hopefully
This is useful for detecting if an IP address has already
been assigned (via DHCP).
18
ARP in our Example
•Argon realizes that it needs to use router to reach Neon as the two hosts are on
different IPnetworks.
•Argon sends an ARP Request to the router for MAC address of NIC corresponding
to IP address of router on the commonnetwork.
•Router sends ARP Response to host Argon with MAC address corresponding to
the IP address of its NICon that connected network.
Router IP Address
Router MAC address
128.143.137.1?
128.143.137.1 is
128.143.137.0/24
128.143.71.21/24
128.143.137.144/24
128.143.137.1/24
Proxy Arp
•Allow devices on two different IP subnetworks to share a
single IP network prefix
–Source believes destination is on same IP network
•Setup routerto respond to ARP broadcast requests for
destinations on different connectedsubnet
–router masqueradesas destination for ARP request sent by source on
a subnet
–the two devices are unaware that they are on different subnets, subnet
mask indicates that they have the same network prefix.
•Masquerades: router respondsto broadcast ARP Request
from source host that arrives on oneof its connected
networksfor a destination host that is on oneof itsother
connected networks.
19
20
Proxy ARP Operation in Our Example with Argon
having /16 as its network prefix
•Router respondsto broadcast ARP Request from host Argon that arrives on oneof its
connected networksfor host Neon that is on oneof itsotherconnected networks.
•Host Argon believes Neon is on the same IP network because of its ”prefix” /16.
–Argon sees it is on IP network 128.143.0.0. When applying prefix /16 to Neon’s IP
address 128.143.71.21 --> 128.143.0.0, which is the same as its own.so it sends a
broadcast ARP request for Neon.
•Router responds with its MAC address and then transfers the datagram to the next segment.
NeonIP Address
Router MAC address
128.143.71.21/24
128.143.137.0/24
128.143.137.1/24
ARP Cache in two Examples
•Non Proxy ARP:
–A’s ARP cache
(128.143.137.1) at 00:e0:f9:23:a8:20 [ether] on eth0
•Proxy ARP:
–A’s ARP cache
(128.143.71.21) at 00:e0:f9:23:a8:20 [ether] on eth0
21
ARP Transport
•ARP message travels in data portion of data link layer frame
•We say ARP message is encapsulated
•Data area padded with zeroes if ARP message is shorter than
minimum data link layer frame
•For Ethernet: frame type field 0x0806 used for ARP
22