Add Book to My BookshelfPurchase This Book Online

Chapter 2 - Internet Protocol (IP) Addresses

Cisco Multicast Routing & Switching
William R. Parkhurst
  Copyright © 1999 The McGraw-Hill Companies

IP Subnets
The solution to our design problem is to divide whatever class of IP address we are assigned into a number of smaller networks with fewer hosts per network. This is accomplished by “borrowing” bits from the host portion of our IP address and using them in the network portion. How do we and, more importantly, how does a router know how many bits to use for the network and how many to use for the host? The answer is by using a subnet mask.
A subnet mask is a 32-bit binary number that identifies which bits in the address are used for the host and which bits are used for the network. A one in the mask identifies the corresponding bit in the IP address as a network bit, and a zero in the mask identifies the corresponding bit in the IP address as a host bit. A router accomplishes this operation by performing a bitwise AND operation with the IP address and the subnet mask.
0 AND 1 5 0
1 AND 0 5 01 AND 1 5 1
As an example, consider the IP address/subnet mask pair
156.26.30.60/255.255.240.0
which has the binary representations
Address
10111100
00011010
00011110
00111100
Mask
11111111
11111111
11110000
00000000
Performing the AND operation yields
000110100001000000000000
Converting the result to dotted decimal notation yields the network portion of the IP address
156.26.16.0
One subnet mask restriction is that the 1 bits in the mask must be contiguous. Because of this, an alternative representation for the mask is just to indicate how many 1 bits are in the mask. For example, the IP address/ subnet mask pair in the previous example can be written as 156.26.30.60/20. The subnet masks for non-subnetted networks are shown in Figure 2-3.
Figure 2-3: Standard IP subnet masks
Subnet masks never have fewer ones than the masks listed in Figure 2-3. A Class C address, for example, cannot have a subnet mask of 255.255.0.0. Request for Comment (RFC) 950 first defined the subnetting of IP addresses and does not allow the use of the all-zeros and all-ones subnet, so we will initially look at subnetting examples that obey these restrictions. In later examples, we will see how we can remove these restrictions with the use of an appropriate routing protocol, such as OSPF. The number of subnet bits cannot be one because of the restriction in RFC 950 (see Tables 2-4, 2-5, and 2-6). A 1-bit subnet mask would have a value of either zero (all zeros) or one (all ones) and this is not allowed.
Table 2-4: Class A Subnet Masks
Number of Subnet bits
Subnet Mask
Number of Subnetworks
Number of Hosts/Subnet
Total Number of Hosts
1
2
255.192.0.0
0000002
4194302
08388604
3
255.224.0.0
0000006
2097150
12582900
4
255.240.0.0
0000014
1048574
14680036
5
255.248.0.0
0000030
0524286
15728580
6
255.252.0.0
0000062
0262142
16252804
7
255.254.0.0
0000126
0131070
16514820
8
255.255.0.0
0000254
0065534
16645636
9
255.255.128.0
0000510
0032766
16710660
10
255.255.192.0
0001022
0016382
16742404
11
255.255.224.0
0002046
0008190
16756740
12
255.255.240.0
0004094
0004094
16760836
13
255.255.248.0
0008190
0002046
16756740
14
255.255.252.0
0016382
0001022
16742404
15
255.255.254.0
0032766
0000510
16710660
16
255.255.255.0
0065534
0000254
16645636
17
255.255.255.128
0131070
0000126
16514820
18
255.255.255.192
0262142
0000062
16252804
19
255.255.255.224
0524286
0000030
15728580
20
255.255.255.240
1048574
0000014
14680036
21
255.255.255.248
2097150
0000006
12582900
22
255.255.255.252
4194302
0000002
08388604
23
24
Table 2-5: Class B Subnet Masks
Number of Subnet Bits
Subnet Mask
Number of Subnetworks
Number of Hosts/Subnet
Total Number of Hosts
1
2
00255.255.192.0
00002
16382
32764
3
00255.255.224.0
00006
08190
49140
4
00255.255.240.0
00014
04094
57316
5
00255.255.248.0
00030
02046
61380
6
00255.255.252.0
00062
01022
63364
7
00255.255.254.0
00126
00510
64260
8
00255.255.255.0
00254
00254
64516
9
255.255.255.128
00510
00126
64260
10
255.255.255.192
01022
00062
63364
11
255.255.255.224
02046
00030
61380
12
255.255.255.240
04094
00014
57316
13
255.255.255.248
08190
00006
49140
14
255.255.255.252
16382
00002
32764
15
16
Table 2-6: Class C Subnet Masks
Number of Subnet Bits
Subnet Mask
Number of Subnetworks
Number of Hosts/Subnet
Total Number of Hosts
1
2
255.255.255.192
02
62
124
3
255.255.255.224
06
30
180
4
255.255.255.240
14
14
196
5
255.255.255.248
30
06
170
6
255.255.255.252
62
02
124
7
8
A 15-bit subnet mask for Class B and a 7-bit subnet mask for Class C is also illegal because it would leave only 1-bit for the host, which we have seen cannot be all zeros or all ones. A 16-bit subnet mask for Class B or an 8-bit subnet mask for Class C makes no sense because this would leave zero host bits.
Subnet Examples
In the following examples, determine if the address/subnet pair is legal. If it is legal, determine the network number and the range of host addresses for that network. Also determine for the mask, the number of available networks and available hosts per network.
  1. IP address = 193.144.233.130
  Subnet mask 5 255.255.255.192
  For a Class C address, we only need to look at the last octet of the address and the mask.
  130 = 1000 0010
  192 = 1100 0000
  This is a legal pair because neither the subnet nor the host is all zeros or all ones.
