Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPT 471 Networking II Address Resolution IPv4 ARP RARP 1© Janice Regan, 2012.

Similar presentations


Presentation on theme: "CMPT 471 Networking II Address Resolution IPv4 ARP RARP 1© Janice Regan, 2012."— Presentation transcript:

1 CMPT 471 Networking II Address Resolution IPv4 ARP RARP 1© Janice Regan, 2012

2 Transport Layer: Socket view © Janice Regan, 2012 2  An application on one host wishes to send some data to a particular application on another host  The applications use the transport layer interface (sockets) to transfer the data.  Each application has a communication endpoint, specified by a (port descriptor, IP address) pair  The source and destination port descriptors (addresses) are included in the transport layer header that encapsulates the application’s data in one or more segments

3 Transport Layer: data path  Conceptually we are sending the data from one application to the other in the transport layer  In reality the data is actually passed down the protocol stack of the source host, through the network and up the protocol stack of the destination host  Let’s review how this actually happens © Janice Regan, 2012 3

4 Transport Layer: encapsulation  The data from the transport layer is encapsulated  A transport layer header is constructed  The header is prepended before the application data  The transport layer header includes port addresses on source and destination hosts.  The port address indicates the process the data belongs to on the source host and the destination host.  The transport layer header and the data form a transport layer segment.  The transport layer segment is passed down to the network layer to become the data in the IP datagram © Janice Regan, 2012 4

5 Network Layer: encapsulation  The transport layer segment is encapsulated by adding a network layer header  The segment and the header form a IP datagram  The IP header includes source and destination IP addresses and other information necessary for the hop by hop transport of the datagram through the network  Next, the IP stack will process the datagram using the forwarding algorithm and the routing table to find the IP address of the next hop destination.  the IP datagram and the next hop address to which the datagram should be sent must be passed to the data link layer © Janice Regan, 2012 5

6 Addressing: Data Link Layer  We will need the Ethernet address of the present router (source) and the next hop destination (destination) to use in the MAC header  Both the present router and the next hop destination will be attached to the same physical network segment  We know the Ethernet address of the present router (where the packet is now)  ARP is the protocol that allows us to determine the physical address (for example Ethernet address) of the next hop destination host given the internet address of that host © Janice Regan, 2012 6

7 Addressing: Data Link Layer © Janice Regan, 2012 7

8 How a packet is delivered  In the physical layer the MAC layer frame is encoded and transmitted  The internet interface (network card) on each machine has a MAC address  For Ethernet the address is associated with a unique Ethernet address (48 bit address) at the time of manufacture  Other types of LAN (using different MAC protocols) have their own types of addresses that may have different lengths from the Ethernet address © Janice Regan, 2012 8

9 How a packet is delivered  Each network interface watches the network and can intercept packets addressed to its own address or the broadcast address of the net (also multicast packets)  The sender must know the MAC address of the receiver before it can send anything. How does it find the receivers MAC address? The problem of finding the MAC address is called Address Resolution © Janice Regan, 2012 9

10 Using ARP  ARP (address resolution protocol) facilitates mapping of IP addresses to physical addresses for all hosts on the LAN (exceptions discussed later)  Since packets traveling in the network will be delivered using MAC addresses, the sending host needs to determine the MAC address corresponding to know IP before it can send the packet © Janice Regan, 2012 10

11 Using ARP  The host will keep a table called the ARP cache that will contain mappings from MAC to IP addresses  When the host wishes to send a packet it will look in the ARP cache for an entry corresponding to the desired destination host’s IP address.  If there is an entry it will send to the indicated MAC address  If no entry exists an new entry must be added to the ARP cache © Janice Regan, 2012 11

12 Sending a packet to an IP address © Janice Regan, 2012 12 From the TCP/IP Guide

13 Entries in the ARP cache  Entries in the ARP cache are static or dynamic.  Static entries are entered by the administrator and stay in the cache until removed  Dynamic entries are added to the cache when the local host tries to send a packet to a destination host on the LAN  When a dynamic entry is added to the cache a timer is set to indicate the lifetime of that entry When the two hosts communicate, each host updates (reinitializes) the timer corresponding to the entry for the other host in its own ARP cache When the timer expires the entry is removed © Janice Regan, 2012 13

14 Why use Dynamic Entries  MAC addresses of hosts may change over time  Replacement of a network card (interface) will result in a changed MAC address  Interface may no longer be reachable  Host may be turned off or disconnected  Interface may be disabled  Interface may fail  New hosts/interfaces may be added to the network  Cache should not grow forever as new hosts are added © Janice Regan, 2012 14

