Anda di halaman 1dari 188

Chapter 4 Introduction to Network Layer

TCP/IP Protocol Suite


Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter Outline

4.1 Introduction 4.2 Switching 4.3 Packet Switching

4.4 Network Layer Services


4.5 Other Network Layer Issues

TCP/IP Protocol Suite

4-1 INTRODUCTION
At the conceptual level, we can think of the global Internet as a black box network that connects millions (if not billions) of computers in the world together. At this level, we are only concerned that a message from the application layer in one computer reaches the application layer in another computer.

TCP/IP Protocol Suite

Figure 4.1 Internet as a block box

Application Transport Network Data link Physical

Message

Message

Application Transport Network Data link Physical

Internet
A B

TCP/IP Protocol Suite

Figure 4.2 Internet as a combination of LANs and WANs connected together

TCP/IP Protocol Suite

4-2 SWITCHING
From the previous discussion, it is clear that the passage of a message from a source to a destination involves many decisions. When a message reaches a connecting device, a decision needs to be made to select one of the output ports through which the packet needs to be send out. In other words, the connecting device acts as a switch that connects one port to another port.

TCP/IP Protocol Suite

Topics Discussed in the Section

Circuit Switching Packet Switching

TCP/IP Protocol Suite

Note

In circuit switching, the whole message is sent from the source to the destination without being divided into packets.

TCP/IP Protocol Suite

Example 4.1
A good example of a circuit-switched network is the early telephone systems in which the path was established between a caller and a callee when the telephone number of the callee was dialed by the caller. When the callee responded to the call, the circuit was established. The voice message could now flow between the two parties, in both directions, while all of the connecting devices maintained the circuit. When the caller or callee hung up, the circuit was disconnected. The telephone network is not totally a circuit-switched network today.

TCP/IP Protocol Suite

Note

In packet switching, the message is first divided into manageable packets at the source before being transmitted. The packets are assembled at the destination.

TCP/IP Protocol Suite

10

4-3 PACKET SWITHING


The network layer is designed as a packet-switched network. This means that the packet at the source is divided into manageable packets, normally called datagrams. Individual datagrams are then transferred from the source to the destination. The received datagrams are assembled at the destination before recreating the original message. The packet-switched network layer of the Internet was originally designed as a connectionless service, but recently there is a tendency to change this to a connection-oriented service.

TCP/IP Protocol Suite

11

Topics Discussed in the Section

Connectionless Service Connection-Oriented Service

TCP/IP Protocol Suite

12

Figure 4.3 A connectionless packet-switched network

Network

A connectionless packet-swtiched network


R1
4 3 2 1
2

R2

Sender
4

1
2
3

Network R4
4

1 3

1
R5

2
Receiver

R3

Out of order

TCP/IP Protocol Suite

13

Figure 4.4 Forwarding process in a connectionless network

Legend
Routing table

Destination Output address interface A 1 B 2

SA: Source address DA: Destination address

Destination address
SA DA Data
1

Send the packet out of interface 2

2 3 4

SA DA

Data

TCP/IP Protocol Suite

14

Note

In a connectionless packet-switched network, the forwarding decision is based on the destination address of the packet.

TCP/IP Protocol Suite

15

Figure 4.5 Delay in a connectionless network

Souce

Destination

Time

Time

Time

Time

Total delay

TCP/IP Protocol Suite

16

Figure 4.6 A connection-oriented packet switched network

1
4

3 2 1

TCP/IP Protocol Suite

17

Note

In a connection-oriented packet switched network, the forwarding decision is based on the label of the packet.

TCP/IP Protocol Suite

18

Figure 4.8 Sending request packet in a virtual-circuit network

A to B
Incoming Outgoing

Legend A to B Request packet


Virtual circuit

Network

Port Label Port Label 1 14 3

R1 1 3

A to B
A
2

2 4 R5

R2

Network

A to B
1 2 R3
3
3

2 1

A to B
R4

A to B

Incoming

Outgoing

Incoming

Outgoing

Port Label Port Label 3 1 66

Port Label Port Label 4 1 22

A to B
TCP/IP Protocol Suite

A to B
19

Figure 4.11 Delay in a connection-oriented network

Source

Destination

Setup

2
3
4

Total delay

Transmission time

Teardown

6
7

Time

Time

Time

Time

TCP/IP Protocol Suite

20

Chapter 4

IP Addresses: Classful Addressing


Objectives
Upon completion you will be able to: Understand IPv4 addresses and classes Identify the class of an IP address Find the network address given an IP address Understand masks and how to use them Understand subnets and supernets
TCP/IP Protocol Suite

21

4.1 INTRODUCTION
The identifier used in the IP layer of the TCP/IP protocol suite to identify each device connected to the Internet is called the Internet address or IP address. An IP address is a 32-bit address that uniquely and universally defines the connection of a host or a router to the Internet. IP addresses are unique. They are unique in the sense that each address defines one, and only one, connection to the Internet. Two devices on the Internet can never have the same address.

The topics discussed in this section include: Address Space Notation

TCP/IP Protocol Suite

22

Note: An IP address is a 32-bit address.

TCP/IP Protocol Suite

23

Note: The IP addresses are unique.

TCP/IP Protocol Suite

24

Note: The address space of IPv4 is 232 or 4,294,967,296.

TCP/IP Protocol Suite

25

Figure 4.1

Dotted-decimal notation

TCP/IP Protocol Suite

26

Example
Change the following IP addresses from dotted decimal notation to binary notation.

a. 114.34.2.8
b. 129.14.6.8 c. 208.34.54.12 d. 238.34.2.1 Solution a. 01110010 00100010 00000010 00001000
b. 10000001 00001110 00000110 00001000 c. 11010000 00100010 00110110 00001100 d. 11101110 00100010 00000010 00000001

