720 likes | 750 Views
NETWORK LAYER. PART IV. Position of Network Layer. Network Layer Duties. Internetworking: Logically connecting heterogeneous networks to look like single network to upper transport and application layers.
E N D
NETWORK LAYER PART IV
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) DUTIES of NETWORK LAYER
Chapters Chapter 19 Host-to-Host Delivery Chapter 20 Network Layer Protocols Chapter 21 Unicast and Multicast Routing Protocols
INTERNETWORKS ADDRESSING ROUTING Concepts ROUTING protocols in Chap 21 OBJECTIVES
How can data be exchanged between networks? They need to be connected to make an internetwork. INTERNETWORKS
If a packet arrives at f1 of S1, how to make the right flow decision? MAC address can not help. Figure 19.2Links 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. Figure 19.3Network Layer in an internetwork
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. Figure 19.5Network Layer at a Router
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. Figure 19.6Network Layer at the Destination
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. Figure 19.7Switching
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
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. Figure 19.8Datagram Approach
Figure 19.8Datagram Approach Switching at the Network layer in the Internet is done using datagram approach to packet switching.
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.
OBJECTIVE 1: INTERNETWORKS Communication at the Network Layer in the Internet is connectionless.
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. IP ADDRESSING
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
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
The address space is divided into five classes: A, B, C, D and E Classful Addressing Fig. 19.10 Finding the class in binary notation
Example 3 Find the class of each address: a. 00000001 00001011 00001011 11101111 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.
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.
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. Unicast, Multicast and Reserved Addresses
Netid: Network address. Hostid: Node address Netid, Hostid
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. Blocks in class A
Sixteen blocks are reserved for private address. Figure 19.15Blocks in Class B
Two hundred fifty-six blocks are used for private address. Designed for small organizations with a small number of computers. Figure 19.16Blocks in Class C
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. Figure 19.17Network Address
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.
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.
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.
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. Figure 19.19Levels of hierarchy
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. SUBNETTING
Figure 19.20A network with three levels of hierarchy (subnetted)
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. Three Level Hierarchy
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. Mask
Table 19.1 Default masks Netid is retained and hostid sets to 0s.
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: • The router looks at the first byte of the address to find the class. It is class B. • 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. • 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.
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. Subnet mask
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: • The router must know the mask. We assume it is /19, as shown in Figure 19.23. • The router applies the mask to the address, 190.240.33.91. The subnet address is 190.240.32.0. • 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.
Supernetting 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.
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) Classless Addressing