Download - Chapter_04_05_06
TCP/IP Protocol Suite 1Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 4
Introduction to Network
Layer
TCP/IP Protocol Suite 2
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 3
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 4
A B
Physical
Data link
Network
Transport
Application
Physical
Data link
Network
Transport
Application
Internet
Figure 4.1 Internet as a block box
Message Message
TCP/IP Protocol Suite 5
Figure 4.2 Internet as a combination of LANs and WANs connected together
TCP/IP Protocol Suite 6
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 7
Topics Discussed in the Section
Circuit Switching Packet Switching
TCP/IP Protocol Suite 8
In circuit switching, the whole message is sent from the source to the
destination without being divided into packets.
Note
TCP/IP Protocol Suite 9
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.
Example 4.1
TCP/IP Protocol Suite 10
In packet switching, the message is first divided into manageable packets at the
source before being transmitted. The packets are assembled at the
destination.
Note
TCP/IP Protocol Suite 11
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 12
Topics Discussed in the Section
Connectionless Service Connection-Oriented Service
TCP/IP Protocol Suite 13
Sender Network
Network
ReceiverOut of orderR3
R4
R5
R1 R2
A connectionlesspacket-swtiched network
Figure 4.3 A connectionless packet-switched network
4 3 2 1
1
2
3
42
3 31
4 43 21
TCP/IP Protocol Suite 14
Figure 4.4 Forwarding process in a connectionless network
1 2
43
Outputinterface
Destinationaddress
Routing table
12
3
AB
HDestinationaddress
SA DA Data
Send the packetout of interface 2
SA DA Data
LegendSA: Source addressDA: Destination address
TCP/IP Protocol Suite 15
In a connectionless packet-switched network, the forwarding decision
is based on the destination address of the packet.
Note
TCP/IP Protocol Suite 16
Time Time Time Time
SouceDestination
Figure 4.5 Delay in a connectionless network
1
2
3
Totaldelay
TCP/IP Protocol Suite 17
Sender
Network
Network
ReceiverR4
R5
R1 R2
R3
A connection-orientedpacket-switched network
Packets
Virtual circuit
Legend
4 3 2 1
Figure 4.6 A connection-oriented packet switched network
4 3 2 1
4
3
2
1
4 3 2 1 4 3 2 1
TCP/IP Protocol Suite 18
In a connection-oriented packet switched network, the forwarding
decision is based on the label of the packet.
Note
TCP/IP Protocol Suite 19
1
1
1
4
4
2
2 2
3
3
3
A
B
Network
Network
R3
R5
R4
R1 R2
Request packet
Virtual circuit
Legend
A to B
Figure 4.8 Sending request packet in a virtual-circuit network
A to B
1
A to B2
A to B3
A to B
4
LabelPort Port3141
Label
OutgoingIncoming
A to B
Port Port3661
Label Label
OutgoingIncoming
A to B
Label
A to B
Port Port4221
Label
OutgoingIncoming
TCP/IP Protocol Suite 20
Time Time Time Time
Source Destination
Figure 4.11 Delay in a connection-oriented network
1
2
Transmissiontime
3
4
5
Setup
Teardow
n
Total
delay
6
7
TCP/IP Protocol Suite 21
Chapter 4
Objectives Upon completion you will be able to:
IP Addresses:Classful Addressing
• 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 22
4.1 INTRODUCTION4.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 SpaceNotation
TCP/IP Protocol Suite 23
An IP address is a 32-bit address.
Note:
TCP/IP Protocol Suite 24
The IP addresses are unique.
Note:
TCP/IP Protocol Suite 25
The address space of IPv4 is232 or 4,294,967,296.
Note:
TCP/IP Protocol Suite 26
Figure 4.1 Dotted-decimal notation
TCP/IP Protocol Suite 27
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
Example
Solutiona. 01110010 00100010 00000010 00001000b. 10000001 00001110 00000110 00001000c. 11010000 00100010 00110110 00001100d. 11101110 00100010 00000010 00000001
TCP/IP Protocol Suite 28
The binary, decimal, and hexadecimal number systems are reviewed in
Appendix B.
Note:
TCP/IP Protocol Suite 29
Change the following IP addresses from binary notation to dotted-decimal notation.
a. 10000001 00001011 00001011 11101111b. 11000001 10000011 00011011 11111111c. 11100111 11011011 10001011 01101111d. 11111001 10011011 11111011 00001111
Example 1
SolutionWe 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. 193.131.27.255c. 231.219.139.111 d. 249.155.251.15
TCP/IP Protocol Suite 30
Change the following IP addresses from dotted-decimal notation to binary notation.
a. 111.56.45.78 b. 221.34.7.82c. 241.8.56.12 d. 75.45.34.78
Example 2
SolutionWe replace each decimal number with its binary equivalent:
a. 01101111 00111000 00101101 01001110b. 11011101 00100010 00000111 01010010c. 11110001 00001000 00111000 00001100d. 01001011 00101101 00100010 01001110
TCP/IP Protocol Suite 31
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
Example 3
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 32
Change the following IP addresses from binary notation to hexadecimal notation.
a. 10000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
Example 4
SolutionWe 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 33
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 ClassesNetid and HostidClasses and BlocksNetwork AddressesSufficient InformationMaskCIDR NotationAddress Depletion
TCP/IP Protocol Suite 34
Figure 4.2 Occupation of the address space
TCP/IP Protocol Suite 35
Figure 4.3 Finding the class in binary notation
TCP/IP Protocol Suite 36
How can we prove that we have 2,147,483,648 addresses in class A?
Example 5
SolutionIn 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 37
Find the class of each address:
a. 00000001 00001011 00001011 11101111b. 11000001 10000011 00011011 11111111c. 10100111 11011011 10001011 01101111d. 11110011 10011011 11111011 00001111
Example 6
SolutionSee 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 38
Figure 4.5 Finding the class in decimal notation
TCP/IP Protocol Suite 39
Find the class of each address:
a. 227.12.14.87 b.193.14.56.22 c.14.23.120.8d. 252.5.15.111 e.134.11.78.56
Example 7
Solutiona. 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 40
Figure 4.6 Netid and hostid
TCP/IP Protocol Suite 41
Figure 4.7 Blocks in class A
TCP/IP Protocol Suite 42
Figure 4.8 Blocks in class B
TCP/IP Protocol Suite 43
Figure 4.9 Blocks in class C
TCP/IP Protocol Suite 44
Given the network address 17.0.0.0, find the class, the block, and the range of the addresses.
Example 9
SolutionThe 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 45
Given the network address 132.21.0.0, find the class, the block, and the range of the addresses.
Example 10
SolutionThe 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 46
Given the network address 220.34.76.0, find the class, the block, and the range of the addresses.
Example 11
SolutionThe 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 47
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 48
Figure 4.10 Masking concept
TCP/IP Protocol Suite 49
Figure 4.11 AND operation
TCP/IP Protocol Suite 50
Table 4.2 Default masks
TCP/IP Protocol Suite 51
Given the address 23.56.7.91, find the beginning address (network address).
Example 12
SolutionThe 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 52
Given the address 132.6.17.85, find the beginning address (network address).
Example 13
SolutionThe 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 53
Given the address 201.180.56.5, find the beginning address (network address).
Example 14
SolutionThe 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 54
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 DevicesLocation, Not NamesSpecial AddressesPrivate AddressesUnicast, Multicast, and Broadcast Addresses
TCP/IP Protocol Suite 55
Table 4.3 Special addresses
TCP/IP Protocol Suite 56
Figure 4.13 Network address
TCP/IP Protocol Suite 57
Figure 4.14 Example of direct broadcast address
TCP/IP Protocol Suite 58
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 59
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 60
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
Example
Solution
Source address: 108.5.18.22 Destination address: 108.255.255.255
TCP/IP Protocol Suite 61
A router has an IP address of 185.67.89.34 needs loopback testing. What are the source and destination IP addresses
Example
Solution
Source address: 185.67.89.34 Destination address: 127.X.Y.Z
TCP/IP Protocol Suite 62
4.4 SUBNETTING AND SUPERNETTINGIn 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:
SubnettingSupernettingSupernet MaskObsolescence
TCP/IP Protocol Suite 63
IP addresses are designed with two levels of hierarchy.
Note:
TCP/IP Protocol Suite 64
Figure 4.20 A network with two levels of hierarchy (not subnetted)
TCP/IP Protocol Suite 65
Figure 4.21 A network with three levels of hierarchy (subnetted)
• Network (Site)• Subnet• Host
TCP/IP Protocol Suite 66
Figure 4.22 Addresses in a network with and without subnetting
TCP/IP Protocol Suite 67
Figure 4.23 Hierarchy concept in a telephone number
TCP/IP Protocol Suite 68
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 69
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
TCP/IP Protocol Suite 70
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
12 bits borrowed allows 212-2 or 4094 subnets
TCP/IP Protocol Suite 71
Figure 4.24 Default mask and subnet mask
TCP/IP Protocol Suite 72
What is the subnetwork address if the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0?
Example 15
SolutionWe apply the AND operation on the address and the subnet mask.
Address ➡ 11001000 00101101 00100010 00111000
Subnet Mask ➡ 11111111 11111111 11110000 00000000
Subnetwork Address ➡ 11001000 00101101 00100000 00000000.
Subnetwork address 200.45.32.0
TCP/IP Protocol Suite 73
Figure 4.25 Comparison of a default mask and a subnet mask
TCP/IP Protocol Suite 74
Figure 4.27 Comparison of subnet, default, and supernet masks
TCP/IP Protocol Suite 75
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
Example
Solutiona. 2x = 1024 x = log21024 = 10 mask is 255.255.192.0b. 2x = 256 x = log2256 = 8 mask is 255.255.255.0c. 2x = 32 x = log232 = 5 mask is 255.255.255.248d. 2x = 4 x = log24 = 2 mask is 255.255.255.192
TCP/IP Protocol Suite 76
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
Example
Solutiona. 10 extra 1s 210 = 1024 subnetsb. 2 extra 1s 22 = 4 subnetsc. 2 extra 1s 22 = 4 subnetsd. 4 extra 1s 24 = 16 subnets
TCP/IP Protocol Suite 77
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)
Example
TCP/IP Protocol Suite 78
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 Valid Hosts Broadcast 192.168.45.0 192.168.45.1 to 192.168.45.126 192.168.45.127 192.168.45.128 192.168.45.129 to 192.168.45.254 192.168.45.255
(Subnetwork address, valid host, broadcast address)
TCP/IP Protocol Suite 79
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)
Example
TCP/IP Protocol Suite 80
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 81
Chapter 5
Objectives Upon completion you will be able to:
IP Addresses:Classless Addressing
• 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 82
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:
RestrictionsFinding the BlockGranted Block
TCP/IP Protocol Suite 83
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
TCP/IP Protocol Suite 84
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 85
Example
Write the following mask in slash notationa. 255.255.255.0b. 255.0.0.0c. 255.255.224.0d. 255.255.240.0
Answer
TCP/IP Protocol Suite 86
Example
Find the range of addresses in the following block
a. 123.56.77.32/29
Answer
TCP/IP Protocol Suite 87
Example
Find the range of addresses in the following block200.17.21.128/27
Answer
TCP/IP Protocol Suite 88
Table 5.1 Prefix lengths
TCP/IP Protocol Suite 89
Classful addressing is a special case of classless addressing.
Note:
TCP/IP Protocol Suite 90
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 91
What is the first address in the block if one of the addresses is 167.199.170.82/27?
Example 4
Address in binary: 10100111 11000111 10101010 01010010
Keep the left 27 bits: 10100111 11000111 10101010 01000000
Result in CIDR notation: 167.199.170.64/27
SolutionThe 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:
TCP/IP Protocol Suite 92
What is the first address in the block if one of the addresses is 140.120.84.24/20?
Example 5
See Next Slide
SolutionFigure 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.
TCP/IP Protocol Suite 93
Figure 5.3 Example 5
TCP/IP Protocol Suite 94
Find the first address in the block if one of the addresses is 140.120.84.24/20.
Example 6
See Next Slide
SolutionThe 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.
TCP/IP Protocol Suite 95
Figure 5.4 Example 6
TCP/IP Protocol Suite 96
Find the number of addresses in the block if one of the addresses is 140.120.84.24/20.
Example 7
SolutionThe prefix length is 20. The number of addresses in the block is 232−20 or 212 or 4096. Note thatthis is a large block with 4096 addresses.
TCP/IP Protocol Suite 97
Using the first method, find the last address in the block if one of the addresses is 140.120.84.24/20.
Example 8
See Next Slide
SolutionWe 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.
TCP/IP Protocol Suite 98
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:
Example 8 (Continued)
140 . 120 . 80 . 0 15 . 255
-------------------------140 . 120 . 95 . 255
The last address is 140.120.95.255/20.
TCP/IP Protocol Suite 99
Using the second method, find the last address in the block if one of the addresses is 140.120.84.24/20.
Example 9
See Next Slide
SolutionThe 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.
TCP/IP Protocol Suite 100
140 . 120 . 80 . 0 0 . 0 . 15 . 255----------------------------140 . 120 . 95 . 255
Example 9 (Continued)
We add the mask complement to the beginning address to find the last address.
The last address is 140.120.95.255/20.
TCP/IP Protocol Suite 101
Find the block if one of the addresses is 190.87.140.202/29.
Example 10
See Next Slide
SolutionWe 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:
TCP/IP Protocol Suite 102
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
Example 10 (Continued)
The number of addresses is 232−29 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 103
Show a network configuration for the block in the previous example.
Example 11
See Next Slide
SolutionThe 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.
TCP/IP Protocol Suite 104
Figure 5.5 Example 11
TCP/IP Protocol Suite 105
In classless addressing, the last address in the block does not
necessarily end in 255.
Note:
TCP/IP Protocol Suite 106
In CIDR notation, the block granted is defined by the first address and the
prefix length.
Note:
TCP/IP Protocol Suite 107
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 MaskFinding the Subnet AddressesVariable-Length Subnets
TCP/IP Protocol Suite 108
In fixed-length subnetting, the number of subnets is a power of 2.
Note:
TCP/IP Protocol Suite 109
An organization is granted the block 130.34.12.64/26. The organization needs 4 subnets. What is the subnet prefix length?
Example 12
SolutionWe 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 110
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 d. 250
Example 12-1
Solution
TCP/IP Protocol Suite 111
What is the maximum number of subnets if the prefix length of a block is
a. 18 b. 10 c. 27 d. 31
Example 12-2
Solution
TCP/IP Protocol Suite 112
What are the subnet addresses and the range of addresses for each subnet in the previous example-12?
Example 13
See Next Slide
SolutionFigure 5.6 shows one configuration.
TCP/IP Protocol Suite 113
The site has 232−26 = 64 addresses. Each subnet has 232–28 = 16 addresses. Now let us find the first and last address in each subnet.
Example 13 (Continued)
See Next Slide
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.
TCP/IP Protocol Suite 114
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 115
Figure 5.6 Example 13
TCP/IP Protocol Suite 116
An organization is granted a block of addresses with the beginning address 14.24.74.0/24. There are 232−24= 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.
Example 14
See Next Slide For One Solution
TCP/IP Protocol Suite 117
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 2nd 14.24.74.160/27
Example 14 (Continuted)
See Next Slide
TCP/IP Protocol Suite 118
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.244/30 14.24.74.248/30 14.24.74.252/30
Example 14 (Continuted)
TCP/IP Protocol Suite 119
Figure 5.7 Example 14
TCP/IP Protocol Suite 120
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.
Example 15
See Next Slide
TCP/IP Protocol Suite 121
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:
Example 15 (Continued)
See Next Slide
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-to-point connection.
TCP/IP Protocol Suite 122
Example 15 (Continued)
See Next Slide
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.
TCP/IP Protocol Suite 123
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 124
Figure 5.8 Example 15
TCP/IP Protocol Suite 125
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 126
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:
Example 16
See Next Slide
a. The first group has 64 customers; each needs 256 addresses.b. The second group has 128 customers; each needs 128 addressesc. The third group has 128 customers; each needs 64 addresses.
TCP/IP Protocol Suite 127
Design the subblocks and find out how many addresses are still available after these allocations.
Example 16 (Continued)
See Next Slide
SolutionFigure 5.9 shows the situation.
TCP/IP Protocol Suite 128
Figure 5.9 Example 16
TCP/IP Protocol Suite 129
Group 1For 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:
Example 16 (Continued)
See Next Slide
1st Customer 190.100.0.0/24 190.100.0.255/242nd Customer 190.100.1.0/24 190.100.1.255/24. . .64th Customer 190.100.63.0/24 190.100.63.255/24Total = 64 × 256 = 16,384
TCP/IP Protocol Suite 130
Group 2For 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:
Example 16 (Continued)
See Next Slide
1st Customer 190.100.64.0/25 190.100.64.127/252nd Customer 190.100.64.128/25 190.100.64.255/25· · ·128th Customer 190.100.127.128/25 190.100.127.255/25
Total = 128 × 128 = 16,384
TCP/IP Protocol Suite 131
TCP/IP Protocol Suite 132
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:
Example 16 (continued)
See Next Slide
1st Customer 190.100.128.0/26 190.100.128.63/26
2nd Customer 190.100.128.64/26 190.100.128.127/26· · ·128th Customer 190.100.159.192/26 190.100.159.255/26
Total = 128 × 64 = 8,192
TCP/IP Protocol Suite 133
Number of granted addresses to the ISP: 65,536
Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
Example 16 (continued)
TCP/IP Protocol Suite 134
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 135
Figure 26.6 NAT
TCP/IP Protocol Suite 136
Figure 26.7 Address translation
TCP/IP Protocol Suite 137
Figure 26.8 Translation
TCP/IP Protocol Suite 138
Chapter 6
Upon completion you will be able to:
Delivery, Forwarding, and Routing of IP Packets
• 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
Objectives
TCP/IP Protocol Suite 139
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 TypesDirect Versus Indirect Delivery
TCP/IP Protocol Suite 140
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 141
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 142
Figure 6.1 Direct delivery
TCP/IP Protocol Suite 143
Figure 6.2 Indirect delivery
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.
AnswerDirect; 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 137.23.67.9/16. Is the delivery direct or indirect? Assume no subnetting.
AnswerDirect; both hosts are on the same network (same netid, 137.23).
TCP/IP Protocol Suite 146
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.
AnswerIndirect; the hosts are on different networks (different netid, 137.23 and 142.3.6).
TCP/IP Protocol Suite 147
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 TechniquesForwarding with Classful AddressingForwarding with Classless AddressingCombination
TCP/IP Protocol Suite 148
Forwarding Techniques next-hop network specific entries host-specific entries default entry
TCP/IP Protocol Suite 149
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 150
Figure 6.4 Network-specific method
Only one entry that defines the address of thedestination network
TCP/IP Protocol Suite 151
Figure 6.5 Host-specific routing
specific destination host address is recorded, usuallyused for control over routing
TCP/IP Protocol Suite 152
Figure 6.6 Default routing
All other destinations are covered by a single entry
TCP/IP Protocol Suite 153
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, host-specific, network-specific, default
TCP/IP Protocol Suite 154
Figure 6.7 Simplified forwarding module in classful address without subnetting
TCP/IP Protocol Suite 155
Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R1.
Example 1
See Next Slide
TCP/IP Protocol Suite 156
Figure 6.8 Configuration for routing, Example 1
TCP/IP Protocol Suite 157
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 next-hop address used by ARP is simply the destination address of the packet as we will see in Chapter 7.
Example 1 (Continued)
See Next Slide
TCP/IP Protocol Suite 158
Figure 6.9 Tables for Example 1
TCP/IP Protocol Suite 159
Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R2.
Example
TCP/IP Protocol Suite 160
Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R3.
Example
TCP/IP Protocol Suite 161
Figure 6.10 Simplified forwarding module in classful address with subnetting
TCP/IP Protocol Suite 162
Figure 6.11 shows a router connected to four subnets.
Example 4
See Next Slide
TCP/IP Protocol Suite 163
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 164
Figure 6.11 Configuration for Example 4
TCP/IP Protocol Suite 165
The router in Figure 6.11 receives a packet with destination address 145.14.32.78. Show how the packet is forwarded.
Example 5
SolutionThe 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 166
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.
Example 6
SolutionThe 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 167
In classful addressing we can have a routing table with three columns;
in classless addressing, we need at least four columns.
Note:
TCP/IP Protocol Suite 168
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 169
Figure 6.12 Simplified forwarding module in classless address
TCP/IP Protocol Suite 170
Make a routing table for router R1 using the configuration in Figure 6.13.
Example 7
SolutionTable 6.1 shows the corresponding table.
See Next Slide
See the table after the figure.
TCP/IP Protocol Suite 171
Figure 6.13 Configuration for Example 7
TCP/IP Protocol Suite 172
Table 6.1 Routing table for router R1 in Figure 6.13
TCP/IP Protocol Suite 173
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 180.70.65.140.
Example 8
SolutionThe 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 174
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 175
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.22.35.
Example 9
SolutionThe router performs the following steps:
See Next Slide
TCP/IP Protocol Suite 176
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.
Example 9 (Continued)
TCP/IP Protocol Suite 177
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 18.24.32.78.
Example 10
SolutionThis 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 178
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.16.70.
Example 11
Solution
TCP/IP Protocol Suite 179
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 202.70.20.30.
Example 12
Solution
TCP/IP Protocol Suite 180
Example
Find the topology of the network if the following routing table is for R1.
Mask Network Address
Next- Hop Address
Interface
/27 202.14.17.224
- M1
/18 145.23.192.0 - M0
Default default 130.56.12.4 m2
Answer
TCP/IP Protocol Suite 181
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?
Example 11
See Next Slide
TCP/IP Protocol Suite 182
Table 6.2 Routing table for Example 11
TCP/IP Protocol Suite 183
Example 11
SolutionWe know some facts but we don’t 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.
See Next Slide
(Continued)
TCP/IP Protocol Suite 184
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 185
Figure 6.14 Guessed topology for Example 6
TCP/IP Protocol Suite 186
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.
TCP/IP Protocol Suite 187
Example
Show a routing table for a host that is connected to a LAN without being connected to the Internet
AnswerA 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.
TCP/IP Protocol Suite 188
Homework
Go To the following website
http://highered.mcgraw-hill.com/sites/0072967722/
Complete the Chapter 4-6 quizzes.