TCP/IP Protocol Suite

27

Note:
The binary, decimal, and hexadecimal number systems are reviewed in Appendix B.

TCP/IP Protocol Suite

28

Example 1
Change the following IP addresses from binary notation to dotted-decimal notation.

a. 10000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111 c. 11100111 11011011 10001011 01101111 d. 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 c. 231.219.139.111
TCP/IP Protocol Suite

b. 193.131.27.255 d. 249.155.251.15
29

Example 2
Change the following IP addresses from dotted-decimal notation to binary notation. a. 111.56.45.78 c. 241.8.56.12 b. 221.34.7.82 d. 75.45.34.78

Solution
We replace each decimal number with its binary equivalent:

a. 01101111 00111000 00101101 01001110 b. 11011101 00100010 00000111 01010010 c. 11110001 00001000 00111000 00001100 d. 01001011 00101101 00100010 01001110
TCP/IP Protocol Suite

30

Example 3
Find the error, if any, in the following IP addresses: a. 111.56.045.78 b. 221.34.7.8.20

c. 75.45.301.14

d. 11100010.23.14.67

Solution
a. There are no leading zeroes in dotted-decimal notation (045). b. We may not have more than four numbers in an IP address. c. In dotted-decimal notation, each number is less than or equal to 255; 301 is outside this range. d. A mixture of binary notation and dotted-decimal notation is not allowed.
TCP/IP Protocol Suite

31

Example 4
Change the following IP addresses from binary notation to hexadecimal notation.

a. 10000001 00001011 00001011 11101111


b. 11000001 10000011 00011011 11111111 Solution We replace each group of 4 bits with its hexadecimal equivalent (see Appendix B). Note that hexadecimal notation normally has no added spaces or dots; however, 0X (or 0x) is added at the beginning or the subscript 16 at the end to show that the number is in hexadecimal. a. 0X810B0BEF or 810B0BEF16 b. 0XC1831BFF or C1831BFF16
TCP/IP Protocol Suite

32

4.2 CLASSFUL ADDRESSING


IP addresses, when started a few decades ago, used the concept of classes. This architecture is called classful addressing. In the mid-1990s, a new architecture, called classless addressing, was introduced and will eventually supersede the original architecture. However, part of the Internet is still using classful addressing, but the migration is very fast. The topics discussed in this section include:

Recognizing Classes Netid and Hostid Classes and Blocks Network Addresses Sufficient Information Mask CIDR Notation Address Depletion
TCP/IP Protocol Suite

33

Figure 4.2

Occupation of the address space

TCP/IP Protocol Suite

34

Figure 4.3

Finding the class in binary notation

TCP/IP Protocol Suite

35

Example 5
How can we prove that we have 2,147,483,648 addresses in class A?

Solution In class A, only 1 bit defines the class. The remaining 31 bits are available for the address. With 31 bits, we can have 231 or 2,147,483,648 addresses.

TCP/IP Protocol Suite

36

Example 6
Find the class of each address: a. 00000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111 c. 10100111 11011011 10001011 01101111 d. 11110011 10011011 11111011 00001111 Solution See the procedure in Figure 4.4. a. The first bit is 0. This is a class A address. b. The first 2 bits are 1; the third bit is 0. This is a class C address. c. The first bit is 0; the second bit is 1. This is a class B address. d. The first 4 bits are 1s. This is a class E address..
TCP/IP Protocol Suite

37

Figure 4.5

Finding the class in decimal notation

TCP/IP Protocol Suite

38

Example 7
Find the class of each address: a. 227.12.14.87 d. 252.5.15.111 b.193.14.56.22 e.134.11.78.56 c.14.23.120.8

Solution a. The first byte is 227 (between 224 and 239); the class is D. b. The first byte is 193 (between 192 and 223); the class is C. c. The first byte is 14 (between 0 and 127); the class is A. d. The first byte is 252 (between 240 and 255); the class is E. e. The first byte is 134 (between 128 and 191); the class is B.

TCP/IP Protocol Suite

39

Figure 4.6

Netid and hostid

TCP/IP Protocol Suite

40

Figure 4.7

Blocks in class A

TCP/IP Protocol Suite

41

Figure 4.8

Blocks in class B

TCP/IP Protocol Suite

42

Figure 4.9

Blocks in class C

TCP/IP Protocol Suite

43

Example 9
Given the network address 17.0.0.0, find the class, the block, and the range of the addresses.

Solution The class is A because the first byte is between 0 and 127. The block has a netid of 17. The addresses range from 17.0.0.0 to 17.255.255.255.

TCP/IP Protocol Suite

44

Example 10
Given the network address 132.21.0.0, find the class, the block, and the range of the addresses.

Solution The class is B because the first byte is between 128 and 191. The block has a netid of 132.21. The addresses range from 132.21.0.0 to 132.21.255.255.

TCP/IP Protocol Suite

45

Example 11
Given the network address 220.34.76.0, find the class, the block, and the range of the addresses.

Solution The class is C because the first byte is between 192 and 223. The block has a netid of 220.34.76. The addresses range from 220.34.76.0 to 220.34.76.255.

TCP/IP Protocol Suite

46

If the network address is given, we can find the block and the range of addresses in the block. What about the reverse??? If the address is given, can we find the network address??? If there is no subnets. Then we can use the concept of MASK

TCP/IP Protocol Suite

47

Figure 4.10

Masking concept

TCP/IP Protocol Suite

48

Figure 4.11 AND operation

TCP/IP Protocol Suite

