Variable Length Subnet Masks (VLSM)
In 1987, RFC 1009 specified how a subnetted network could use more than one subnet
mask. When an IP network is assigned more than one subnet mask, it is considered
a network with "variable length subnet masks" since the extended-network-prefixes
have different lengths.
RIP-1 Permits Only a Single Subnet Mask
When using RIP-1, subnet masks have to be uniform across the entire network-prefix.
RIP-1 allows only a single subnet mask to be used within each network number
because it does not provide subnet mask information as part of its routing table
update messages. In the absence of this information, RIP-1 is forced to make very
simple assumptions about the mask that should be applied to any of its learned
routes.
How does a RIP-1 based router know what mask to apply to a route when it learns a new route from a neighbor? If the router has a subnet of the same network number assigned to a local interface, it assumes that the learned subnetwork was defined using the same mask as the locally configured interface. However, if the router does not have a subnet of the learned network number assigned to a local interface, the router has to assume that the network is not subnetted and applies the route's natural classful mask.
Assuming that Port 1 of a router has been assigned the IP address 130.24.13.1/24
and that Port 2 has been assigned the IP address 200.14.13.2/24. If the router learns
about network 130.24.36.0 from a neighbor, it applies a /24 mask since Port
1 is configured with another subnet of the 130.24.0.0 network. However, when the
router learns about network 131.25.0.0 from a neighbor, it assumes a "natural"
/16 mask since it has no other masking information available.
How does a RIP-1 based router know if it should include the subnet-number bits in
a routing table update to a RIP-1 neighbor? A router executing RIP-1 will only
advertise the subnet-number bits on another port if the update port is configured
with a subnet of the same network number. If the update port is configured with
a different subnet or network number, the router will only advertise the network
portion of the subnet route and "zero-out" the subnet-number field.
For example, assume that Port 1 of a router has been assigned the IP address 130.24.13.1/24 and that Port 2 has been assigned the IP address 200.14.13.2/24. Also, assume that the router has learned about network 130.24.36.0 from a neighbor. Since Port 1 is configured with another subnet of the 130.24.0.0 network, the router assumes that network 130.24.36.0 has a /24 subnet mask. When it comes to advertise this route, it advertises 130.24.36.0 on Port 1, but it only advertises 130.24.0.0 on Port 2.
For these reasons, RIP-1 is limited to only a single subnet mask for each network number. However, there are several advantages to be gained if more than one subnet mask can be assigned to a given IP network number:
Figure 15: 130.5.0.0/16 with a /22 Extended-Network Prefix
Please refer to Figure 15. A /16 network with a /22 extended-network prefix permits 64 subnets (2 6 ), each of which supports a maximum of 1,022 hosts (2 10 -2). This is fine if the organization wants to deploy a number of large subnets, but what about the occasional small subnet containing only 20 or 30 hosts? Since a subnetted network could have only a single mask, the network administrator was still required to assign the 20 or 30 hosts to a subnet with a 22-bit prefix. This assignment would waste approximately 1,000 IP host addresses for each small subnet deployed! Limiting the association of a network number with a single mask did not encourage the flexible and efficient use of an organization's address space.
One solution to this problem was to allow a subnetted network to be assigned more than one subnet mask. Assume that in the previous example, the network administrator is also allowed to configure the 130.5.0.0/16 network with a /26 extended-network-prefix. Please refer to Figure 16. A /16 network address with a /26 extended-network prefix permits 1024 subnets (2 10 ), each of which supports a maximum of 62 hosts (2 6 -2). The /26 prefix would be ideal for small subnets with less than 60 hosts, while the /22 prefix is well suited for larger subnets containing up to 1000 hosts.
Figure 16: 130.5.0.0/16 with a /26 Extended-Network Prefix