Variable Length Subnet Masks
Oct 12,2010 00:00 by admin
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.