Classless Addressing
Classless Addressing
The topics discussed in this section include: Restrictions Finding the Block Granted Block
Figure 5.1
Variable-length blocks
Example 1
Which of the following can be the beginning address of a block that contains 16 addresses? a. 205.16.37.32 b.190.16.42.44 c. 17.17.33.80 d.123.45.24.52 Solution Only two are eligible (a and c). The address 205.16.37.32 is eligible because 32 is divisible by 16. The address 17.17.33.80 is eligible because 80 is divisible by 16.
TCP/IP Protocol Suite
Example 2
Which of the following can be the beginning address of a block that contains 256 addresses? a.205.16.37.32 b.190.16.42.0 c.17.17.32.0 d.123.45.24.52
Solution In this case, the right-most byte must be 0. IP addresses use base 256 arithmetic. When the rightmost byte is 0, the total address is divisible by 256. Only two addresses are eligible (b and c).
TCP/IP Protocol Suite
Example 3
Which of the following can be the beginning address of a block that contains 1024 addresses? a. 205.16.37.32 b.190.16.42.0 c. 17.17.32.0 d.123.45.24.52
Solution In this case, we need to check two bytes because 1024 = 4 256. The right-most byte must be divisible by 256. The second byte (from the right) must be divisible by 4. Only one address is eligible (c).
TCP/IP Protocol Suite
Figure 5.2
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
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
10
Figure 5.3
Example 5
11
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.
12
Example 8
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
13
Example 8 (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
14
Example 10
one
of
the
addresses
is
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/20. There are only 8 addresses in this block.
TCP/IP Protocol Suite
15
Example 11
Show a network configuration for the block in the previous example.
16
Figure 5.5
Example 11
17
Note: In classless addressing, the last address in the block does not necessarily end in 255.
18
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
19
Note:
In fixed-length subnetting, the number of subnets is a power of 2. If the number of subnet is S, the number of extra 1s in the prefix length is log2 S, where S=2no.of extra 1s
TCP/IP Protocol Suite
20
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.
21
Example 13
What are the subnet addresses and the range of addresses for each subnet in the previous example? Solution Figure 5.6 shows one configuration. See Next Slide
22
Figure 5.6
Example 13
23
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.
24
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
25
We can design subnets having variablelength masks. So we can design subnets of different sizes. This allows the organization to assign the addresses based on the needs of the subnet sizes.
27