49

Table 4.2 Default masks

TCP/IP Protocol Suite

50

Example 12
Given the address 23.56.7.91, find the beginning address (network address).

Solution The default mask is 255.0.0.0, which means that only the first byte is preserved and the other 3 bytes are set to 0s. The network address is 23.0.0.0.

TCP/IP Protocol Suite

51

Example 13
Given the address 132.6.17.85, find the beginning address (network address).

Solution The default mask is 255.255.0.0, which means that the first 2 bytes are preserved and the other 2 bytes are set to 0s. The network address is 132.6.0.0.

TCP/IP Protocol Suite

52

Example 14
Given the address 201.180.56.5, find the beginning address (network address).

Solution The default mask is 255.255.255.0, which means that the first 3 bytes are preserved and the last byte is set to 0. The network address is 201.180.56.0.

TCP/IP Protocol Suite

53

4.3 OTHER ISSUES


In this section, we discuss some other issues that are related to addressing in general and classful addressing in particular.

The topics discussed in this section include: Multihomed Devices Location, Not Names Special Addresses Private Addresses Unicast, Multicast, and Broadcast Addresses

TCP/IP Protocol Suite

54

Table 4.3 Special addresses

TCP/IP Protocol Suite

55

Figure 4.13

Network address

TCP/IP Protocol Suite

56

Figure 4.14

Example of direct broadcast address

TCP/IP Protocol Suite

57

Figure 4.18

Example of loopback address

Is used to test the IP software on the machine. When this address is used, packet will never leave the machine. It simply return to the protocol software

TCP/IP Protocol Suite

58

Table 4.5 Addresses for private networks

A number of blocks in each class are assigned for private use. These addresses are used either in isolation or in connection with network address translation techniques.

TCP/IP Protocol Suite

59

Example
A router has an IP address of 108.5.18.22. It sends a direct broadcast packet to all the host in the network. What are the source and destination IP addresses used in this packet

Solution
Source address: 108.5.18.22 Destination address: 108.255.255.255

TCP/IP Protocol Suite

60

Example
A router has an IP address of 185.67.89.34 needs loopback testing. What are the source and destination IP addresses

Solution
Source address: 185.67.89.34 Destination address: 127.X.Y.Z

TCP/IP Protocol Suite

61

4.4 SUBNETTING AND SUPERNETTING


In the previous sections we discussed the problems associated with classful addressing. Specifically, the network addresses available for assignment to organizations are close to depletion. This is coupled with the ever-increasing demand for addresses from organizations that want connection to the Internet. In this section we briefly discuss a solution: subnetting

The topics discussed in this section include: Subnetting Supernetting Supernet Mask Obsolescence

TCP/IP Protocol Suite

62

Note:
IP addresses are designed with two levels of hierarchy.

TCP/IP Protocol Suite

63

Figure 4.20

A network with two levels of hierarchy (not subnetted)

TCP/IP Protocol Suite

64

Figure 4.21

A network with three levels of hierarchy (subnetted)

Network (Site) Subnet Host

TCP/IP Protocol Suite

65

Figure 4.22

Addresses in a network with and without subnetting

TCP/IP Protocol Suite

66

Figure 4.23

Hierarchy concept in a telephone number

TCP/IP Protocol Suite

67

Introduction to Subnetting

To create a subnet address, a network administrator borrows bits from the host field and designates them as the subnet field.

TCP/IP Protocol Suite

68

Subnetting

To allocate a part of the host address space to network addresses and leave the remaining part to other physical networks It can get most out of the limited 32-bit IP address space and reduce the size of the routing table in a large internetwork A netmask to determine which bits in the IP address space represent the sub-network addresses
69

TCP/IP Protocol Suite

Introduction to Subnetting

Host bits must be reassigned (or borrowed) as network bits. The starting point is always the leftmost host bit.

3 bits borrowed allows 23-2 or 6 subnets

5 bits borrowed allows 25-2 or 30 subnets

TCP/IP Protocol Suite

12 bits borrowed allows 212-2 or 4094 subnets 70

Figure 4.24

Default mask and subnet mask

TCP/IP Protocol Suite

71

Example 15
What is the subnetwork address if the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0? Solution We apply the AND operation on the address and the subnet mask.
Address Subnet Mask

11001000 00101101 00100010 00111000 11111111 11111111 11110000 00000000

Subnetwork Address 11001000 00101101 00100000 00000000.


Subnetwork address 200.45.32.0
TCP/IP Protocol Suite

72

Figure 4.25

Comparison of a default mask and a subnet mask

TCP/IP Protocol Suite

73

Figure 4.27

Comparison of subnet, default, and supernet masks

TCP/IP Protocol Suite

74

Example
Find the contiguous mask in each case a) 1024 subnets in Class A

b) 256 subnets in Class B


c) 32 subnets in Class C d) 4 subnets in Class C Solution
a. 2x = 1024 x = log21024 = 10 b. 2x = 256 x = log2256 = 8 c. 2x = 32 x = log232 = 5 d. 2x = 4 x = log24 = 2 mask mask mask mask is is is is 255.255.192.0 255.255.255.0 255.255.255.248 255.255.255.192

TCP/IP Protocol Suite

75

Example
What is the maximum number of subnets in each area a) Class A: mask 255.255.192.0

b) Class B: mask 255.255.192.0


c) Class C: mask 255.255.255.192 d) Class C: mask 255.255.255.240 Solution
a. 10 extra 1s b. 2 extra 1s c. 2 extra 1s d. 4 extra 1s 210 = 1024 subnets 22 = 4 subnets 22 = 4 subnets 24 = 16 subnets

TCP/IP Protocol Suite