Network equals 193.144.233.128 because the mask selects the upper two bits of the address (130) and the rest of the bits are set to zero to identify the network.
Range of hosts = 193.144.233.129—193.144.233.190.
The host portion (last six bits) can have values ranging from 000001 to 111110 (remember they can’t be all zeros or all ones). Add in the subnet portion, which is the upper two bits of the address (in this case, 1 0), and you have 10 000001 to 10 111110 for the host addresses.
  From Table 2-6, the number of available networks is 2 and the number of hosts is 62.
  2. IP address = 156.26.30.60
  Subnet Mask = 255.255.255.0
This is relatively easy because the entire third octet is used for the subnet and the entire fourth octet is used for the host. This is a legal pair because neither the subnet nor the host is all zeros or all ones.
  Network = 156.26.30.0
  Range of hosts = 156.26.30.1—156.26.30.254
  From Table 2-5, the number of networks is 254 and the number of hosts is 254.
  3. IP address = 199.200.201.50
  Mask = 255.255.255.128
This is illegal because the subnet mask only borrows 1 bit from the host and that bit has to be either zero or one.
  4. IP address = 191.200.201.50
  Mask = 255.255.255.128
  This is a legal pair because the address is Class B and we are borrowing 9 bits from the host portion.
  Network = 191.200.201.0
  Range of hosts = 191.200.201.1—191.200.201.126
  From Table 2-5, the number of networks is 510 and the number of hosts is 126.
