Presentation is loading. Please wait.

Presentation is loading. Please wait.

McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 PART IV NETWORK LAYER.

Similar presentations


Presentation on theme: "McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 PART IV NETWORK LAYER."— Presentation transcript:

1 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 PART IV NETWORK LAYER

2 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Position of Network Layer

3 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Network Layer Duties

4 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 DUTIES of NETWORK LAYER Internetworking: Logically connecting heterogeneous networks to look like single network to upper transport and application layers. Addressing: Each device (a computer or a router) over the Internet must have unique and universally accepted address. (chapter 19) Routing: Packet can not choose its route to the destination. The routers connecting LANs and WANs make this decision. (Chapter 19) Packetizing : The network layer encapsulates datagram/segments received from upper layers and makes packets out of them. (Chapter 20) Fragmentation: Each router de-capsulates the IP datagram from the received frame, process it and encapsulates it into another frame. Format and size of the received frame depends on the protocol used by the physical network from which the frame has just arrived. Format and size of the departing frame depends on the protocol used by the physical network to which the frame is going. (Chapter 20)

5 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapters Chapter 19 Host-to-Host Delivery Chapter 20 Network Layer Protocols Chapter 21 Unicast and Multicast Routing Protocols

6 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 OBJECTIVES INTERNETWORKS ADDRESSING ROUTING Concepts ROUTING protocols in Chap 21

7 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 INTERNETWORKS How can data be exchanged between networks? They need to be connected to make an internetwork.

8 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.2 Links in an internetwork If a packet arrives at f1 of S1, how to make the right flow decision? MAC address can not help.

9 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.3 Network Layer in an internetwork Network layer is responsible for host-to-host delivery and for routing the packets through the routers or switches. Uses two universal address: Destination address, source address.

10 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.4 Network Layer at the Source

11 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.5 Network Layer at a Router Network layer at the switch or router is responsible for routing the packet. When a packet arrives, the router or switch finds the interface from which the packet must be sent. This is done using the routing table.

12 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.6 Network Layer at the Destination Network layer at destination is responsible for address verification; it makes sure that the destination address is same as address of host. Checks to see if the packet is corrupted on transmission. If yes, discards the packet. If the packet is a fragment, wait until all fragments arrive, re-assemble them and pass to transport layer.

13 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.7 Switching

14 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.7 Switching Circuit switching Physical link is dedicated between source and destination Data can be sent as a stream of bits without the need for packetizing. Packet Switching Data are transmitted in discrete units of potentially variable-length blocks called packets. Maximum length of packet is established by the network. At each node, packet is stored before being routed according to the information in its header.

15 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Relationship between all packets belonging to a message or session is preserved. A single route is chosen between sender and receiver at the beginning of the session. When the data are sent, all packets of the transmission travel one after another along that route. The virtual circuit approach needs a call setup to establish a virtual circuit between the source and destination. A call teardown deletes the virtual circuit. After the setup, routing takes place on the virtual circuit identifier. Used in WANs, Frame Relay, and ATM. Virtual Circuit Approach

16 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.8 Datagram Approach Each packet is treated independently of all others. Even if one packet is just a piece of a multi-packet transmission, the network treats it as though it existed alone. Packets in this approach are referred to as datagrams. Datagrams may arrive in out of order. No need for call setup and virtual circuit identifiers. Uses source and destination addresses for routing.

17 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.8 Datagram Approach Switching at the Network layer in the Internet is done using datagram approach to packet switching.

18 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Connection-oriented service Source first makes a connection with the destination before sending a packet. When the connection is established, a sequence of packets from the same source to the same destination can be sent one after another. Packets are sent in same path in sequential order. A packet is logically connected to the packet traveling before it and to the packet traveling after it. When all packets of a message have been delivered, the connection is terminated. Routing decision based on source and destination address is done only once. Connectionless service Network layer protocol treats each packet independently, with each packet having no relationship to any other packet. May or may not travel in the same path.

19 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 OBJECTIVE 1: INTERNETWORKS Communication at the Network Layer in the Internet is connectionless.

20 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 IP ADDRESSING Binary Notation Dotted-Decimal Notation Identifier used in network layer to identify each device connected to the Internet 32-bit binary address that uniquely and universally defines the connection of a host or a router to the Internet. In Internet, no two devices can have the same IP For readability, we divide the IP address into 4 bytes. Dotted-decimal notation: Each byte is separated by dots.

21 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 1 Change the following IP addresses from binary notation to dotted- decimal notation. a.10000001 00001011 00001011 11101111 b.11111001 10011011 11111011 00001111 Solution We replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots for separation: a.129.11.11.239 b.249.155.251.15