76

Example
Given a Host IP address 192.168.45.32 and Subnet mask of 255.255.255.128. Calculate the following Number of Subnet bits Maximum number of Subnets Number of Host bits

Maximum number of hosts


Subnetwork Address Broadcast Address

Show subnets
(Subnetwork address, valid host, broadcast address)
TCP/IP Protocol Suite

77

Answer
Number of Subnet bits - 1 Maximum number of Subnets - 2 Number of Host bits - 7 Maximum number of hosts - 126

Subnetwork Address 195.168.45.0


Broadcast Address 195.168.45.127 Show subnets
Subnet 192.168.45.0
192.168.45.128

Valid Hosts 192.168.45.1 to 192.168.45.126


192.168.45.129 to 192.168.45.254

Broadcast 192.168.45.127
192.168.45.255

(Subnetwork address, valid host, broadcast address)


TCP/IP Protocol Suite

78

Example
Given a Host IP address 221.131.72.32 and Subnet mask of 255.255.255.224. Calculate the following

Number of Subnet bits


Maximum number of Subnets Number of Host bits

Maximum number of hosts


Subnetwork Address Broadcast Address Show first 12 subnets (Subnetwork address, valid host, broadcast address)
TCP/IP Protocol Suite

79

Answer
Number of Subnet bits -3
Maximum number of Subnets - 8 Number of Host bits -5

Maximum number of hosts - 30


Subnetwork Address 221.131.72.32 Broadcast Address 221.131.72.63 Show first 12 subnets
Subnet , Valid Hosts , Broadcast 221.131.72.32 , 221.131.72.33 to 221.131.72.62 , 221.131.72.63 221.131.72.64 , 221.131.72.65 to 221.131.72.94 , 221.131.72.95 221.131.72.96 , 221.131.72.97 to 221.131.72.126 , 221.131.72.127 221.131.72.128 , 221.131.72.129 to 221.131.72.158 , 221.131.72.159 221.131.72.160 , 221.131.72.161 to 221.131.72.190 , 221.131.72.191 221.131.72.192 , 221.131.72.193 to 221.131.72.222 , 221.131.72.223 221.131.72.224 , 221.131.72.225 to 221.131.72.254 , 221.131.72.255

TCP/IP Protocol Suite

80

Chapter 5

IP Addresses: Classless Addressing


Objectives
Upon completion you will be able to: Understand the concept of classless addressing Be able to find the first and last address given an IP address Be able to find the network address given a classless IP address Be able to create subnets from a block of classless IP addresses Understand address allocation and address aggregation
TCP/IP Protocol Suite

81

5.1 VARIABLE-LENGTH BLOCKS


In classless addressing variable-length blocks are assigned that belong to no class. In this architecture, the entire address space (232 addresses) is divided into blocks of different sizes.

The topics discussed in this section include: Restrictions Finding the Block Granted Block

TCP/IP Protocol Suite

82

Figure 5.2

Format of classless addressing address

In classless addressing the address must always be accompanied by the mask Written in CIDR (Classless InterDomain Routing) notation
83

TCP/IP Protocol Suite

Prefix and Suffix

The slash (/n) defines the number of bits (prefix length) that defines the network (~netid). n is the number of ones (1) in the mask The remaining bits (32 n) are the bits left for the suffix (~hostid)

TCP/IP Protocol Suite

84

Example
a. b. c. d.

Write the following mask in slash notation 255.255.255.0 255.0.0.0 255.255.224.0 255.255.240.0

Answer

TCP/IP Protocol Suite

85

Example

Find the range of addresses in the following block a. 123.56.77.32/29 Answer

TCP/IP Protocol Suite

86

Example

Find the range of addresses in the following block 200.17.21.128/27 Answer

TCP/IP Protocol Suite

87

Table 5.1 Prefix lengths

TCP/IP Protocol Suite

88

Note:
Classful addressing is a special case of classless addressing.

TCP/IP Protocol Suite

89

Network, First and Last Addresses

First address in the block can be found by ANDing the mask with the address or by setting the suffix bits (32 n) all to 0s Number of addresses in the block can be found using 232-n Last address in the block is found by setting the suffix bits all to 1s

TCP/IP Protocol Suite

90

Example 4

What is the first address in the block if one of the addresses is 167.199.170.82/27? Solution The prefix length is 27, which means that we must keep the first 27 bits as is and change the remaining bits (5) to 0s. The following shows the process: Address in binary: 10100111 11000111 10101010 Keep the left 27 bits: 10100111 11000111 10101010 Result in CIDR notation: 167.199.170.64/27
TCP/IP Protocol Suite

01010010

01000000

91

Example 5

What is the first address in the block if one of the addresses is 140.120.84.24/20? Solution Figure 5.3 shows the solution. The first, second, and fourth bytes are easy; for the third byte we keep the bits corresponding to the number of 1s in that group. The first address is 140.120.80.0/20. See Next Slide
TCP/IP Protocol Suite

92

Figure 5.3

Example 5

TCP/IP Protocol Suite

93

Example 6

Find the first address in the block if one of the addresses is 140.120.84.24/20. Solution The first, second, and fourth bytes are as defined in the previous example. To find the third byte, we write 84 as the sum of powers of 2 and select only the leftmost 4 (m is 4) as shown in Figure 5.4. The first address is 140.120.80.0/20. See Next Slide
TCP/IP Protocol Suite

94

Figure 5.4

Example 6

TCP/IP Protocol Suite

95

Example 7

Find the number of addresses in the block if one of the addresses is 140.120.84.24/20.

Solution The prefix length is 20. The number of addresses in the block is 23220 or 212 or 4096. Note that this is a large block with 4096 addresses.

