Earlier, it was required to use the same subnet mask across the network. This was called classful networking. With increase in complexity of networks and decrease in available IP addresses it became obvious that classful networking causes waste valuable of IP addresses. To understand how, consider Figure 2-1. The largest subnet requires 30 host addresses. So across the network a mask of /27 is used, which gives 30 hosts per subnet. You will notice that in every subnet except the subnet attached to RouterD, some host addresses will remain unused. In particular, 28 host addresses are wasted for each link between the routers. In total this network wastes 118 addresses and uses 92 addresses.
To avoid wasting of IP addresses, classless networking was introduced by way of VLSM. VLSM allows you to use different subnet masks across the network for the same class of addresses. For example, a /30 subnet mask, which gives 2 host addresses per subnet, can be used for point-to-point links between routers. Figure 2-2 shows how VLSM can be used to save address space in the network shown in Figure 2-1.