22 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 2 Change the following IP addresses from dotted-decimal notation to binary notation. a.111.56.45.78 b.75.45.34.78 Solution We replace each decimal number with its binary equivalent (see Appendix B): a.01101111 00111000 00101101 01001110 b.01001011 00101101 00100010 01001110

23 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Classful Addressing The address space is divided into five classes: A, B, C, D and E Fig. 19.10 Finding the class in binary notation

24 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.11 Finding the Address Class

25 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 3 Find the class of each address: 0 a.00000001 00001011 00001011 11101111 1111 b.11110011 10011011 11111011 00001111 Solution See the procedure in Figure 19.11. a.The first bit is 0; this is a class A address. b.The first 4 bits are 1s; this is a class E address.

26 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Finding Class in Decimal Notation

27 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 4 Find the class of each address: a.227.12.14.87 b.252.5.15.111 c.134.11.78.56 Solution a. The first byte is 227 (between 224 and 239); the class is D. b.The first byte is 252 (between 240 and 255); the class is E. c.The first byte is 134 (between 128 and 191); the class is B.

28 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Unicast, Multicast and Reserved Addresses Unicast: One source to one destination Multicast: One source to a group of destinations. Multicast address can be used only as a destination address, but never as a source address. Class D: Multicasting. Only one block. Class E: Reserved addresses. Only one block.

29 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Netid, Hostid Netid: Network address. Hostid: Node address

30 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Blocks in class A First address in the block is used to identify the organization to the rest of the Internet. This address is called the network address; it defines the network of the organization, not individual hosts. The organization is not allowed to use the last address.

31 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.14 Blocks in class A

32 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.15 Blocks in Class B Sixteen blocks are reserved for private address.

33 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.16 Blocks in Class C Two hundred fifty-six blocks are used for private address. Designed for small organizations with a small number of computers.

34 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.17 Network Address Network address is an address that defines the network itself; it cannot be assigned to a host. All hostid bytes are 0s Defines the network to the rest of the Internet. First address in the block Given the network address, we can find the class of the address.

35 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 5 Given the address 23.56.7.91, find the network address. Solution The class is A. Only the first byte defines the netid. We can find the network address by replacing the hostid bytes (56.7.91) with 0s. Therefore, the network address is 23.0.0.0.

36 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 6 Given the address 132.6.17.85, find the network address. Solution The class is B. The first 2 bytes defines the netid. We can find the network address by replacing the hostid bytes (17.85) with 0s. Therefore, the network address is 132.6.0.0.

37 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 7 Given the network address 17.0.0.0, find the class. Solution The class is A because the netid is only 1 byte.

38 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 A Classful Sample internet

39 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.19 Levels of hierarchy Levels of Hierarchy To reach a host on the Internet, we must first reach the network by using the first portion of the address (netid) Then we must reach the host itself by using the second portion (hostid) IP addresses are designed with two levels of hierarchy.

40 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 SUBNETTING Sub-netting We can divide a network into sub-networks while making the world knows only the main network. In sub-netting, a network is divided into several smaller groups with each sub-network (or subnet) having its own sub-network address.

41 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.20 A network with three levels of hierarchy (subnetted)

42 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Three Level Hierarchy Adding subnetworks creates an intermediate level of hierarchy in the IP addressing system. Now we have three levels: site, subnet, and host. The site is the first level. The second level is the subnet. The host is the third level.

43 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Hierarchy in Telephone Number

44 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Mask A router routes the packet based on network address and subnetwork address. A router inside a network routes based on subnetwork address but a router outside a network routes based on network address. Router uses the 32-bit mask to identify the network address. Routers outside an organization use a default mask; the routers inside an organization use a subnet mask Default mask 32-bit binary number that gives the network address when ANDed with an address in the block.

45 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Table 19.1 Default masks Class In Binary In Dotted- Decimal Using Slash A 11111111 00000000 00000000 00000000255.0.0.0/8 B 11111111 11111111 00000000 00000000255.255.0.0/16 C 11111111 111111111 11111111 00000000255.255.255.0/24 Netid is retained and hostid sets to 0s.

46 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 8 A router outside the organization receives a packet with destination address 190.240.7.91. Show how it finds the network address to route the packet. Solution The router follows three steps: 1.The router looks at the first byte of the address to find the class. It is class B. 2.The default mask for class B is 255.255.0.0. The router ANDs this mask with the address to get 190.240.0.0. 3.The router looks in its routing table to find out how to route the packet to this destination. Later, we will see what happens if this destination does not exist.

