ARP
ARP
OBJECTIVES:
•Ethernet addresses are built into the interface hardware by the manufacturer
•Thetwo addresses bear absolutely no relationship to one another (as we would expect
from the layering principles)
4
Why?
5
MAC Address vs. IP Address
MAC addresses
Hard-coded in read-only memory when adaptor is built
IP addresses
Configured, or learned dynamically
6
Translation of Addresses
•Translation between IP addresses and domain names (Domain Name System (DNS))
ADDRESS MAPPING
Type: 0x0806
6 6 2 28 10 4
* Note:
16
The length of the address fields is determined by the corresponding address length fields
An ARP request is broadcast;
an ARP reply is unicast.
ARP Walkthrough Pt 1
1. ARP broadcasts an ARP Request packet that contains the target IP
address in an Ethernet frame with destination address
ff:ff:ff:ff:ff:ff (and source its own Ethernet address)
2. All hosts on the local network read the frame
3. The target host recognises the request for its IP address
ARP Walkthrough Pt 2
1. The target sends an ARP Reply packet containing its own Ethernet address
(the other hosts need do nothing)
2. It knows the source's Ethernet address as read from the request packet
3. The source gets the reply and reads out the target's Ethernet address
4. It can now use that Ethernet address to send IP packets
Example
23
ARP – Address Resolution Protocol
Arp Request
Arp Reply
ARP Operation
When any host wanted to send traffic to any other host it needs to construct both L2 and L3 headers.
a) if the destination IP is in same subnet, it send arp request which is a broadcast. If there is any
host whose IP is equal to destination IP, it will respond with a arp reply which is unicast. The
source host will have ARP entries in its arp table for all the hosts that are part of same subnet.
b) if the destination IP is in different subnet and default gateway is configured, the arp request
broadcast is not sent, instead it forwards the packet to default gateway ( with source MAC as
outgoing interface MAC and destination as default gateway's MAC) without proxy ARP.
- To know the MAC of default g/w, ARP request is broadcasted to gateway’s IP address, and
router sends ARP reply with it’s MAC address as a unicast.
- By default proxy ARP is not enabled.
- ARP entries will be present only for all hosts in local subnet including default gateway.
c) if the destination IP is in different subnet and default gateway is not configured, the arp request
is broadcasted. If proxy arp is not enabled on router, no arp reply is sent back to host even
though it has a route to destination and communication fails.
If proxy arp is enabled on router and it has a route to the destination, it responds with its
own mac address in the arp reply and communication passes through.
ARP entries will be present for all hosts in local subnet along with gateway and also for
remote hosts which are part of different subnet. For all remote hosts, the MAC address will be
marked as that of default gateway's.
Example: A Sending a Packet to B
How does host A send an IP packet to host B?
R
B
R
B
29
Host A Sends Packet Through R
Host A learns the MAC address of R’s interface
ARP request: broadcast request for 111.111.111.110
R
B
30
R Decides how to Forward Packet
Router R’s adaptor receives the packet
R extracts the IP packet from the Ethernet frame
R
B
31
R Sends Packet to B
Router R’s learns the MAC address of host B
ARP request: broadcast request for 222.222.222.222
R
B
32
An analyzer capture of the ARP Request
ARP Cache
For every outgoing packet sending ARP request and
waiting for responses is inefficient
Requires more bandwidth
Consumes Time
ARP cache maintained at each node
Cache Table
-ARP may also be used as a simple announcement protocol. This is useful for updating other hosts'
mapping of a hardware address when the sender's IP address or MAC address has changed. Such
an announcement, also called a gratuitous ARP message, is usually broadcast as an ARP request
containing the sender's protocol address (SPA) in the target field (TPA=SPA), with the target
hardware address (THA) set to zero. An alternative is to broadcast an ARP reply with the sender's
hardware and protocol addresses (SHA and SPA) duplicated in the target fields (TPA=SPA,
THA=SHA).
An ARP announcement is not intended to solicit a reply; instead it updates any cached entries in
the ARP tables of other hosts that receive the packet.
36
ARP Cache Problems
Cache space may be limited
Hosts move or change IP addresses
Solution?
Drop (invalidate) cache entries after “a while” (20
minutes is normal)
C:\>arp -a
39
ARP Command
To display table
arp –a
To delete entry
arp –d 192.168.1.2
Reverse ARP (RARP)
I heard
that
What is
broadcast.
my IP
Your IP
addres
address is
s?
172.16.3.2
5.
Ethernet: 0800.0020.1111
IP: 172.16.3.25
When a diskless computer is booted, it needs more information in addition
to its IP address. It needs to know its subnet mask, the IP address of a
router, and the IP address of a name server. RARP cannot provide this
extra information. New protocols have been developed to provide this
information. BOOTP and DHCP are protocols that can be used instead of
RARP.
Proxy ARP
Proxy ARP: Host or router responds to ARP Request that arrives from one of its connected networks for
a host that is on another of its connected networks.
If default GW is not configured on end hosts, PROXY ARP must be enabled on routers, otherwise ARP
resolution can’t happen on end hosts for remote networks.
Argon Neon
Router137
128.143.137.1/16 128.143.171.21/24
128.143.137.144/16 128.143.71.1/24
00:e0:f9:23:a8:20 00:20:af:03:98:28
128.143.0.0/16 128.143.71.0/24
Subnet Subnet
ARP Request:
What is the MAC address
of 128.143.71.21?
ARP Reply:
The MAC address of
128.143.71.21 is
00:e0:f9:23:a8:20
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.
On some systems (including Linux) a host periodically sends ARP Requests for all
addresses listed in the ARP cache. This refreshes the ARP cache content, but
also introduces traffic.
Gratuitous ARP Requests: A host sends an ARP request for its own IP address:
Useful for detecting if an IP address has already been assigned.
43
Vulnerabilities of ARP
1. Since ARP does not authenticate requests or replies, ARP Requests and Replies
can be forged
2. ARP is stateless: ARP Replies can be sent without a corresponding ARP Request
3. According to the ARP protocol specification, a node receiving an ARP packet
(Request or Reply) must update its local ARP cache with the information in the
source fields, if the receiving node already has an entry for the IP address of the
source in its ARP cache. (This applies for ARP Request packets and for ARP
Reply packets)
44
ARP Spoofing (ARP Poisoning)
• Send fake or 'spoofed', ARP messages to an Ethernet LAN.
▫ To have other machines associate IP addresses with the attacker’s
MAC
• Defenses
▫ Static ARP table
▫ DHCP snooping (use access control to ensure that hosts only use the IP
addresses assigned to them, and that only authorized DHCP servers
are accessible).
▫ Detection: Arpwatch (sending email when updates occur),
• Legitimate use
▫ Redirect a user to a registration page before allow usage of the network
45