TCP/IP Protocol Suite

96

Example 8

Using the first method, find the last address in the block if one of the addresses is 140.120.84.24/20. Solution We found in the previous examples that the first address is 140.120.80.0/20 and the number of addresses is 4096. To find the last address, we need to add 4095 (4096 1) to the first address. See Next Slide
TCP/IP Protocol Suite

97

Example 8 (Continued)

To keep the format in dotted-decimal notation, we need to represent 4095 in base 256 (see Appendix B) and do the calculation in base 256. We write 4095 as 15.255. We then add the first address to this number (in base 255) to obtain the last address as shown below:
140 . 120 . 80 . 0 15 . 255 ------------------------140 . 120 . 95 . 255

The last address is 140.120.95.255/20.


TCP/IP Protocol Suite

98

Example 9

Using the second method, find the last address in the block if one of the addresses is 140.120.84.24/20. Solution The mask has twenty 1s and twelve 0s. The complement of the mask has twenty 0s and twelve 1s. In other words, the mask complement is 00000000 00000000 00001111 11111111

or 0.0.15.255. We add the mask complement to the beginning address to find the last address.
See Next Slide
TCP/IP Protocol Suite

99

Example 9

(Continued)

We add the mask complement to the beginning address to find the last address. 140 . 120 . 80 . 0 0 . 0 . 15 . 255 ---------------------------140 . 120 . 95 . 255

The last address is 140.120.95.255/20.

TCP/IP Protocol Suite

100

Example 10

Find the block if 190.87.140.202/29.

one

of

the

addresses

is

Solution We follow the procedure in the previous examples to find the first address, the number of addresses, and the last address. To find the first address, we notice that the mask (/29) has five 1s in the last byte. So we write the last byte as powers of 2 and retain only the leftmost five as shown below: See Next Slide
TCP/IP Protocol Suite

101

Example 10 (Continued)

202

128 + 64 + 0 + 0 + 8 + 0 + 2 + 0

The leftmost 5 numbers are 128 + 64 + 0 + 0 + 8

The first address is 190.87.140.200/29 The number of addresses is 23229 or 8. To find the last address, we use the complement of the mask. The mask has twenty-nine 1s; the complement has three 1s. The complement is 0.0.0.7. If we add this to the first address, we get 190.87.140.207/29. In other words, the first address is 190.87.140.200/29, the last address is 190.87.140.207/29. There are only 8 addresses in this block.
TCP/IP Protocol Suite

102

Example 11
Show a network configuration for the block in the previous example. Solution The organization that is granted the block in the previous example can assign the addresses in the block to the hosts in its network. However, the first address needs to be used as the network address and the last address is kept as a special address (limited broadcast address). Figure 5.5 shows how the block can be used by an organization. Note that the last address ends with 207, which is different from the 255 seen in classful addressing.

See Next Slide


TCP/IP Protocol Suite

103

Figure 5.5

Example 11

TCP/IP Protocol Suite

104

Note: In classless addressing, the last address in the block does not necessarily end in 255.

TCP/IP Protocol Suite

105

Note:
In CIDR notation, the block granted is defined by the first address and the prefix length.

TCP/IP Protocol Suite

106

5.2 SUBNETTING
When an organization is granted a block of addresses, it can create subnets to meet its needs. The prefix length increases to define the subnet prefix length.

The topics discussed in this section include: Finding the Subnet Mask Finding the Subnet Addresses Variable-Length Subnets

TCP/IP Protocol Suite

107

Note:
In fixed-length subnetting, the number of subnets is a power of 2.

TCP/IP Protocol Suite

108

Example 12

An organization is granted the block 130.34.12.64/26. The organization needs 4 subnets. What is the subnet prefix length? Solution We need 4 subnets, which means we need to add two more 1s (log2 4 = 2) to the site prefix. The subnet prefix is then /28.

TCP/IP Protocol Suite

109

Example 12-1

In Fixed length subnetting find the number of 1s that must be added to the mask if the number of desired subnets is a. 2 b. 62 c. 122 Solution d. 250

TCP/IP Protocol Suite

110

Example 12-2

What is the maximum number of subnets if the prefix length of a block is a. 18 b. 10 c. 27 Solution d. 31

TCP/IP Protocol Suite

111

Example 13

What are the subnet addresses and the range of addresses for each subnet in the previous example-12? Solution Figure 5.6 shows one configuration. See Next Slide

TCP/IP Protocol Suite

112

Example 13 (Continued)

The site has 23226 = 64 addresses. Each subnet has 23228 = 16 addresses. Now let us find the first and last address in each subnet.
1. The first address in the first subnet is 130.34.12.64/28, using the procedure we showed in the previous examples. Note that the first address of the first subnet is the first address of the block. The last address of the subnet can be found by adding 15 (16 1) to the first address. The last address is 130.34.12.79/28.

See Next Slide


TCP/IP Protocol Suite

113

Example 13 (Continued)
2.The first address in the second subnet is 130.34.12.80/28; it is found by adding 1 to the last address of the previous subnet. Again adding 15 to the first address, we obtain the last address, 130.34.12.95/28. 3. Similarly, we find the first address of the third subnet to be 130.34.12.96/28 and the last to be 130.34.12.111/28. 4. Similarly, we find the first address of the fourth subnet to be 130.34.12.112/28 and the last to be 130.34.12.127/28.
TCP/IP Protocol Suite

114

Figure 5.6

Example 13

TCP/IP Protocol Suite

115

Example 14
An organization is granted a block of addresses with the beginning address 14.24.74.0/24. There are 23224= 256 addresses in this block. The organization needs to have 11 subnets as shown below: a. two subnets, each with 64 addresses.

