Ch_15_Address Resolution Protocol (ARP)
-
Upload
abdoul-feroze -
Category
Documents
-
view
222 -
download
0
Transcript of Ch_15_Address Resolution Protocol (ARP)
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
1/17
Fall 2004 FSU CIS 5930 Internet Protocols 1
Address Resolution Protocol
(ARP)
Reading: Chapter 15
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
2/17
Fall 2004 FSU CIS 5930 Internet Protocols 2
ARP Mapping between layer 3 and layer 2
addresses
IP and MAC addresses
Given an IP address, what is the
corresponding MAC address?
Built on top of data-link layer Encapsulated and transmitted in data-link
layer data frames
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
3/17
Fall 2004 FSU CIS 5930 Internet Protocols 3
An example
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
IP: 129.1.11.72
MAC: 10:11:72:AB:02:01
IP: 129.25.10.11
MAC: 49:78:21:21:23:90
Router R
. . .
: : : : : : . . .
MAC address of 129.25.10.11 ?
Reply to: 49:72:16:08:64:14 (129.25.10.72)
ARP-Request to MAC FF:FF:FF:FF:FF:FF
: : . . . : : : : ::: . . . : : : : :
Reply:t: 129.25.10.11 (49:78:21:21:23:90)Requested by:: 129.25.10.72 (49:72:16:08:64:14)
ARP-Reply to MAC 49:72:16:08:64:14
1
2
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
4/17
Fall 2004 FSU CIS 5930 Internet Protocols 4
ARP packet format0 15 31
ARP Protocol Data Unit
Hardware type (layer2) Protocol type (layer3)
Address lengthLayer2 (n)
Address lengthLayer3 (m)
Operation
Source address (layer2): n bytes
Source address (layer3): m bytes
Destiniation address (layer2): n bytes
Destination address (layer3): m bytes
Layer-2 header Layer-2 payload Layer-3 trailer
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
5/17
Fall 2004 FSU CIS 5930 Internet Protocols 5
ARP packet format: example0 15 31
ARP-Request to FF:FF:FF:FF:FF:FF
0x00 01 (Ethernet) 0x80 00 (Internet Protocol)
6 4 0x00 01 (ARP-Request)
49 72 16 08
64 14 129 25
10 72 00 00
00 00 00 00
129 25 10 11
0 15 31
ARP-Reply to 49:72:16:08:64:14
0x00 01 (Ethernet) 0x80 00 (Internet Protocol)
6 4 0x00 02 (ARP-Reply)
49 72 16 08
64 14 129 25
10 72 49 78
21 21 23 90
129 25 10 11
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
6/17
Fall 2004 FSU CIS 5930 Internet Protocols 6
Receiving ARP packet and
replying Insert layer 2 address (MAC address)
Swapping source destination address
fields
Changing operation field (reply)
Sending ARP reply
Sources IP/MAC pair also inserted intoARP cache at receiver
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
7/17
Fall 2004 FSU CIS 5930 Internet Protocols 7
Implementation
Neighbors Computers that can be directly reachable
Data structures
arp_tbl neigh_table
neighbor
neigh_ops
Functions Sending/receiving ARP packets Managing ARP data structures
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
8/17
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
9/17
Fall 2004 FSU CIS 5930 Internet Protocols 9
neighbor
dev: Pointer to corresponding network device
timer:
Pointer to timer to initiate handling routine neigh_timer_handler()
ha:
Hardware address of the neighbor
hh: Hardware header
nud_state:
State concerning the neighboring computer
output:
Function to send data packet to the neighbor
arp_queue
Queue of packets waiting to be transmitted
opts:
Pointer to a neigh_ops structure
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
10/17
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
11/17
Fall 2004 FSU CIS 5930 Internet Protocols 11
neigh_ops Different neighbor characteristics
Generic, direct, hh, and broken
This structure defines the corresponding
functions for different devices
destructor, solicit, error_report, output,
connected_output, hh_output, queue_xmit
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
12/17
Fall 2004 FSU CIS 5930 Internet Protocols 12
States
NUD_NONE
NUD_NOARP
NUD_NONE
No
Emtru
NUD_
INCOMPLETE
arp_constructor:
initialize an entry,Send an ARP request
neigh_create:
Create an entry
NUD_
REACHABLE
Receive ARP-Reply
Permanent
Eintrag
NOARP-Device
Receive
packet
NUD_STALE
NUD_DELAY
NUD_PROBE
NUD_FAILED
receiveARP-Reply
No sign of life inreachable_time Set timer
Timeout
max_probes
Requests sent,
No reply
Garbage Collectioncompleted.
Delete entry
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
13/17
Fall 2004 FSU CIS 5930 Internet Protocols 13
ARP operation
. , .arp.c, neighbour.c
IPv4
Higher Layers
.dev.c
net_rx_action
IPv4
ip_finish_output2
arp.c, neighbour.c
.dev.c
ip_queue_xmit
dev_queue_xmit
neigh_resolve_output
arp_rcv arp_send
neigh_lookup
arp_tblneigh_update
ETH_P_ARP
ARP-Reply
ARP-Request
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
14/17
Fall 2004 FSU CIS 5930 Internet Protocols 14
Handling ARP PDUs arp_rcv()
Some sanity check
NF_ARP_IN arp_process()
arp_process() Some more sanity check
For both request/reply Update ARP cache (neigh_lookup())
For request arp_send() to send a reply
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
15/17
Fall 2004 FSU CIS 5930 Internet Protocols 15
Handling ARP packets arp_send()
Allocating socket buffer
Filling hardware header
Filling ARP data
NF_ARP_OUT
dev_queue_xmit()
neigh_update()
Updating neighbor entry state
Setting up corresponding output function, etc
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
16/17
Fall 2004 FSU CIS 5930 Internet Protocols 16
Handling unresolved IP
packets neigh_resolve_output()
Sending the packet if it is OK (e.g., REACHALBEstate)
Otherwise (e.g., INCOMPLETE state)
Storing the pkt in arp_queue queue byneigh_event_send()
neigh_event_send() Checking if the pkt can be sent
If not, storing IP packet and sending ARP request(arp_solicit())
arp_solicit() Send ARP request by arp_send()
-
8/8/2019 Ch_15_Address Resolution Protocol (ARP)
17/17
Fall 2004 FSU CIS 5930 Internet Protocols 17
Some other neighbor
managing functions neigh_connect()
neigh_suspect()
neigh_destroy()
neigh_sync()
neigh_periodic_timer() neigh_timer_handler()