47 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Subnet mask Number of 1s in a subnet mask is more than the number of 1s in the corresponding default mask. In a subnet mask, we change some of the leftmost 0s in the default mask to make a subnet mask.

48 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 9 A router inside the organization receives the same packet with destination address 190.240.33.91. Show how it finds the subnetwork address to route the packet. Solution The router follows three steps: 1.The router must know the mask. We assume it is /19, as shown in Figure 19.23. 2.The router applies the mask to the address, 190.240.33.91. The subnet address is 190.240.32.0. 3.The router looks in its routing table to find how to route the packet to this destination. Later, we will see what happens if this destination does not exist.

49 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Although class A and B addresses are almost depleted, class C addresses are still available. In supernetting, an organization can combine several class C blocks to create a larger range of addresses. Several networks are combined to create a supernetwork. Supernetting

50 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Classless Addressing A range of addresses meant a block of addresses in class A, B, or C. What about a small business that needed only 16 addresses? Or a household that needed only two addresses? ISPs provide IP; people connect via dial-up modem, DSL, or cable modem to the ISP. Variable-length blocks: No class boundaries. Mask: Provide a block, it is given the first address and mask. Subnetting Classless InterDomain Routing (CIDR)

51 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Dynamic Address Configuration Each computer has IP address, subnet mask, IP address of a router, IP address of a name server; This information is usually stored in a configuration file and accessed by the computer during the bootstrap (boot) process. Dynamic Host Configuration Protocol (DHCP) is a protocol designed to provide the information dynamically (based on demand). DHCP is a client-server program. When a DHCP client requests a temporary IP address, the DHCP server goes to the pool of available (unused) IP addresses and assigns an IP address for a negotiable period of time. When a DHCP client sends a request to a DHCP server, the server first checks its static database. If an entry with the requested physical address exists in the static database, the permanent IP address of the client is returned. On the other hand, if the entry does not exist in the static database, the server selects an IP address from the available pool, assigns the address to the client, and adds the entry to the dynamic database.

52 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Leasing Lease for a specific period of time. When the lease expires, the client must either stop using the IP address or renew the lease. The server can choose to agree or disagree to the renewal. If the server disagrees, the client stops using the address. Transition states Initializing state Client broadcasts a DHCP Discover message Selecting state After DHCP Discover, client is in this state. Servers provide IP address with DHCP OFFER [with lease duration]. Server locks this IP which is given via DHCP OFFER from being given to others. DHCP client chooses one of the offers and sends a DHCP REQUEST message to selected server and go to requesting state. If no OFFER message is received, client tries 4 more times with a time span of 2sec. If no reply then, client sleeps for 5 minutes and then tries again.

53 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Requesting state Client remains in this state until it receives DHCP ACK message from server which creates the binding between client’s physical address and its IP address. Bound State If 50% of the client lease is reached, client sends another DHCP REQUEST message and goes to renewing state. Client can cancel the lease and go to initializing state Renewing state Client remains in this state until one of two happens: If it receives DHCP ACK, it renews lease agreement and goes to bound state If no DHCP ACK is received by 87.5% of lease period, client goes to rebinding state. Rebinding state Remains in this state until one of three things happen: DHCPNACK or lease expires and goes to initializing state If DHCP ACK arrives, it goes to the bound state and resets the timer.

54 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Figure 19.24 DHCP transition diagram

55 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Table 19.2 Private Networks Range Total 10.0.0.0 to 10.255.255.2552 24 172.16.0.0 to 172.31.255.2552 20 192.168.0.0 to 192.168.255.2552 16 Any organization can use an address out of this set without permission from the Internet authorities. Everybody knows that these reserved addresses are for private networks. They are unique inside the organization, but are not unique globally. No router will forward a packet that has one of these address as the destination address.

56 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Network Address Translation (NAT) NAT enables a user to have a large set of addresses internally and one address, or a small set of addresses, externally. The traffic inside can use the large set; the traffic outside, the small set.

57 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Address translation All the outgoing packets go through the NAT router, which replaces the source address in the packet with the global NAT address. All incoming packets also pass through the NAT router, which replaces the destination address in the packet (the NAT router global address) with the appropriate private address.

58 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Translation Using one IP address: private address to external address mapping. Limitation is that only the private network can initiate a connection and not vice-versa. Only one request at a time.