b. two subnets, each with 32 addresses.


c. three subnets, each with 16 addresses. d. four subnets, each with 4 addresses. Design the subnets.

See Next Slide For One Solution


TCP/IP Protocol Suite

116

Example 14 (Continuted)

1. We use the first 128 addresses for the first two subnets, each with 64 addresses. Note that the mask for each network is /26.
1st subnet 14.24.74.00 000000/26 2nd 14.24.74.01 000000/26 14.24.74.0/26 2nd 14.24.74.64/26

2. We use the next 64 addresses for the next two subnets, each with 32 addresses. Note that the mask for each network is /27.
1st subnet 14.24.74.100 00000/27 2nd 14.24.74.10100000/27 14.24.74.128/27
TCP/IP Protocol Suite

2nd 14.24.74.160/27
117

See Next Slide

Example 14 (Continuted)

3. We use the next 48 addresses for the next three subnets, each with 16 addresses. Note that the mask for each network is /28.
1st subnet 14.24.74.1100 0000/28 2nd 1101 = 208 3rd 1110 14.24.74.192/27 14.24.74.208/27 14.24.74.224/27

4. We use the last 16 addresses for the last four subnets,


each with 4 addresses. Note that the mask for each network is /30. The subnet address for each subnet is given in the figure.
1st subnet 14.24.74.111100/30 = 240 2nd 111101/30 = 244 3rd 111110/30 = 248 4th = 111111/30 = 252 14.24.74.240/30 14.24.74.248/30 14.24.74.244/30 14.24.74.252/30

TCP/IP Protocol Suite

118

Figure 5.7

Example 14

TCP/IP Protocol Suite

119

Example 15

As another example, assume a company has three offices: Central, East, and West. The Central office is connected to the East and West offices via private, point-to-point WAN lines. The company is granted a block of 64 addresses with the beginning address 70.12.100.128/26. The management has decided to allocate 32 addresses for the Central office and divides the rest of addresses between the two offices. Figure 5.8 shows the configuration designed by the management.
See Next Slide
TCP/IP Protocol Suite

120

Example 15 (Continued)
The company will have three subnets, one at Central, one at East, and one at West. The following lists the subblocks allocated for each network: a. The Central office uses the network address 70.12.100.128/27. This is the first address, and the mask /27 shows that there are 32 addresses in this network. Note that three of these addresses are used for the routers and the company has reserved the last address in the sub-block. The addresses in this subnet are 70.12.100.128/27 to 70.12.100.159/27. Note that the interface of the router that connects the Central subnet to the WAN needs no address because it is a point-topoint connection.
TCP/IP Protocol Suite

See Next Slide

121

Example 15 (Continued)

b. The West office uses the network address 70.12.100.160/28. The mask /28 shows that there are only 16 addresses in this network. Note that one of these addresses is used for the router and the company has reserved the last address in the sub-block. The addresses in this subnet are 70.12.100.160/28 to 70.12.100.175/28. Note also that the interface of the router that connects the West subnet to the WAN needs no address because it is a point-to- point connection.

See Next Slide


TCP/IP Protocol Suite

122

Example 15 (Continued)

c. The East office uses the network address 70.12.100.176/28. The mask /28 shows that there are only 16 addresses in this network. Note that one of these addresses is used for the router and the company has reserved the last address in the sub-block. The addresses in. this subnet are 70.12.100.176/28 to 70.12.100.191/28. Note also that the interface of the router that connects the East subnet to the WAN needs no address because it is a point-to-point connection.

TCP/IP Protocol Suite

123

Figure 5.8

Example 15

TCP/IP Protocol Suite

124

5.3 ADDRESS ALLOCATION


Address allocation is the responsibility of a global authority called the Internet Corporation for Assigned Names and Addresses (ICANN). It usually assigns a large block of addresses to an ISP to be distributed to its Internet users.

TCP/IP Protocol Suite

125

Example 16

An ISP is granted a block of addresses starting with 190.100.0.0/16 (65,536 addresses). The ISP needs to distribute these addresses to three groups of customers as follows:
a. The first group has 64 customers; each needs 256 addresses. b. The second group has 128 customers; each needs 128 addresses c. The third group has 128 customers; each needs 64 addresses.

See Next Slide


TCP/IP Protocol Suite

126

Example 16 (Continued)

Design the subblocks and find out how many addresses are still available after these allocations. Solution Figure 5.9 shows the situation.

See Next Slide

TCP/IP Protocol Suite

127

Figure 5.9

Example 16

TCP/IP Protocol Suite

128

Example 16 (Continued) Group 1 For this group, each customer needs 256 addresses. This means the suffix length is 8 (28 =256). The prefix length is then 32 8 = 24. The addresses are:
1st Customer 190.100.0.0/24 2nd Customer 190.100.1.0/24 ... 64th Customer 190.100.63.0/24 Total = 64 256 = 16,384 190.100.0.255/24 190.100.1.255/24
190.100.63.255/24

See Next Slide


TCP/IP Protocol Suite

129

Example 16 (Continued)

Group 2 For this group, each customer needs 128 addresses. This means the suffix length is 7 (27 =128). The prefix length is then 32 7 = 25. The addresses are:
1st Customer 2nd Customer 128th Customer 190.100.64.0/25 190.100.64.128/25 190.100.64.127/25 190.100.64.255/25

190.100.127.128/25 190.100.127.255/25

Total = 128 128 = 16,384

See Next Slide


TCP/IP Protocol Suite

130

TCP/IP Protocol Suite

131

Example 16 (continued)

