7/3/2015 Unit-3 : Network Layer 1 CS 1302 Computer Networks — Unit - 3 — — Network Layer — Text Book Behrouz.A. Forouzan, “Data communication and Networking”, Tata McGrawHill, 2004
Network Layer 7/3/20152Unit-3 : Network Layer
Position of network layer 7/3/20153Unit-3 : Network Layer
Network layer duties 7/3/20154Unit-3 : Network Layer
Host-to-Host Delivery: Internetworking, Addressing, and Routing 7/3/20155Unit-3 : Network Layer
19.1 Internetworks Need For Network Layer Internet As A Packet-Switched Network Internet As A Connectionless Network 7/3/20156Unit-3 : Network Layer
Figure 19.1 Internetwork 7/3/20157Unit-3 : Network Layer
Figure 19.2 Links in an internetwork 7/3/20158Unit-3 : Network Layer
Figure 19.3 Network layer in an internetwork 7/3/20159Unit-3 : Network Layer
Figure 19.4 Network layer at the source 7/3/201510Unit-3 : Network Layer
Figure 19.5 Network layer at a router 7/3/201511Unit-3 : Network Layer
Figure 19.6 Network layer at the destination 7/3/201512Unit-3 : Network Layer
Figure 19.7 Switching 7/3/201513Unit-3 : Network Layer
Figure 19.8 Datagram approach 7/3/201514Unit-3 : Network Layer
Switching at the network layer in the Internet is done using the datagram approach to packet switching. Note: 7/3/201515Unit-3 : Network Layer
Communication at the network layer in the Internet is connectionless. Note: 7/3/201516Unit-3 : Network Layer
19.2 Addressing Internet Address Classful Addressing Supernetting Subnetting Classless Addressing Dynamic Address Configuration Network Address Translation 7/3/201517Unit-3 : Network Layer
An IP address is a 32-bit address. Note: 7/3/201518Unit-3 : Network Layer
The IP addresses are unique and universal. Note: 7/3/201519Unit-3 : Network Layer
Figure 19.9 Dotted-decimal notation 7/3/201520Unit-3 : Network Layer
The binary, decimal, and hexadecimal number systems are reviewed in Appendix B. Note: 7/3/201521Unit-3 : Network Layer
Example 1 Change the following IP addresses from binary notation to dotted- decimal notation. a b Solution We replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots for separation: a b /3/201522Unit-3 : Network Layer
Example 2 Change the following IP addresses from dotted-decimal notation to binary notation. a b Solution We replace each decimal number with its binary equivalent (see Appendix B): a b /3/201523Unit-3 : Network Layer
In classful addressing, the address space is divided into five classes: A, B, C, D, and E. Note: 7/3/201524Unit-3 : Network Layer
Figure Finding the class in binary notation 7/3/201525Unit-3 : Network Layer
Figure Finding the address class 7/3/201526Unit-3 : Network Layer
Example 3 Find the class of each address: 0 a b Solution See the procedure in Figure 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. 7/3/201527Unit-3 : Network Layer
Figure Finding the class in decimal notation 7/3/201528Unit-3 : Network Layer
Example 4 Find the class of each address: a b c 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. 7/3/201529Unit-3 : Network Layer
Figure Netid and hostid 7/3/201530Unit-3 : Network Layer
Figure Blocks in class A 7/3/201531Unit-3 : Network Layer
Millions of class A addresses are wasted. Note: 7/3/201532Unit-3 : Network Layer
Figure Blocks in class B 7/3/201533Unit-3 : Network Layer
Many class B addresses are wasted. Note: 7/3/201534Unit-3 : Network Layer
The number of addresses in class C is smaller than the needs of most organizations. Note: 7/3/201535Unit-3 : Network Layer
Figure Blocks in class C 7/3/201536Unit-3 : Network Layer
Figure Network address 7/3/201537Unit-3 : Network Layer
In classful addressing, the network address is the one that is assigned to the organization. Note: 7/3/201538Unit-3 : Network Layer
Example 5 Given the address , 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 ( ) with 0s. Therefore, the network address is /3/201539Unit-3 : Network Layer
Example 6 Given the address , 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 /3/201540Unit-3 : Network Layer
Example 7 Given the network address , find the class. Solution The class is A because the netid is only 1 byte. 7/3/201541Unit-3 : Network Layer
A network address is different from a netid. A network address has both netid and hostid, with 0s for the hostid. Note: 7/3/201542Unit-3 : Network Layer
Figure Sample internet 7/3/201543Unit-3 : Network Layer
IP addresses are designed with two levels of hierarchy. Note: 7/3/201544Unit-3 : Network Layer
Figure A network with two levels of hierarchy 7/3/201545Unit-3 : Network Layer
Figure A network with three levels of hierarchy (subnetted) 7/3/201546Unit-3 : Network Layer
Figure Addresses in a network with and without subnetting 7/3/201547Unit-3 : Network Layer
Figure Hierarchy concept in a telephone number 7/3/201548Unit-3 : Network Layer
Table 19.1 Default masks Class In Binary In Dotted- Decimal Using Slash A /8 B /16 C /24 7/3/201549Unit-3 : Network Layer
The network address can be found by applying the default mask to any address in the block (including itself). It retains the netid of the block and sets the hostid to 0s. Note: 7/3/201550Unit-3 : Network Layer
Example 8 A router outside the organization receives a packet with destination address 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 The router ANDs this mask with the address to get 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. 7/3/201551Unit-3 : Network Layer
Figure Subnet mask 7/3/201552Unit-3 : Network Layer
Example 9 A router inside the organization receives the same packet with destination address 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 The router applies the mask to the address, The subnet address is 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. 7/3/201553Unit-3 : Network Layer
Figure DHCP transition diagram 7/3/201554Unit-3 : Network Layer
Table 19.2 Default masks Range Total to to to /3/201555Unit-3 : Network Layer
Figure NAT 7/3/201556Unit-3 : Network Layer
Figure Address translation 7/3/201557Unit-3 : Network Layer
Figure Translation 7/3/201558Unit-3 : Network Layer
Table 19.3 Five-column translation table Private Address Private Port External Address External Port Transport Protocol TCP TCP... 7/3/201559Unit-3 : Network Layer
19.3 Routing Routing Techniques Static Versus Dynamic Routing Routing Table for Classful Addressing Routing Table for Classless Addressing 7/3/201560Unit-3 : Network Layer
Figure Next-hop routing 7/3/201561Unit-3 : Network Layer
Figure Network-specific routing 7/3/201562Unit-3 : Network Layer
Figure Host-specific routing 7/3/201563Unit-3 : Network Layer
Figure Default routing 7/3/201564Unit-3 : Network Layer
Figure Classful addressing routing table 7/3/201565Unit-3 : Network Layer
Example 10 Using the table in Figure 19.32, the router receives a packet for destination 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). 7/3/201566Unit-3 : Network Layer
Example 11 Using the table in Figure 19.32, the router receives a packet for destination 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). 7/3/201567Unit-3 : Network Layer
Example 12 Using the table in Figure 19.32, the router receives a packet for destination 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. 7/3/201568Unit-3 : Network Layer
Routing Algorithms 1.Distance Vector Routing 2.Link State Routing 7/3/201569Unit-3 : Network Layer
Figure The Concept of Distance Vector Routing 7/3/201570Unit-3 : Network Layer
Figure Distance Vector Routing Table 7/3/201571Unit-3 : Network Layer
Figure Routing Table Distribution 7/3/201572Unit-3 : Network Layer
Figure Updating Routing Table for Router A 7/3/201573Unit-3 : Network Layer
Figure Final Routing Tables 7/3/201574Unit-3 : Network Layer
Figure Example /3/201575Unit-3 : Network Layer
Figure Concept of Link State Routing 7/3/201576Unit-3 : Network Layer
Figure Cost in Link State Routing 7/3/201577Unit-3 : Network Layer
Figure Link State Packet 7/3/201578Unit-3 : Network Layer
Figure Flooding of A’s LSP 7/3/201579Unit-3 : Network Layer
Figure Link State Database 7/3/201580Unit-3 : Network Layer
Figure Costs in the Dijkstra Algorithm 7/3/201581Unit-3 : Network Layer
Figure 21-30, Part I Shortest Path Calculation, Part I 7/3/201582Unit-3 : Network Layer
Figure 21-30, Part II Shortest Path Calculation, Part II 7/3/201583Unit-3 : Network Layer
Figure 21-30, Part III Shortest Path Calculation, Part III 7/3/201584Unit-3 : Network Layer
Figure 21-30, Part IV Shortest Path Calculation, Part IV 7/3/201585Unit-3 : Network Layer
Figure 21-30, Part V Shortest Path Calculation, Part V 7/3/201586Unit-3 : Network Layer
Figure 21-30, Part VI Shortest Path Calculation, Part VI 7/3/201587Unit-3 : Network Layer
Figure 21-31, Part VII Shortest Path Calculation, Part VII 7/3/201588Unit-3 : Network Layer
Figure 21-31, Part I Shortest Path Calculation, Part VIII 7/3/201589Unit-3 : Network Layer
Figure 21-31, Part II Shortest Path Calculation, Part IX 7/3/201590Unit-3 : Network Layer
Figure 21-31, Part III Shortest Path Calculation, Part X 7/3/201591Unit-3 : Network Layer
Figure 21-31, Part IV Shortest Path Calculation, Part XI 7/3/201592Unit-3 : Network Layer
Figure 21-31, Part V Shortest Path Calculation, Part XII 7/3/201593Unit-3 : Network Layer
Figure 21-31, Part VI Shortest Path Calculation, Part XIII 7/3/201594Unit-3 : Network Layer
Routing Table for Router A Figure /3/201595Unit-3 : Network Layer