Subnetting can be viewed as creating a three-part hierarchical address. The network portion of the address can be found by applying the standard subnet mask to the IP address (refer to Figure 2-3). The subnet is determined from the bits “borrowed” from the host portion and the host number is simply those bits that are left over. For an example, we will examine the Class B address/mask pair
144.223.0.0/255.255.255.0
and determine the network number, the subnetwork numbers, and the range of host numbers. The network number is found by applying the standard Class B 16-bit subnet mask, which yields the network
144.223.0.0
The subnet is the entire third octet, so the 254 subnets are
144.223.1.0
144.223.2.0
.
.
.
144.223.254.0
and the range of hosts for each subnet is 1 to 254. Now let’s try a bit more complicated example. Consider the address/mask pair
144.223.0.0/255.255.255.224
The network number is still 144.223.0.0. The subnet mask borrows 11 bits from the host portion of the address. The first 8 bits borrowed include the entire third octet, which has a value of 0 to 255. The 3 bits borrowed from the third octet have the values
00000000=0
00100000=32
01000000=64
01100000=96
10000000=128
10100000=160
11000000=192
11100000=224
Why are the values 0 (all zeros) and 255 (all ones) for the third octet, and 0 (all zeros) and 224 (all ones) from the fourth octet included? The third octet can be 0 if the 3 bits in the fourth octet are not zero. The third octet can also be all ones if the 3 bits in the fourth octet are not all ones. The 3 bits in the fourth octet can be all zeros if the third octet is not all zeros, and the 3 bits from the fourth octet can be all ones if the third octet is not all ones. In other words, the 11 subnet bits cannot be all zeros or all ones. Therefore, the range of subnet numbers is
144.223.0.32
144.223.0.64
.
.
.
144.223.0.224
144.223.1.0
144.223.1.32
.
.
.
144.223.255.0
.
.
.
144.223.255.192
Determining the range of host addresses for each subnet requires more effort. The bit pattern for the fourth octet of network 144.223.0.32 is
001 hhhhh
where hhhhh represents the host number, which cannot be all zeros or all ones. Therefore, the first legal host number is 00001, making the fourth octet
00100001 = 33
so the first host address is
144.223.0.33
and the last legal host bit pattern for the fourth octet is
00111110 = 62
which gives the range of hosts’ addresses for the first subnet as
144.223.0.33—144.223.0.62
The broadcast address for each subnet is found by setting all the bits in the host portion to 1. The broadcast address for subnet 144.223.0.32 is determined by setting the last 5 bits of the fourth octet to 1 yielding
00111111 = 63
Putting it all together gives us the broadcast address
144.223.0.63
  5. Determine all the subnet numbers for the address/mask pair 193.128.55.0/255.255.255.240. Also determine the range of host addresses and the broadcast address for the fourth subnet.
Network
Hosts
193.128.55.0
1—14 (If IP subnet-zero is used)
193.128.55.16
17—30
193.128.55.32
33—46
193.128.55.48
49—62, Broadcast address = 193.128.55.63
193.128.55.64
65—78
193.128.55.80
81—94
193.128.55.96
97—110
193.128.55.112
113—126
193.128.55.128
129—142
193.128.55.144
145—158
193.128.55.160
161—174
193.128.55.176
177—190
193.128.55.192
193—206
193.128.55.208
209—222
193.128.55.224
225—238
193.128.55.240
241—254
IP Address Design Example 1
Assume your company has been assigned the Class C address 198.28.61.0 and you have determined that you require four networks with a maximum of 25 hosts per network. From Table 2-6, you will need three subnet bits, resulting in a subnet mask of 255.255.255.224. The subnet numbers for this design are any four of the following, as shown in Figure 2-4.
Figure 2-4: IP address design example 1
198.28.61.32
198.28.61.64
198.28.61.96
198.28.61.128
198.28.61.160
198.28.61.192
Although subnets solve some of the problems associated with the inefficient use of IP address space, situations occur when simple subnetting does not suffice. Consider the network in Figure 2-5 in which two routers are connected by a serial link. This serial link is a point-to-point connection, so there are only two hosts on the link, the two router interfaces. Each network must also be on a separate subnet, so no matter which subnet mask we choose, we will be wasting IP addresses. If we are using a Class B address with a 24-bit subnet mask, then the subnet assigned to the serial link will only use two out of a possible 254 host addresses.
Figure 2-5: Limitations of simple subnetting
If we could use different subnet masks for different subnetworks, then the limitations of Figure 2-5 could be solved. A subnet mask of 255.255.255.252 (or /30) can accommodate only two hosts, which is perfect for a point-to-point serial link. Unfortunately, this mask, if used throughout the network, would limit all subnets to two hosts. The ideal solution would be to vary the length of the subnet mask and adjust it according to the needs of each individual network.
Variable Length Subnet Masks
RFC 1009, 1987, specifies the procedures for using multiple subnet masks. This technique is referred to as variable length subnet masks (VLSM). The term VLSM can be confusing because the subnet mask for a specific network does not vary but is fixed. VLSM means that the subnet masks for different subnets can have unequal lengths. As an example, it would allow a subnet mask of 255.255.255.252 to be assigned to a serial link and 255.255.255.0 to an ethernet network. Once the masks are assigned, however, they do not change, at least by themselves.
Figure 2-6: VLSM example 1
The VLSM technique is very useful for allocating IP addresses more efficiently (less waste) and for reducing the size of routing tables. However, VLSM can also cause a number of massive network headaches if not used properly.
VLSM Example 1
Let’s apply VLSM to the network in Figure 2-5. Assume we have been assigned the Class B network 156.26.0.0. The ethernet networks are assigned addresses using a /24 subnet mask; we will use the first two networks with this mask, 156.26.1.0 and 156.26.2.0. The third network, 156.26.3.0, will be sub-subnetted using a /30 subnet mask, which will give us a possible 62 sub-subnets we can use for serial connections. Notice that we are subnetting an already subnetted network, 156.26.3.0. Figure 2-6 illustrates this technique.
Figure 2-6 visually represents the technique that should be used when using VLSM. Start with the standard subnet mask (/8, /16, or /24 for Class A, B, or C). Determine the network with the required maximum number of hosts, in this case 254. Then subnet using a mask that will give you networks that can handle the largest number of hosts you need. For smaller networks, sub-subnet the large networks and keep going until you have satisfied your requirements.
VLSM Example 2
The best way to master a technique is practice, practice, practice, so here we go. Given the IP network 202.128.236.0, design a network with the following requirements:
  Four networks with a maximum of 26 hosts
  Three networks with a maximum of 10 hosts
  Four point-to-point serial links