59 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Table 19.3 Five-column translation table Private Address Private Port External Address External Port Transpor t Protocol 172.18. 3.1 140025.8.3.280TCP 172.18. 3.2 140125.8.3.280TCP... Using a pool of IP addresses More than one global address is there and we map to one of them. Limited by the number of global IP. Using both IP and port numbers Mapping with IPs and Port numbers.

60 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Routing Techniques When a host has a packet to send or when a router has received a packet to be forwarded, it looks at this table to find the route to final destination. Next-hop routing Routing table holds only the information that leads to the next hop instead of holding information about the complete route. Entries of a routing table must be consistent with each other. Routing

61 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Next-hop Routing

62 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Network-specific Routing Instead of having an entry for each host connected to the same physical network, we have only one entry to define the address of the network itself.

63 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Host-specific routing The destination host address is given in routing table. Although it is not efficient to put the host address in the routing table, there are occasions in which the administrator wants to have greater control over routing.

64 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Default Routing Instead of listing all networks in the entire Internet, host A can have one entry called the default (network address 0.0.0.0)

65 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Static routing table Static routing table contains information entered manually. Administrator enters the route for each destination into the table. Update is not automatic. Better used in small networks. Dynamic routing table Updated periodically using one of the dynamic routing protocols such as RIP, OSPF, or BGP Whenever there is a change in the Internet, such as a shutdown of a router or breaking of a link, the dynamic routing protocols update all the tables in the routers (and eventually in the host). Static versus Dynamic Routing

66 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Classful Address Routing Table In classful addressing, with or without subnetting, a routing table needs a minimum of four columns (it normally has more): mask, destination network address, next-hop address, and interface. When a packet arrives, the router applies the mask to the destination address to find the corresponding destination network address. If found, the packet is sent out from the corresponding interface in the table. If the destination network address is not found, the packet is delivered to the default interface which carries the packet to the default router.

67 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 10 Using the table in Figure 19.32, the router receives a packet for destination 192.16.7.1. For each row, the mask is applied to the destination address until a match with the destination address is found. In this example, the router sends the packet through interface m0 (host specific).

68 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 11 Using the table in Figure 19.32, the router receives a packet for destination 193.14.5.22. For each row, the mask is applied to the destination address until a match with the next-hop address is found. In this example, the router sends the packet through interface m2 (network specific).

69 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Example 12 Using the table in Figure 19.32, the router receives a packet for destination 200.34.12.34. For each row, the mask is applied to the destination address, but no match is found. In this example, the router sends the packet through the default interface m0.

70 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Routing table size In classful addressing, there is only one entry in the routing table for each site outside the organization. In classless, the entry can increase or decrease. It can decrease if the block of addresses assigned to an organization is larger than the block in classful addressing. It can increase if the classful blocks are sub-divided. Hierarchical routing ISP can sub-block its network and provide the outside world with the large block. Of course, inside the local ISP, the router must recognize the sub-blocks and route the packet to the destined customer. Geographic routing Divide the entire address space into geographical blocks. The routers of ISPs outside of Europe will have only one entry for packets to Europe in their routing tables. Routing table search algorithms: Its complex. Routing Table for Classless Addressing: CIDR

71 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 HOW to CALCULATE SUBNET ADDRESS The Subnet Address is obtained doing a binary AND between the IP address and the Subnet Mask. For example, if we have the IP 150.10.10.10 with a mask 255.255.252.0 (also written 150.10.10.10/22) The IP in binary is: 10010110.00001010.00001010.00001010 150.10.10.10 The mask is: 11111111.11111111.11111100.00000000 255.255.252.0 Binary AND --------------------------------------------------- Subnet Address: 10010110.00001010.00001000.00000000 150.10.8.0 HOW to CALCULATE Number of Hosts and Number of Subnets: The number of hosts is: 2^(number of host bits)-2. All host bits to "0" is the "Subnet Address" (also called "Network address" or "Network") and all to "1" is the Broadcast Address. The number of subnets is: 2^(number of subnet bits) if we tolerate all "0"s and all "1"s OR: 2^(number of subnet bits)-2 if not.

72 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 HOW to CALCULATE SUBNET ADDRESS For example: A Class B IP subneted has follows: nnnnnnnn.nnnnnnnn.sssssshh.hhhhhhhh (where "n"s represent the Network, "s"s the Subnet and "h"s the Host) Has got: 2^6=64 subnets and 2^10-2=1022 hosts For each subnet: The Subnet Address is nnnnnnnn.nnnnnnnn.ssssss00.00000000 And the Broadcast Address is nnnnnnnn.nnnnnnnn.ssssss11.11111111


Download ppt "McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 PART IV NETWORK LAYER."

Similar presentations


Ads by Google