Unit 3
Unit 3
Text Book
Behrouz .A. Forouzan, Data communication and Networking, Tata McGrawHill, 2004
1/1/2013
Network Layer
1/1/2013
1/1/2013
1/1/2013
Host-to-Host Delivery:
Internetworking, Addressing, and Routing
1/1/2013 Unit-3 : Network Layer 5
19.1 Internetworks
Need For Network Layer Internet As A Packet-Switched Network
1/1/2013
Figure 19.1
Internetwork
1/1/2013
Figure 19.2
Links in an internetwork
1/1/2013
Figure 19.3
1/1/2013
Figure 19.4
1/1/2013
10
Figure 19.5
1/1/2013
11
Figure 19.6
1/1/2013
12
Figure 19.7
Switching
1/1/2013
13
Figure 19.8
Datagram approach
1/1/2013
14
Note: Switching at the network layer in the Internet is done using the datagram approach to packet switching.
1/1/2013
15
1/1/2013
16
19.2 Addressing
Internet Address Classful Addressing Subnetting Supernetting Classless Addressing
1/1/2013
18
1/1/2013
19
Figure 19.9
Dotted-decimal notation
1/1/2013
20
Note: The binary, decimal, and hexadecimal number systems are reviewed in Appendix B.
1/1/2013
21
Example 1
Change the following IP addresses from binary notation to dotteddecimal notation. a. 10000001 00001011 00001011 11101111
b.
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
1/1/2013 Unit-3 : Network Layer 22
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. b. 01101111 00111000 00101101 01001110 01001011 00101101 00100010 01001110
Unit-3 : Network Layer 23
1/1/2013
Note: In classful addressing, the address space is divided into five classes: A, B, C, D, and E.
1/1/2013
24
Figure 19.10
1/1/2013
25
1/1/2013
26
Example 3
Find the class of each address: a. b. 00000001 00001011 00001011 11101111 11110011 10011011 11111011 00001111
Solution
See the procedure in Figure 19.11. a. b. The first bit is 0; this is a class A address. The first 4 bits are 1s; this is a class E address.
1/1/2013
27
Figure 19.12
1/1/2013
28
Example 4
Find the class of each address: a. b. c. 227.12.14.87 252.5.15.111 134.11.78.56
Solution
a. b. c. The first byte is 227 (between 224 and 239); the class is D. The first byte is 252 (between 240 and 255); the class is E. The first byte is 134 (between 128 and 191); the class is B.
1/1/2013
29
Figure 19.13
1/1/2013
30
Figure 19.14
Blocks in class A
1/1/2013
31
1/1/2013
32
Figure 19.15
Blocks in class B
1/1/2013
33
1/1/2013
34
Note: The number of addresses in class C is smaller than the needs of most organizations.
1/1/2013
35
Figure 19.16
Blocks in class C
1/1/2013
36
Figure 19.17
Network address
1/1/2013
37
Note: In classful addressing, the network address is the one that is assigned to the organization.
1/1/2013
38
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.
1/1/2013
39
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.
1/1/2013
40
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.
1/1/2013
41
Note: A network address is different from a netid. A network address has both netid and hostid, with 0s for the hostid.
1/1/2013
42
Figure 19.18
Sample internet
1/1/2013
43
1/1/2013
44
1/1/2013
45
1/1/2013
46
1/1/2013
47
Figure 19.22
1/1/2013
48
1/1/2013
49
Note: 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.
1/1/2013
50
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 1/1/2013 destination does not exist. Unit-3 : Network Layer 51
Figure 19.23
Subnet mask
1/1/2013
52
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.
1/1/2013 Unit-3 : Network Layer 53
Figure 19.24
1/1/2013
54
192.168.0.0 to
1/1/2013
55
Figure 19.25
NAT
1/1/2013
56
1/1/2013
57
1/1/2013
58
1/1/2013
59
19.3 Routing
Routing Techniques
Static Versus Dynamic Routing Routing Table for Classful Addressing
Figure 19.28
Next-hop routing
1/1/2013
61
Figure 19.29
Network-specific routing
1/1/2013
62
Figure 19.30
Host-specific routing
1/1/2013
63
Figure 19.31
Default routing
1/1/2013
64
Figure 19.32
1/1/2013
65
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).
1/1/2013
66
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).
1/1/2013
67
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.
1/1/2013
68
Routing Algorithms
1.Distance Vector Routing 2.Link State Routing
1/1/2013
69
Figure 21-18
1/1/2013
70
Figure 21-19
1/1/2013
71
Figure 21-20
1/1/2013
72
Figure 21-21
1/1/2013
73
Figure 21-22
1/1/2013
74
Figure 21-23
Example 21.1
1/1/2013
75
Figure 21-24
1/1/2013
76
Figure 21-25
1/1/2013
77
Figure 21-26
1/1/2013
78
Figure 21-27
Flooding of As LSP
1/1/2013
79
Figure 21-28
1/1/2013
80
Figure 21-29
1/1/2013
81
1/1/2013
82
1/1/2013
83
1/1/2013
84
1/1/2013
85
1/1/2013
86
1/1/2013
87
1/1/2013
88
1/1/2013
89
1/1/2013
90
1/1/2013
91
1/1/2013
92
1/1/2013
93
1/1/2013
94
Figure 21-32
1/1/2013
95