Group 3 For this group, each customer needs 64 addresses. This means the suffix length is 6 (26 = 64). The prefix length is then 32 6 = 26. The addresses are:
1st Customer
2nd Customer 128th Customer

190.100.128.0/26
190.100.128.64/26

190.100.128.63/26
190.100.128.127/26

190.100.159.192/26 190.100.159.255/26

Total = 128 64 = 8,192

See Next Slide


TCP/IP Protocol Suite

132

Example 16 (continued)

Number of granted addresses to the ISP: 65,536 Number of allocated addresses by the ISP: 40,960 Number of available addresses: 24,576

TCP/IP Protocol Suite

133

26.3 NETWORK ADDRESS TRANSLATION (NAT)


Network address translation (NAT) allows a site to use a set of private addresses for internal communication and a set of global Internet addresses for communication with another site. The site must have only one single connection to the global Internet through a router that runs NAT software.

The topics discussed in this section include: Address Translation Translation Table NAT and ISP

TCP/IP Protocol Suite

134

Figure 26.6

NAT

TCP/IP Protocol Suite

135

Figure 26.7

Address translation

TCP/IP Protocol Suite

136

Figure 26.8

Translation

TCP/IP Protocol Suite

137

Chapter 6

Delivery, Forwarding, and Routing of IP Packets


Objectives
Upon completion you will be able to:
Understand the different types of delivery and the connection Understand forwarding techniques in classful addressing Understand forwarding techniques in classless addressing Understand how a routing table works Understand the structure of a router
TCP/IP Protocol Suite

138

6.1 DELIVERY
The network layer supervises delivery, the handling of the packets by the underlying physical networks. Two important concepts are the type of connection and direct versus indirect delivery.

The topics discussed in this section include: Connection Types Direct Versus Indirect Delivery

TCP/IP Protocol Suite

139

Delivery

The network layer supervises delivery, the handling of the packets by the underlying physical networks Two important concepts are the type of connection and direct versus indirect delivery

TCP/IP Protocol Suite

140

Delivery

Direct Delivery: where the destination is on the current network (always one at the end of a route) Indirect Delivery: where the destination is on a remote network so the packet must be passed to another router to be delivered (can be zero or more indirect deliveries)

TCP/IP Protocol Suite

141

Figure 6.1

Direct delivery

TCP/IP Protocol Suite

142

Figure 6.2

Indirect delivery

TCP/IP Protocol Suite

143

Example

A host with IP address 137.23.56.23/16 sends a packet to a host with IP address 137.23.67.9/16. Is the delivery direct or indirect? Assume no subnetting.

Answer
Direct; both hosts are on the same network (same netid, 137.23).

TCP/IP Protocol Suite

144

Example

A host with IP address 137.23.56.23/16 sends a packet to a host with IP address 137.23.67.9/16. Is the delivery direct or indirect? Assume no subnetting.

Answer

Direct; both hosts are on the same network (same netid, 137.23).

TCP/IP Protocol Suite

145

Example

A host with IP address 137.23.56.23/16 sends a packet to a host with IP address 142.3.6.9/24. Is the delivery direct or indirect? Assume no subnetting.

Answer

Indirect; the hosts are on different networks (different netid, 137.23 and 142.3.6).

TCP/IP Protocol Suite

146

6.2 FORWARDING
Forwarding means to place the packet in its route to its destination. Forwarding requires a host or a router to have a routing table. .

The topics discussed in this section include:


Forwarding Techniques Forwarding with Classful Addressing Forwarding with Classless Addressing Combination

TCP/IP Protocol Suite

147

Forwarding Techniques

next-hop network specific entries host-specific entries default entry

TCP/IP Protocol Suite

148

Figure 6.3

Next-hop method

Reduces the size of the routing table by only recording the next hop for forwarding the packet

TCP/IP Protocol Suite

149

Figure 6.4

Network-specific method

Only one entry that defines the address of the destination network

TCP/IP Protocol Suite

150

Figure 6.5

Host-specific routing

specific destination host address is recorded, usually used for control over routing

TCP/IP Protocol Suite

151

Figure 6.6

Default routing

All other destinations are covered by a single entry

TCP/IP Protocol Suite

152

Classful Routing

Minimum of 3 columns

network destination address next-hop addresses interface number (outgoing port)

Default masks are used (mainly) to route packets to final destination networks (Internet) Applying the default mask to a destination address gives you the nodes network address which can be compared to the entries in the table Order of the routing table is: direct-delivery, hostspecific, network-specific, default

TCP/IP Protocol Suite

153

Figure 6.7

Simplified forwarding module in classful address without subnetting

TCP/IP Protocol Suite

154

Example 1

Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R1.

See Next Slide

TCP/IP Protocol Suite

155

Figure 6.8

Configuration for routing, Example 1

TCP/IP Protocol Suite

156

Example 1 (Continued)

Solution

Figure 6.9 shows the three tables used by router R1. Note that some entries in the next-hop address column are empty because in these cases, the destination is in the same network to which the router is connected (direct delivery). In these cases, the nexthop address used by ARP is simply the destination address of the packet as we will see in Chapter 7.
See Next Slide
TCP/IP Protocol Suite

157

Figure 6.9

Tables for Example 1

TCP/IP Protocol Suite

158

Example

Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R2.

TCP/IP Protocol Suite

159

Example

Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R3.

TCP/IP Protocol Suite

160

Figure 6.10

Simplified forwarding module in classful address with subnetting

TCP/IP Protocol Suite

161

Example 4

Figure 6.11 shows a router connected to four subnets.

See Next Slide

TCP/IP Protocol Suite

162

Example 4 (Continued)