Starting with the greatest number of hosts per network, we can use a /27 subnet mask to satisfy the first requirement. From Table 2-6, this gives us six networks of 30 hosts each with two networks left over to sub-subnet. To satisfy the next requirement, we can sub-subnet the two leftover /27 networks using a /28 subnet mask to give us four networks with 14 hosts each. Finally, take one of the four sub-subnetted networks and sub-sub-subnet using a /30 subnet mask.
How did I arrive at the diagram in Figure 2-7? Let’s take a closer look as to where these network numbers came from; then we’ll look at another VLSM design problem to ensure that you have mastered the technique.
Figure 2-7: VLSM example 2
  1. Determine the mask for the networks containing the greatest number of hosts.
The first requirement is for four networks with a maximum of 26 hosts. Using Table 2-6, we need three subnet bits or a /27 subnet mask. The fourth octet of our IP network would be segmented as
S S S H H H H H
where S S S indicates the subnet bits and H H H H H indicates the host bits. The subnets then are
0 0 1 0 0 0 0 0=32
0 1 0 0 0 0 0 0=64
0 1 1 0 0 0 0 0=96
1 0 0 0 0 0 0 0=128
1 0 1 0 0 0 0 0=160
1 1 0 0 0 0 0 0=192
and we are using subnets 96 through 192 for the networks containing 26 hosts because these subnets can handle a maximum of 30 hosts.
  2. Sub-subnet the subnetted networks as needed.
The second requirement calls for three networks with a maximum of 10 hosts each. Again, we consult Table 2-6 and see that we need four subnet bits or a /28 subnet mask. We will sub-subnet network 202.128.236.32 and 202.128.236.64. The first three subnet bits are fixed with the values 001 (subnet 32) and 010 (subnet 64), so now we have
0 0 1 S H H H H
0 1 0 S H H H H
Network 32 S can be 0 or 1, giving us
0 0 1 0 H H H H
0 0 1 1 H H H H
Setting the host bits to 0, the sub-subnets are
0 0 1 0 0 0 0 0 = 32
0 0 1 1 0 0 0 0 = 48
Applying the same procedure to subnet 64, we get
0 1 0 0 0 0 0 0 = 64
0 1 0 1 0 0 0 0 = 80
  3. To satisfy the last requirement of four point-to-point serial links, we will sub-sub-subnet sub-subnet 32, which now is equal to
