Address Resolution Protocol
(ARP)
Tuan
Address Mapping
Anytime a host or a router has an IP datagram to send to another host or router, it
has the logical (IP) address of the receiver.
But the IP datagram must be encapsulated in a frame to be able to pass through the
physical network.
This means that the sender needs the physical address of the receiver.
A mapping corresponds a logical address to a physical address.
ARP accepts a logical address from the IP protocol, maps the address to the
corresponding physical address and pass it to the data link layer.
When ARP is Used
For two hosts
on the same network and one desires to send a packet to the other
on different networks and must use a gateway/router
For a router that needs to forward a packet
for one host through another router
from one host to the destination host on the same network
Four Cases using ARP
IP and MAC Address
Stations need to know MAC address to communicate.
Hardware MAC address
Ethernet 6 bytes,
Token ring 2 or 6 bytes,
FDDI 2 or 6 bytes.
How does IP address get mapped to MAC address?
Manual configuration by hand is tedious.
Automatic process by ARP.
Types Of Message
There are four types of ARP messages:
ARP request,
ARP reply,
RARP request,
RARP reply.
These are identified by four values in the operation" field of an ARP message.
ARP Layer
TCP
UDP
ICMP
IP
IGMP
ARP
Network
Access
RARP
Media
Transport
Layer
Network
Layer
Link Layer
ARP and RARP
Note:
The Internet is based on IP addresses ,
Data link protocols (Ethernet, FDDI, ATM) may have different (MAC) addresses.
The ARP and RARP protocols perform the translation between
IP addresses and
MAC layer addresses.
Processing of IP packets by Network device drivers
IP Output
Put on IP
input queue
Yes
Yes
IP Input
IP destination = multicast
or broadcast ?
No
IP destination of packet
= local IP address ?
loopback
Driver
Put on IP
input queue
No: get MAC
address with
ARP
Ethernet
Ethernet
Driver
ARP
ARP
Packet
IP datagram
demultiplex
Ethernet Frame
ARP components
Operation of ARP
hostname
resolver
IP addr
(1)
FTP
(2)
TCP
(3)
(5)
(6)
(4)
ARP
(8)
IP
(9)
Ethernet driver
ARP request (Ethernet broadcast)
Ethernet driver
ARP
Ethernet driver
(7)
ARP
IP
TCP
hostname
Establish connection
with IP address
Send IP datagram
to IP address
ARP Packet Format
Ethernet II header
Destination
address
Source
address
Type
0x8060
ARP Request or ARP Reply
28
10
Hardware type (2 bytes)
Hardware address
length (1 byte)
Padding
CRC
4
Protocol type (2 bytes)
Protocol address
length (1 byte)
Operation code (2 bytes)
Source hardware address*
Source protocol address*
Target hardware address*
Target protocol address*
* Note: The length of the address fields is determined by the corresponding address length fields
ARP Packet Format (2)
ARP Protocol Data Unit
0
15
Hardware
Hardware type (layer 2)
Address
Address length
length
Layer
Layer 22 (n)
(n)
Address
Address length
length
Layer
Layer 3 (m)
31
Protocol
Protocol type
type (layer
(layer 3)
3)
Operation
Operation
Source
Source address
address (layer
(layer 2):
2): n
n bytes
bytes
Source
Source address
address (layer
(layer 3):
3): m
m bytes
bytes
Destiniation
Destiniation address (layer 2): n bytes
bytes
Destination
Destination address
address (layer
(layer 3):
3): m bytes
bytes
Layer-2
Layer-2 header
header
Layer-2
Layer-2 payload
payload
Layer-3
Layer-3 trailer
trailer
How ARP Works?
ARP Request Packet
IP 172.28.80.96
MAC 00:50:BA:49:9D:B9
IP 172.28.80.100
MAC ?
Sample ARP request Ethernet packet
FF:FF:FF:FF:FF
Dest MAC (broadcast)
00:50:BA:49:9D:B9
Source MAC
0x0806
ARP frame type
0x01
0x06
0x800
0x04
0x001
00:50:BA:49:9D:B9
172.28.80.96
00:00:00:00:00:00
Ethernet / IP
MAC=6 / IP = 4 / request
Source MAC
Source IP
Dest MAC (unknow)
172.28.80.100
Dest IP
Checksum
Ethernet checksum
ARP Reply Packet
IP 172.28.80.96
MAC 00:50:BA:49:9D:B9
IP 172.28.80.100
MAC 00:02:7A:D2:B3:00
Sample ARP request Ethernet packet
00:50:BA:49:9D:B9
Dest MAC (unicast)
00:02:7A:D2:B3:00
0x800
Source MAC
ARP frame type
Ethernet / IP
0x002
MAC=6 / IP = 4 / reply
0x0806
0x01
0x06
0x04
00:02:7A:D2:B3:00
172.28.80.100
00:50:BA:49:9D:B9
Source MAC
Source IP
Dest MAC
172.28.80.96
Dest IP
Checksum
Ethernet checksum
Common Slide
ARP-Request to FF:FF:FF:FF:FF:FF
0
15
0x00
0x00 01
01 (Ethernet)
(Ethernet)
66
44
ARP-Reply to 49:72:16:08:64:14
31
0x80
0x80 00
00 (Internet
(Internet Protocol)
Protocol)
0x00
0x00 01
01 (ARP-Request)
(ARP-Request)
15
0x00
0x00 01
01 (Ethernet)
(Ethernet)
66
49
49 72
72 16
16 08
08
31
0x80
0x80 00
00 (Internet
(Internet Protocol)
Protocol)
0x00
0x00 02
02 (ARP-Reply)
(ARP-Reply)
49
49 72
72 16 08
64
64 14
14
129
129 25
25
64
64 14
14
129
129 25
25
10
10 72
72
00
00 00
00
10
10 72
72
49
49 78
78
00
00 00
00 00
00 00
00
21
21 21
21 23 90
129
129 25 10
10 11
11
129
129 25
25 10
10 11
11
Common Slide (2)
Example Use of ARP
ARP Cache
To reduce network traffic;
performance comparable to direct mapping.
A table stores mappings between
MAC addresses and
IP addresses.
The entries are dynamically added and removed.
Cache timeout - complete entry :2 mins;
incomplete (for non-existent host) entry :3 mins.
Address resolution
Transmission on LANs requires knowledge of destination hardware address (physical
address, MAC address).
On a LAN hardware addresses are unique.
Address resolution is translation of destination IP address to destination hardware address
Address Resolution Methods
Table look-up
Each node keeps a separate table
Network adress part of IP address need not be stored.
If address mapping changes all nodes update their tables
Address Resolution Methods (2)
Computation
Derivation from the host address part of IP address
Useful in network that employ reconfigurable (dynamical) port address.
Address Resolution Methods (3)
Message exchange:
A server responds to address resolution request that it receives
Any machine that knows the hardware address responds to address resolution request
broadcasts
Address Resolution Protocol (IP over Ethernet)
Is based on message exchange.
Is simple.
Optimizations:
Caching
A machine broadcasts its own IP-Ethernet binding
At boot time
With address resolution request (ARP)
ARP message is placed into the payload field of LAN(DLL) frame.
ARP message
Hardware addr. type
Protocol addr. type
Hardware addr.
length
Operation
Protocol addr.
length
Source hardware addr. (first 4 bytes)
Source hardware addr. (last 2
bytes)
Source protocol addr. (first 2 bytes)
Source protocol addr. (last 2 bytes) Dest. Hardware addr. (first 2 bytes)
Dest. Hardware addr. (last 4 bytes)
Dest. Protocol addr.
LAN
ARP-Request to MAC FF:FF:FF:FF:FF:FF
1
MAC
MAC address
address of
of 129.25.10.11
129.25.10.11 ??
Reply
Reply to:
to: 49:72:16:08:64:14
49:72:16:08:64:14 (129.25.10.72)
(129.25.10.72)
ARP-Reply to MAC 49:72:16:08:64:14
Reply:t:
Reply:t: 129.25.10.11
129.25.10.11 (49:78:21:21:23:90)
(49:78:21:21:23:90)
Requested
Requested by::
by:: 129.25.10.72
129.25.10.72 (49:72:16:08:64:14)
(49:72:16:08:64:14)
2
IP: 129.25.10.11
MAC: 49:78:21:21:23:90
Router R
IP: 129.1.11.72
MAC: 10:11:72:AB:02:01
Computer A:
IP: 129.25.10.72
MAC: 49:72:16:08:64:14
Computer B:
IP: 129.25.10.97
MAC: 49:72:16:08:80:70
Computer C:
IP: 129.25.10.81
MAC: 49:17:92:96:96:96
LAN (2)
LAN
System A
System B
Request
Looking for physical address of a
node with IP address 141.23.56.23
a. ARP request is multicast
LAN
System A
System B
Reply
The node physical address
is A4:6E:F4:59:83:AB
b. ARP reply is unicast
Proxy ARP
Added subnetwork
The proxy ARP router replies
to any ARP request received
for destinations 141.23.56.21,
141.23.56.22, and 141.23.56.23.
Router or host
141.23.56.21
141.23.56.22
141.23.56.23
Proxy ARP
router
Thank You !