Note several points. First, the site address is 145.14.0.0/16 (a class B address). Every packet with destination address in the range 145.14.0.0 to 145.14.255.255 is delivered to the interface m4 and distributed to the final destination subnet by the router. Second, we have used the address x.y.z.t/n for the interface m4 because we do not know to which network this router is connected. Third, the table has a default entry for packets that are to be sent out of the site. The router is configured to apply the mask /18 to any destination address.
TCP/IP Protocol Suite

163

Figure 6.11 Configuration for Example 4

TCP/IP Protocol Suite

164

Example 5

The router in Figure 6.11 receives a packet with destination address 145.14.32.78. Show how the packet is forwarded.

Solution The mask is /18. After applying the mask, the subnet address is 145.14.0.0. The packet is delivered to ARP with the next-hop address 145.14.32.78 and the outgoing interface m0.

TCP/IP Protocol Suite

165

Example 6

A host in network 145.14.0.0 in Figure 6.11 has a packet to send to the host with address 7.22.67.91. Show how the packet is routed. Solution The router receives the packet and applies the mask (/18). The network address is 7.22.64.0. The table is searched and the address is not found. The router uses the address of the default router (not shown in figure) and sends the packet to that router.
TCP/IP Protocol Suite

166

Note: In classful addressing we can have a routing table with three columns; in classless addressing, we need at least four columns.

TCP/IP Protocol Suite

167

Classless Routing

Minimum of 4 columns

mask needs to be specified for each entry

Mask in each line of the routing table is applied to the destination address Routing table sorted in longest mask to shortest mask order

TCP/IP Protocol Suite

168

Figure 6.12

Simplified forwarding module in classless address

TCP/IP Protocol Suite

169

Example 7

Make a routing table for router R1 using the configuration in Figure 6.13. See Next Slide

Solution Table 6.1 shows the corresponding table. See the table after the figure.

TCP/IP Protocol Suite

170

Figure 6.13

Configuration for Example 7

TCP/IP Protocol Suite

171

Table 6.1 Routing table for router R1 in Figure 6.13

TCP/IP Protocol Suite

172

Example 8

Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 180.70.65.140. Solution The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The result is 180.70.65.128, which does not match the corresponding network address.

See Next Slide


TCP/IP Protocol Suite

173

Example 8 (Continued)

2. The second mask (/25) is applied to the destination address. The result is 180.70.65.128, which matches the corresponding network address. The next-hop address (the destination address of the packet in this case) and the interface number m0 are passed to ARP for further processing.

TCP/IP Protocol Suite

174

Example 9

Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.22.35.

Solution The router performs the following steps: See Next Slide
TCP/IP Protocol Suite

175

Example 9 (Continued)
1. The first mask (/26) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 1). 2. The second mask (/25) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 2). 3. The third mask (/24) is applied to the destination address. The result is 201.4.22.0, which matches the corresponding network address. The destination address of the package and the interface number m3 are passed to ARP.

TCP/IP Protocol Suite

176

Example 10

Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 18.24.32.78. Solution This time all masks are applied to the destination address, but no matching network address is found. When it reaches the end of the table, the module gives the next-hop address 180.70.65.200 and interface number m2 to ARP. This is probably an outgoing package that needs to be sent, via the default router, to some place else in the Internet.
TCP/IP Protocol Suite

177

Example 11

Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.16.70. Solution

TCP/IP Protocol Suite

178

Example 12

Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 202.70.20.30. Solution

TCP/IP Protocol Suite

179

Example
Find the topology of the network if the following routing table is for R1.
Mask /27 /18 Default Network Address 202.14.17.224 145.23.192.0 default Next- Hop Address 130.56.12.4 Interface M1 M0 m2

Answer

TCP/IP Protocol Suite

180

Example 11

Now let us give a different type of example. Can we find the configuration of a router, if we know only its routing table? The routing table for router R1 is given in Table 6.2. Can we draw its topology? See Next Slide

TCP/IP Protocol Suite

181

Table 6.2 Routing table for Example 11

TCP/IP Protocol Suite

182

Example 11

(Continued)

Solution We know some facts but we dont have all for a definite topology. We know that router R1 has three interfaces: m0, m1, and m2. We know that there are three networks directly connected to router R1. We know that there are two networks indirectly connected to R1. There must be at least three other routers involved (see next-hop column). We know to which networks these routers are connected by looking at their IP addresses. So we can put them at their appropriate place.
TCP/IP Protocol Suite

See Next Slide

183

Example 11

(Continued)

We know that one router, the default router, is connected to the rest of the Internet. But there is some missing information. We do not know if network 130.4.8.0 is directly connected to router R2 or through a point-to-point network (WAN) and another router. We do not know if network140.6.12.64 is connected to router R3 directly or through a point-to-point network (WAN) and another router. Point-to-point networks normally do not have an entry in the routing table because no hosts are connected to them. Figure 6.14 shows our guessed topology. See Next Slide
TCP/IP Protocol Suite

184

Figure 6.14

Guessed topology for Example 6

TCP/IP Protocol Suite

185

Example

Show a routing table for a host that is totally isolated

Answer A host that is totally isolated needs no routing table. The routing table has no entries.
186

TCP/IP Protocol Suite

Example

Show a routing table for a host that is connected to a LAN without being connected to the Internet Answer A routing table for a LAN not connected to the Internet and with no subnets can have a routing table with host-specific addresses. There is no next-hop address since all packets remain within the network.
187

TCP/IP Protocol Suite

Homework
Go To the following website http://highered.mcgraw-hill.com/sites/0072967722/ Complete the Chapter 4-6 quizzes.

TCP/IP Protocol Suite

188

Anda mungkin juga menyukai