Chapter 08 ARP
Frame Transmission Frames are transmitted using physical addresses within a network Ω X, ß Y : physical address (different scheme in each network) N Z : network address (same scheme globally) Host A Ω A,N A Ω R1,N R1 ß R2,N R2 ß B,N B IP DLL Router IP DLL Host B Physical address Network address Physical address Network address Ω R1 Ω A N B N A ß B ß R2 N B N A IP datagram Data link frame
Example SNU KNU SNU KNU Stop 25 KNU Bus KTX Bus Stop 71 Daegu Station Seoul Station Stop 712 SNU Stop 53 Daegu bus ticket Seoul bus ticket 71 25 KTX ticket Daegu Stn Seoul Stn 53 712
Why Address Translation? 1. Host-A reads IP address of the next hop (N R1 ) from the routing table 2. Host-A needs physical address (Ω R1 ) of the next hop to deliver packet within subnet 3. But, Host-A does not know the physical address
Address Translation Static translation Use a mapping table containing a pair of network (logical) address and physical address Needs periodic update of mapping table due to change of network interface, movement of mobile host Dynamic translation Finds the corresponding address using a protocol ARP (Address Resolution Protocol): converts network address to physical address RARP (Reverse ARP) : converts physical address to network address
Address Resolution Protocol (ARP)
ARP An ARP request is broadcast; an ARP reply is unicast.
Example Host A Ω A,N A Ω R1,N R1 ß R2,N R2 ß B,N B ARP Request Router Host B ALL Ω A N A Ω A N R1 0 Broadcast Frame Header ARP message Unicast ARP Reply Ω A Ω R1 N A Ω A N R1 Ω R1 Frame Header ARP message Data Frame Ω R1 Ω A N B N A Frame Header IP Header
Example 1. IP-A reads the next hop (N R1 ) from the routing table, but it does not know physical address of N R1 2. IP-A stores packet in queue and requests ARP to obtain the physical address 3. ARP generates an ARP request message 4. Data link layer broadcasts ARP request message within the subnet 5. All hosts and routers within the subnet receive ARP request message 6. The router sends its physical address (P R1 ) to host-a using an ARP reply message (ARP reply is sent in a unicast manner) 7. IP-A stores the resolved physical address (P R1 ) in the cache 8. IP-A passes the packet to the data link layer to transmit it over the subnet
ARP Packet Hardware type : subnet type (Ethernet : 1) Protocol type : higher layer protocol (IPv4 : 0800 16 ) Hardware length : length of physical address (number of bytes) 6 in Ethernet Protocol length : length of network address (number of bytes) 4in IPv4 Operation : packet type - ARP request(1), ARP reply(2) Sender hardware address : sender physical address Sender protocol address : sender network address Target hardware address : target physical address (unknown) Target protocol address : target network address
Encapsulation of ARP Packet This frame contains ARP message
Example ARP request message is broadcast
Example ARP reply message is sent in a unicast manner
RARP Used to bootstrap a system without disk Diskless system does not have IP address, subnet mask BOOTP or DHCP is widely used instead of RARP
RARP The RARP request packets are broadcast; RARP reply packets are unicast.
RARP Packet Format
ARP Structure Cache table Cache control module Queue Output module Input module
ARP Cache Table State Queue Attempt Timeout Network Addr. Physical Addr. The physical addresses resolved by ARP are stored in cache table Does not need to send ARP Request packet for every IP datagram to resolve physical address Physical address is extracted from cache table if any State : FREE, PENDING, RESOLVED Queue number Place of datagrams waiting for address translation Datagrams destined to the same target are stored in the same queue Attempt : Number of ARP requests which have been sent for each entry Time-out : lifetime of entry (unit: second) Network address Physical address
Example At t=0, an IP datagram destined to 114.5.7.89 is passed from IP Lookup cache table => RESOLVED Pass the IP datagram and its physical address (457342ACAE32) to the lower data link layer State Queue Attempt Time-out Network Addr. Physical Addr. R 5 900 180.3.6.1 ACAE32457342 P 2 2 129.34.4.8 P 14 5 201.11.56.7 R 8 450 114.5.7.89 457342ACAE32 P 12 1 220.55.5.7 F R 9 60 19.1.7.82 245CAE2A3734 P 18 3 188.11.8.71
Example At t=20, an IP datagram destined to 116.1.7.82 is passed from IP Lookup cache table => No entry Add a new entry (State PENDING, Attempt 1) Create a queue, and enqueue the datagram Send an ARP Request packet State Queue Attempt Time-out Network Addr. Physical Addr. R 5 900 180.3.6.1 ACAE32457342 P 2 2 129.34.4.8 P 14 5 201.11.56.7 R 8 450 114.5.7.89 457342ACAE32 P 12 1 220.55.5.7 P 23 1 116.1.7.82 R 9 60 19.1.7.82 245CAE2A3734 P 18 3 188.11.8.71
Example At t=35, ARP receives an ARP Reply packet destined to 188.11.8.71 Table lookup => there exists an entry 188.11.8.71 Record the physical address (E3457342ACA) in the entry Pass all IP datagrams waiting at queue 18 to data link layer Timeout Network Addr. Physical Addr. R 5 900 180.3.6.1 ACAE32457342 P 2 2 129.34.4.8 P 14 5 201.11.56.7 R 8 450 114.5.7.89 457342ACAE32 P 12 1 220.55.5.7 P 23 1 116.1.7.82 R 9 60 19.1.7.82 245CAE2A3734 R 18 900 188.11.8.71 E3457342ACA State Queue Attempt
Example Assume that all entries are updated every 60 sec At t=60, periodic timer expires Decrement timeout values of resolved entries by 60 Send one more ARP Request packet for pending entries ++Attempt If Attempt exceeds maximum, remove the entry (Change the state to FREE and destroy the queue) Remove entries if timeout = 0 State Queue Attempt Time-out Network Addr. Physical Addr. R 5 900->840 180.3.6.1 ACAE32457342 P 2 2->3 129.34.4.8 F 5->6(Max) R 8 450->390 114.5.7.89 457342ACAE32 P 12 1->2 220.55.5.7 P 23 1->2 116.1.7.82 F 60->0 R 18 900->840 188.11.8.71 E3457342ACA
ARP Output Module Receive: an IP datagram from the processing module 1. Sleep until an IP packet is passed from IP software. 2. Check the cache table to find an entry corresponding to this IP packet. 3. If(found) 1. If(the state is RESOLVED) 1. Extract the physical address from the entry. 2. Pass the packet and physical address to data link layer. 3. Return. 2. If(the state is PENDING) 1. Enqueue the packet to the corresponding queue. 2. Return. 4. If(not found) 1. Create a queue. 2. Enqueue the packet. 3. Create a cache entry with state set to PENDING and ATTEMPT set to 1. 4. Send an ARP Request.
ARP Input Module 1. Sleep until an ARP packet (request or reply) arrives. 2. Check the cache table to find an entry corresponding to this ARP packet. 3. If(found) 1. If(the state is PENDING) 1. Update the entry. 2. While the queue is not empty 1. Dequeue one packet. 2. Pass the packet and physical address to data link layer 2. If(the state is RESOLVED) update the entry. 4. If(not found) create an entry and add the entry to the table. 5. If(the packet is a request) send an ARP Reply
ARP Cache Control Module 1. Sleep until the periodic timer matures. 2. For every entry in the cache table 1. If(the state is PENDING) 1. Increment ATTEMPT by 1. 2. If(ATTEMPT greater than maximum) 1. Change the state to FREE. 2. Destroy the corresponding queue. 3. If(not) send an ARP Request. 2. If(the state is RESOLVED) 1. Decrement the value of time-out by value of elapsed time. 2. If(timeout less than or equal to zero) 1. Change the state to FREE.