0 0 1 0 S S H H
S S can be either 0 0, 0 1, 1 0 , or 1 1 yielding
0 0 1 0 0 0 0 0 = 32
0 0 1 0 0 1 0 0 = 36
0 0 1 0 1 0 0 0 = 40
0 0 1 0 1 1 0 0 = 44
As a final task for this exercise, determine the range of hosts and the broadcast addresses for networks 202.128.236.192, 202.128.236.80, and 202.128.236.40.
The fourth octet of network 202.128.236.192 is
1 1 H H H H H H
and the host bits can range from
0 0 0 0 0 1—1 1 1 1 1 0
which gives us a range of
1 1 0 0 0 0 0 1 (193)—1 1 1 1 1 1 1 0 (254)
The broadcast address is determined by setting the host bits to 1, which is
1 1 1 1 1 1 1 1 5 255
so the broadcast address is 202.128.236.255. For network
Figure 2-8: Realization of VLSM example 2
202.128.236.80, the fourth octet contains
0 1 0 1 H H H H
so the range of host addresses is
0 1 0 1 0 0 0 1 (81)—0 1 0 1 1 1 1 0 (94)
and the broadcast address is
0 1 0 1 1 1 1 1 (95)
For network 202.128.236.40, the fourth octet contains
0 0 1 0 1 0 H H
Because H H cannot be 0 0 or 1 1, the host addresses for this network are 202.128.236.41 and 202.128.236.42 with a broadcast address of 202.128.236.243. The realization of this network design is shown in Figure 2-8.
For the final VLSM example, design a network using the Class C address 200.100.50.0 that satisfies the following requirements:
  _Nine serial point-to-point links
  _Four networks with a maximum of 30 hosts
  _Three networks with a maximum of five hosts
Determine the address host ranges and the broadcast address for each subnet.
From Table 2-6, a 3-bit subnet mask will give us six networks of 30 hosts each.
Subnet mask = 255.255.255.224
Networks
Hosts
Broadcast Address
200.100.50.0
1—30
200.100.50.31 (if we use IP subnet-zero)
200.100.50.32
33—62
200.100.50.63
200.100.50.64
65—94
200.100.50.95
200.100.50.96
97—126
200.100.50.127
200.100.50.128
129—158
200.100.50.159
200.100.50.160
161—190
200.100.50.191
200.100.50.192
193—222
200.100.50.223
One solution is to use the first four networks to satisfy the requirement of four networks with 30 hosts each. For the requirement of three networks with five hosts each, we can sub-subnet network 200.100.50.160 using the 5-bit subnet mask 200.100.50.160/255.255.255.248, which gives us the networks listed below.
Network
Hosts
Broadcast Address
200.100.50.160
161—166
200.100.50.167
200.100.50.168
169—174
200.100.50.175
200.100.50.176
177—182
200.100.50.183
200.100.50.184
185—190
200.100.50.191
We can use any three of the four networks to satisfy the requirement of three networks with five hosts.
Finally we can sub-subnet the 200.100.50.192 network using a 30-bit subnet mask that gives us the networks listed below.
Network
Hosts
Broadcast Address
200.100.50.192
193—194
200.100.50.195
200.100.50.196
197—198
200.100.50.199
200.100.50.200
201—202
200.100.50.203
200.100.50.204
205—206
200.100.50.207
200.100.50.208
209—210
200.100.50.211
200.100.50.212
213—214
200.100.50.215
200.100.50.216
217—218
200.100.50.219
200.100.50.220
221—222
200.100.50.223
200.100.50.224
225—226
200.100.50.227
200.100.50.228
229—230
200.100.50.231
200.100.50.232
233—234
200.100.50.235
200.100.50.236
237—238
200.100.50.239
200.100.50.240
241—242
200.100.50.243
200.100.50.244
245—246
200.100.50.247
200.100.50.248
249—250
200.100.50.251
Choose any nine of the networks for the serial links.
Subnet masks can also be used with Class D multicast addresses. As an example, assume we have the following Class D address/mask pair.
225.250.250.0/255.255.255.0
This address mask/pair would then represent all the multicast groups from 225.250.250.0—225.250.250.255. The multicast address/mask pair can be used to summarize the range of groups that a router will allow or that a multicast entity will service. We will learn more about the use of a mask with a multicast address later in the book.

 


 
Books24x7.com, Inc © 2000 –  Feedback