15 Using Dynamic Entries  Must be able to add new entries and remove old ones  Must have a mechanism for deciding which entries to keep and which to discard  Must keep the size of the cache reasonable © Janice Regan, 2012 15

16 Using Dynamic Entries  The detailed handling of when timers are set and when entries expire and are removed is implementation dependent  For Linux there are two significant timers one indicates when an entry becomes stale, one indicates how often stale entries are removed  If the host for the entry is in use by other parts of the OS its entry will not be removed until it is no longer in use © Janice Regan, 2012 16

17 Adding new entries -ARP cache  If no entry in the ARP cache corresponds to the IP address of the destination of the packet to be sent the packet will be queued or dropped and an ARP request will be sent  The ARP request is broadcast to the LAN  All hosts on the LAN receive the request  The host with IP address corresponding to the destination IP address of the packet Will respond with a ARP reply unicast to the source Will add/update the entry for the source to its ARP cache © Janice Regan, 2012 17

18 Operation: ARP protocol © Janice Regan, 2012 18 Comer 2000: fig 5.1

19 ARP/RARP Message Format © Janice Regan, 2012 19

20 ARP/RARP Message Format  For an ARP request Target Hardware address (HA) is left blank  When the request is received the receiver will  updates/add to its ARP cache  Construct and send an ARP reply package.  The sender HA and IP from the request become the target HA and IP in the reply. The target IP from the request becomes the sender IP for the reply and the MAC address of the receiver becomes the sender HA © Janice Regan, 2012 20

21 Sample OPERATION field values © Janice Regan, 2012 21

22 © Janice Regan, 2012 22 Sample HARDWARE field values

23 ARP Message Information  ARP can be used by many MAC layer protocols not just Ethernet  Different protocols have different address lengths (48 bits for Ethernet)  The protocol type field indicates the MAC protocol being used.  The HLEN field indicates the length of the hardware address for that protocol © Janice Regan, 2012 23

24 Gratuitous ARP  Sometimes done as a host boots  An ARP request containing the IP of the booting host will be sent  If a reply is received then someone else is also using the IP of the booting machine and the booting machine should choose another IP © Janice Regan, 2012 24

25 What is Proxy ARP  Proxy ARP allows multiple networks/network segments to share a single network address  ARP relies on broadcast requests. The broadcast address for a network (LAN) will have a limited scope.  In particular if a LAN includes segments connected by routers each segment will generally have its own broadcast address © Janice Regan, 2012 25

26 What is Proxy ARP  Since broadcast packets are not forwarded by routers ARP requests will not travel between LAN segments connected by routers  If the segments are parts of a larger network (subnets of a larger network) we may want ARP requests to travel through the router  This is when Proxy ARP is used © Janice Regan, 2012 26

27 Operation of Proxy ARP  Consider two segments connected by a router.  A MAC frame will travel along one segment to the router, the host sending the frame does not know the destination host is on a different segment  An ARP request from a host on segment 1 will reach the router (on segment 1 and 2) but not any host on segment 2 because broadcast packets are not forwarded © Janice Regan, 2012 27

28 Operation of Proxy ARP  If the server supports proxy ARP it will send an ARP reply indicating its own hardware address for any IP address that is on segment 2  Later packets address to the host on segment 2 will be sent to the hardware address of the router. The router will forward them along segment 2 to the destination. © Janice Regan, 2012 28

29 Proxy Arp © Janice Regan, 2012 29 From the TCP/IP Guide

30 RARP  Reverse address resolution protocol is designed to allow a host to determine its own IP address  This is usually an issue at boot time, when a diskless host may not know its own IP address  The host sends a RARP request to a RARP server asking for its IP. The IP is supplied in the RARP reply  RARP has been largely superseded by other protocols  Other protocols (BOOTP, DHCP) return more information than just the hardware address, increasing efficiency  Cannot be used which use dynamic assignment of hardware addresses © Janice Regan, 2012 30

31 Operation of RARP © Janice Regan, 2012 31 From the TCP/IP Guide

32 Operation of RARP © Janice Regan, 2012 32 From the TCP/IP Guide


Download ppt "CMPT 471 Networking II Address Resolution IPv4 ARP RARP 1© Janice Regan, 2012."

Similar presentations


Ads by Google