©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200311
Chapter 4
IP Addresses:Classful Addressing
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200322
CONTENTSCONTENTS• INTRODUCTION• CLASSFUL ADDRESSING• OTHER ISSUES• A SAMPLE INTERNET
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200333
4.1 Introduction• An IP address is a 32-bit address that identifies a connection to
the Internet.• The IP addresses are universally unique.• The address space of IPv4 is 232 or 4,294,967,296.• IP address is written as a Binary (hexadecimal) or a Dotted-
Decimal (w/out leading zeros) notation. See examples in the textbook.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200344
CLASSFUL ADDRESSING4.24.2
• The IP address space (all possible IP values) is divided into five classes: A, B, C, D, and E.
161
161
81
41
21
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200355
Finding the class of an IP address11stst Byte Byte decimal decimal valuesvalues
0 0 -- 127127
128128--191191
192192--223223
224224--239239
240240--255255
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200366
Example 5Example 5
How can we prove that we have 2,147,483,648 addresses in class A?
SolutionSolution
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.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200377
Example 6 (Continued)Example 6 (Continued)
Find the class of the address:
11000001 10000011 00011011 11111111
SolutionSolution
The first 2 bits are 1; the third bit is 0. This is a class C address.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200388
Example 7Example 7
Find the class of the address:
227.12.14.87
SolutionSolution
The first byte is 227 (between 224 and 239); the class is D.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200399
Example 7 (Continued)Example 7 (Continued)
Find the class of the address:
193.14.56.22
SolutionSolution
The first byte is 193 (between 192 and 223);the class is C.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031010
Netid and hostid
• Only classes A, B, and C addresses are subdivided.• Exercise: How many different “Netid”s and “Host”s in each of
the classes A, B, C?Hostid’s
• 2^24 = 16,777,216• 2^16 = 65,536• 2^8 = 256
Netid’s• 2^(8-1) = 128• 2^(16-2) = 16,384• 2^(24-3) = 2,097,152
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031111
Blocks in class A
Millions of class A addresses Millions of class A addresses are wasted. are wasted.
One Block (One Block (NetidNetid 10) is for Private 10) is for Private Addresses. Addresses.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031212
Blocks in class B
Many class B addresses Many class B addresses are wasted.are wasted. 16 Blocks are reserved for Private 16 Blocks are reserved for Private
Addresses. Addresses.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031313
Blocks in class C
The number of addresses in The number of addresses in a class C block is smaller than a class C block is smaller than
the needs of most organizations. the needs of most organizations. 256 Blocks are reserved for 256 Blocks are reserved for
Private Addresses. Private Addresses.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031414
Class D addresses (ONE block) Class D addresses (ONE block) are used for multicasting; are used for multicasting;
Each address define one group. Each group member Each address define one group. Each group member has a multicast and a has a multicast and a unicastunicast IP addressIP address
Class E addresses (ONE block) are reserved for special Class E addresses (ONE block) are reserved for special purposes (limited broadcast) ; most of the block is purposes (limited broadcast) ; most of the block is
wasted. wasted.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031515
Network AddressesNetwork Addresses
1. The network address is the first address in the block.
2. The network address defines the network to the rest of the Internet.
3. Given the network address, we can find the class of the address, the block, and the range of the addresses in the block
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031616
Example 9Example 9
Given the network address 17.0.0.0, find the class, the block, and the range of the addresses.
SolutionSolution
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.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031717
Example 10Example 10
Given the network address 132.21.0.0, find the class, the block, and the range of the addresses.
SolutionSolution
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.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031818
Example 11Example 11
Given the network address 220.34.76.0, find the class, the block, and the range of the addresses.
SolutionSolution
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.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031919
IP address → Network Address
1. Find the class, then the Netid, then set Hostid = 0Example: IP=134.45.78.2 is a class B (128-191) with Netid=134.45, so its network address is 134.45.0.0
2. Use a Mask which is a 32-bit binary number that gives the first address in the block (the network address) when bitwise ANDed with an address in the block.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032020
Default Masks
255.255.255.0C
255.255.0.0B
255.0.0.0A
Mask in dotted-decimalClass
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032121
The network address is the The network address is the beginning address of each block.beginning address of each block.
It can be found by applying It can be found by applying the default mask tothe default mask to
any of the addresses in the block any of the addresses in the block (including itself).(including itself).
It retains the It retains the netidnetid of the block of the block and sets the and sets the hostidhostid to zero. to zero.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032222
Example 12Example 12
Given the address 23.56.7.91 and the default class A mask, find the beginning address (network address).
SolutionSolution
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.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032323
Example 13Example 13
Given the address 132.6.17.85 and the default class B mask, find the beginning address (network address).
SolutionSolution
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.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032424
We must not We must not apply the default mask apply the default mask
of one class to of one class to an address belonging an address belonging
to another class. to another class.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032525
• IP addresses are almost depleted even though the number of devices on the Internet is much less than 2^32.
• Remedies to this problem are discussed in Chapter 5
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032626
OTHER ISSUES
4.134.13
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032727
Multihomed devices
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032828
Special Addresses
1. Network Address2. Direct Broadcast Address3. Limited Broadcast Address4. This Host on This Network5. Specific Host on This Network6. Loopback Address
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032929
Network addresses
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033030
Example of direct broadcast address
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033131
Example of limited broadcast address
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033232
Example of this host on this address
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033333
Example of specific host on this network
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033434
Example of loopback address
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033535
Private AddressesPrivate Addresses
A number of blocks in each class are assigned for private use. They are not recognized globally.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033636
UnicastUnicast, Multicast, and , Multicast, and Broadcast AddressesBroadcast AddressesUnicast communication is one-to-one.
Multicast communication is one-to-many. (Class D address defining the Groupid)
Broadcast communication is one-to-all.
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033737
A SAMPLE INTERNET
WITH CLASSFUL ADDRESSES
4.44.4
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20033838
Sample internet