Top Banner

of 37

ch07_ARP

Apr 05, 2018

Download

Documents

Bhanu Gill
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/31/2019 ch07_ARP

    1/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-1

    Chapter 7

    ARPand

    RARP

  • 7/31/2019 ch07_ARP

    2/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-2

    ARP and RARP

    Applications, which are above the layer 4, use logical address to identifythe destination host, called IP address. The IP packets are encapsulated into

    frames. The delivery of frames across the links (source source, or source router,

    router router, , router destination) is based on local addresses called physical

    addresses (MAC numbers). The mapping of IP addresses into physical addresses isdone through Address Resolution Protocol (ARP).

  • 7/31/2019 ch07_ARP

    3/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-3

    Position of ARP and RARP

    in TCP/IP protocol suite

  • 7/31/2019 ch07_ARP

    4/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-4

    ARP operation(case: destination is on the same physical network)

    Link

    IP = 141.23.56.23The MAC address ofdestination is broadcastaddress: 0xFFFFFFFFFFFF

  • 7/31/2019 ch07_ARP

    5/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-5

    ARP packet

    4 bytes(Ethernet = 1) IPv4 = 0x0800

    (Ethernet = 6)

    IPv4 = 4

    Opcode (1 = request, 2 = reply)

    18 byte padding (to make frame payloads equal to 46 bytes)

  • 7/31/2019 ch07_ARP

    6/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-6

    Encapsulation of ARP packet

    Start Field Delimiter(10101011)

    46 bytes

    Why ARP packets are not encapsulated

    into IP datagrams?

    Because ARP packets never leave LAN

  • 7/31/2019 ch07_ARP

    7/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-7

    Four cases using ARP(Case 1: Host to host)

    The IP address of destination host is taken from the IP datagram.

    7 8

  • 7/31/2019 ch07_ARP

    8/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-8

    Four cases using ARP (cont.)Case 2: Host to router)

    The IP address of the destination (router) is not taken from the IP datagram.

    Instead it is taken from the next-hop column of the RT of the source host.

    (next hop)

    7 9

  • 7/31/2019 ch07_ARP

    9/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-9

    Four cases using ARP (cont.)(Case 3: Router to router)

    The IP address of destination (router) is not taken from the IP datagram.

    Instead it is taken from the RT of the router

    7 10

  • 7/31/2019 ch07_ARP

    10/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-10

    Four cases using ARP (cont.)(Case 4: Router to host)

    The IP address of destination host is taken from the IP datagram.

    7 11

  • 7/31/2019 ch07_ARP

    11/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7-11

    Example 1

    A host with IP address 130.23.43.20 and physical

    address 0xB23455102210 has a packet to send to

    another host with IP address 130.23.43.25 andphysical address 0xA46EF45983AB. The two hostsare on the same Ethernet network. Show the ARPrequest and reply packets encapsulated in Ethernet

    frames.

    7-12

  • 7/31/2019 ch07_ARP

    12/37McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7 12

    Example 1: ARP request

    130.23.43.20

    Dont know the destination MAC address

    130.23.43.25

    ARP request

    (48 bytes with padding) Broadcast address

    7-13

  • 7/31/2019 ch07_ARP

    13/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    7 13

    Example 1: ARP reply

    ARP reply

    7-14

  • 7/31/2019 ch07_ARP

    14/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    ARP Cache Table

    It would be very inefficient to use the ARP for each datagram.Therefore the most recent mappings are kept in a cache table.In order to be consistent with the network dynamics, the entry ofARP cache have a timeout value which helps to remove the agedentries.

    TOBMACBPB

    . . . .. . . .. . . .

    TOAMACAPATimeoutPhysical AddressIP Address

    7-15

    A C ( )

  • 7/31/2019 ch07_ARP

    15/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    ARP Cache Table (cont.)

    The ARP cache of a host can be displayed with the command:

    arp a(the command is the same on Windows and UNIX)

    7-16

    ARP C h T bl ( )

  • 7/31/2019 ch07_ARP

    16/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    201.11.56.7514PF

    ACAE32457342180.3.6.19005R

    HardwareAddressProtocolAddressTimeOutAttemptQueueState

    ARP Cache Table (cont.)

    R = resolved, P = pending, F = free (time to leave has expired)

    Number of the queue

    where packets are waitingfor address resolution

    Life time of theentry (sec)

    Number ofARP request

    sent

    Implementation of ARP cache table requires more than the essential

    information shown on the previous two slides

    7-17

    ARP I l t ti

  • 7/31/2019 ch07_ARP

    17/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    ARP Implementation

    All modules are threads

    Timer(5 sec)

    IP datagram

    MAC address

    of immediate

    destination

    (next hop ordirect)

    7-18

    C S di k d i i IP h MAC i CT ( R)

  • 7/31/2019 ch07_ARP

    18/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    2

    1

    3

    Case: Sending a packet, destination IP has MAC in CT (state = R)

    Each destination is

    given a queue (all

    packets with the

    same destination

    are in the samequeue)

    7-19

  • 7/31/2019 ch07_ARP

    19/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    2

    1

    Case: Sending a packet, destination IP has not MAC in CT (state = P)

    Put packet inexisting queue

    3

    7-20Case: Sending a packet, destination IP is not in CT

  • 7/31/2019 ch07_ARP

    20/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    2

    1

    Case: Sending a packet, destination IP is not in CT

    3

    4

    Create a new queue

    7-21Case: An ARP reply arrives corresponding IP is in CT

  • 7/31/2019 ch07_ARP

    21/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    2

    Case: An ARP reply arrives, corresponding IP is in CT

    4

    Dequeue all packets3

    1

    7-22Case: An ARP reply arrives corresponding IP is not in CT

  • 7/31/2019 ch07_ARP

    22/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    2

    Case: An ARP reply arrives, corresponding IP is not in CT

    Create a new entry in CT

    1

    7-23Case from the previous slide:

  • 7/31/2019 ch07_ARP

    23/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Case from the previous slide:an ARP reply arrives, corresponding IP is not in CT

    When can this happen?

    The pending entry has been deleted because:

    (a) time-out expired

    (b) number of attempts exceeded

    7-24Case: An ARP request arrives

  • 7/31/2019 ch07_ARP

    24/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    q

    12

    7-25Cache-Control Module

  • 7/31/2019 ch07_ARP

    25/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    for (every entry in CT){switch (State){case PENDING:

    increment Attempt;if (Attempt > max){

    State = FREE;Destroy corresponding queue;}

    elseSend an ARP request;

    break;case RESOLVED:

    Decrement Time-Out;if (Time-Out

  • 7/31/2019 ch07_ARP

    26/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Example 2

    The ARP output module receives an IP datagram (from

    the IP layer) with the destination address 114.5.7.89. It

    checks the cache table and finds that an entry exists for

    this destination with the RESOLVED state (R in the

    table). It extracts the hardware address, which is457342ACAE32, and sends the packet and the address to

    the data link layer for transmission. The cache table

    remains the same.

    7-27

  • 7/31/2019 ch07_ARP

    27/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Original Cache Table (Example 2)

    4573E3242ACA19.1.7.82609R

    188.11.8.71318P

    F

    220.55.5.7112P

    457342ACAE32114.5.7.894508R

    201.11.56.7514P

    129.34.4.822P

    ACAE32457342180.3.6.19005R

    HardwareAddress

    ProtocolAddress

    TimeOut

    AttemptQueueState

    7-28

    E l 3

  • 7/31/2019 ch07_ARP

    28/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Example 3

    Twenty seconds later, the ARP output module receives an

    IP datagram (from the IP layer) with the destination

    address 116.1.7.22. It checks the cache table and does notfind this destination in the table. The module adds an

    entry to the table with the state PENDING and the

    Attempt value 1. It creates a new queue for thisdestination and enqueues the packet. It then sends an

    ARP request to the data link layer for this destination.

    7-29

    U d d CT (E l 3)

  • 7/31/2019 ch07_ARP

    29/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Updated CT (Example 3)

    4573E3242ACA19.1.7.82609R

    188.11.8.71318P

    116.1.7.22123P

    220.55.5.7112P

    457342ACAE32114.5.7.894508R201.11.56.7514P

    129.34.4.822P

    ACAE32457342180.3.6.19005R

    Hardware

    Address

    Protocol

    Address

    Time

    Out

    AttemptQueueState

    7-30

    Example 4

  • 7/31/2019 ch07_ARP

    30/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Example 4

    Fifteen seconds later, the ARP input module receives an

    ARP packet with target protocol address 188.11.8.71. The

    module checks the table and finds this address. It changesthe state of the entry to RESOLVED and sets the time-

    out value to 900. The module then adds the target

    hardware address (E34573242ACA) to the entry. Now itaccesses queue 18 and sends all the packets in this queue,

    one by one, to the data link layer.

    7-31

  • 7/31/2019 ch07_ARP

    31/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    4573E3242ACA19.1.7.82609R

    E34573242ACA188.11.8.7190018R

    116.1.7.22123P

    220.55.5.7112P

    457342ACAE32114.5.7.894508R201.11.56.7514P

    129.34.4.822P

    ACAE32457342180.3.6.19005R

    Hardware

    Address

    Protocol

    Address

    Time

    Out

    AttemptQueueState

    Updated CT (Example 4)

    7-32

    Example 5

  • 7/31/2019 ch07_ARP

    32/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Example 5

    Twenty-five seconds later, the cache-control module

    updates every entry. The time-out values for the first

    three resolved entries are decremented by 60. The time-out value for the last resolved entry is decremented by 25.

    The state of the next-to-the last entry is changed to FREE

    because the time-out is zero. For each of the three entries,the value of the attempts field is incremented by one.

    After incrementing, the attempts value for one entry (the

    one with IP protocol address 201.11.56.7) is more thanthe maximum; the state is changed to FREE, the queue is

    deleted.

    7-33

    CT Updated by Cache Control Module (Example 5)

  • 7/31/2019 ch07_ARP

    33/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    60! 0R! F

    E34573242ACA188.11.8.7190018R

    116.1.7.22223P

    220.55.5.7212P

    457342ACAE32114.5.7.893908R201.11.56.7614P

    !F

    129.34.4.832P

    ACAE32457342180.3.6.18405R

    Hardware

    Address

    Protocol

    Address

    Time

    Out

    AttemptQueueState

    CT Updated by Cache Control Module (Example 5)

    Time-Out is decremented by 60 sec (20 + 15 + 25)

    7-34RARP

  • 7/31/2019 ch07_ARP

    34/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Broadcast

    Unicast

    Used w hen configurat ion f i le is

    not available (e.g. diskless machine)

    7-35

    RARP packet

  • 7/31/2019 ch07_ARP

    35/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    RARP packet

    7-36

  • 7/31/2019 ch07_ARP

    36/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Encapsulation of RARP packet

    7-37

  • 7/31/2019 ch07_ARP

    37/37

    McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    Alternative Solutions to RARPWhen a diskless computer is booted, it needs moreinformation in addition to it s I P address. It needs

    to know its subnet mask , the I P address of arouter , and the I P address of a name server .RARP cannot provide this extra information. Newprotocols have been developed to provide thisinformation. In Chapter 17 we discuss two

    protocols, BOOTP and DHCP, that can be usedinstead of RARP.