Network Basics: Variable Length Subnet Masks (VLSM)
When you include subnet masks in all routing tables, you allow the routing protocol to support Variable Length Subnet Masks (VLSM) with which, simply put, you do not need to use the same subnet mask on all your network segments and can vary the mask from segment to segment. This concept is covered in RFC1878 Variable Length Subnet Table for IPv4, which effectively says devices should be smart enough to define each subnet individually.
So how does this work? For example, take an address block, such as 192.168.1.0/24. From this block, a network is provisioned, as shown in the following figure, and determine that eight segments are needed to be used as interconnects between networks on serial links and also there is a need to support a main office of 60 computers, two regional offices of 25 computers, and 6 other offices with computers each.
If you review the address blocks that are assigned in this figure, you see that a few gaps are still available. One block of addresses, from 192.168.1.144 to 18.104.22.168, is available. The size of the blocks that can be carved from this range are dependent upon the pieces that have been removed already.
The largest single block that can be used out of this range is 192.168.1.160–192.168.1.191 (or 192.168.1.160/27), followed by 192.168.1.144–192.168.1.159 (or 192.168.144/28), and either of these can be deployed as smaller segments.
By switching from fixed-length subnet masks to VSMLs, you can use far more addresses that you can with fixed-length subnet masks.
To use a subnet mask on a traditional network, you would have had to subnet 17 blocks of 62 addresses (the largest single segment), which would have used the equivalent of five Class C address blocks, resulting in 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24, 192.168.4.0/24 and 192.168.5.0/24, with three of four blocks in the last network block still available.
This represents a large waste of addresses in the overall IP address space. So, as you can see, VLSM yields a large savings in the utilization of IP address space.