1.1 VLSM  
  1.1.4 Calculating subnets with VLSM  
VLSM helps to manage IP addresses. VLSM allows for the setting of a subnet mask that suits the link or the segment requirements. A subnet mask should satisfy the requirements of a LAN with one subnet mask and the requirements of a point-to-point WAN with another.

Look at the example in Figure which illustrates how to calculate subnets with VLSM.

The example contains a Class B address of 172.16.0.0 and two LANs that require at least 250 hosts each. If the routers are using a classful routing protocol the WAN link would need to be a subnet of the same Class B network, assuming that the administrator is not using IP unnumbered. Classful routing protocols such as RIP v1, IGRP, and EGP are not capable of supporting VLSM. Without VLSM, the WAN link would have to have the same subnet mask as the LAN segments. A 24-bit mask (255.255.255.0) would support 250 hosts.

The WAN link only needs two addresses, one for each router. Therefore there would be 252 addresses wasted.

If VLSM were used in this example, a 24-bit mask would still work on the LAN segments for the 250 hosts. A 30-bit mask could be used for the WAN link because only two host addresses are needed.

In Figure the subnet addresses used are those generated from subdividing the 172.16.32.0/20 subnet into multiple /26 subnets. The figure illustrates where the subnet addresses can be applied, depending on the number of host requirements. For example, the WAN links use subnet addresses with a prefix of /30. This prefix allows for only two hosts, just enough hosts for a point-to-point connection between a pair of routers.

To calculate the subnet addresses used on the WAN links, further subnet one of the unused /26 subnets. In this example, 172.16.33.0/26 is further subnetted with a prefix of /30. This provides four more subnet bits and therefore 16 (24) subnets for the WANs. Figure illustrates how to work through a VLSM masking system.

VLSM allows the subnetting of an already subnetted address. For example, consider the subnet address 172.16.32.0/20 and a network needing ten host addresses. With this subnet address, there are over 4000 (212 – 2 = 4094) host addresses, most of which will be wasted. With VLSM it is possible to further subnet the address 172.16.32.0/20 to give more network addresses and fewer hosts per network. For example, by subnetting 172.16.32.0/20 to 172.16.32.0/26, there is a gain of 64 (26) subnets, each of which could support 62 (26 – 2) hosts.

Use this procedure to further subnet 172.16.32.0/20 to 172.16.32.0/26:

Step 1 Write 172.16.32.0 in binary form.
Step 2 Draw a vertical line between the 20th and 21st bits, as shown in Figure . /20 was the original subnet boundary.
Step 3 Draw a vertical line between the 26th and 27th bits, as shown in Figure . The original /20 subnet boundary is extended six bits to the right, becoming /26.
Step 4 Calculate the 64 subnet addresses using the bits between the two vertical lines, from lowest to highest in value. The figure shows the first five subnets available.

It is important to remember that only unused subnets can be further subnetted. If any address from a subnet is used, that subnet cannot be further subnetted. In the example, four subnet numbers are used on the LANs. Another unused subnet, 172.16.33.0/26, is further subnetted for use on the WANs.

 

Lab Activity

Lab Exercise: Calculating VLSM Subnets

In this lab, students will use variable-length subnet mask (VLSM) to support more efficient use of the assigned IP addresses and to reduce the amount of routing information at the top level.