Subnetting
Subnetting, documented in RFC 950, originally referred to the subdivision of a class-based network into subnetworks, but now refers more generally to the subdivision of a CIDR block into smaller CIDR blocks. Subnetting allows single routing entries to refer either to the larger block or to its individual constituents. This permits a single, general routing entry to be used through most of the Internet, more specific routes only being required for routers in the subnetted block.
A subnet mask is a 32-bit number that determines how an IP address is split into network and host portions, on a bitwise basis. For example, 255.255.0.0 is a standard class B subnet mask, since the first two bytes are all ones (network), and the last two bytes are all zeros (host). In a subnetted network, the network portion is extended. For example, a subnet mask of 255.255.255.0 would subnet a class B address space using its third byte. Using this scheme, the first two bytes of an IP address would identify the class B network, the next byte would identify the subnet within that network, and the final byte would select an individual host. Since subnet masks are used on a bit-by-bit basis, masks like 255.255.240.0 (4 bits of subnet; 12 bits of host) are perfectly normal.
In a traditional subnetted network, several restrictions apply, which have been lifted by CIDR. However, if older, non-CIDR routing protocols (such as RIP version 1) are in use, these restrictions must still be observed.
Identical subnet masks. Since non-CIDR routing updates do not include subnet masks, a router must assume that the subnet mask it has been configured with is valid for all subnets. Therefore, a single mask must be used for all subnets with a network. Different masks can be used for different networks. Based on this assumption, a router can exchange subnet routes with other routers within the network. Since the subnet masks are identical across the network, the routers will interpret these routes in the same manner. However, routers not attached to the subnetted network can't interpret these subnet routes, since they lack the subnet mask. Therefore, subnet routes are not relayed to routers on other networks. This leads to our second restriction.
Contiguous subnets. A subnetted network can't be split into isolated portions. All the subnets must be contiguous, since routing information can't be passed to non-members. Within a network, all subnets must be able to reach all other subnets without passing traffic through other networks.
Variable Length Subnet Masks (VLSM)
VLSM, conceptually a stepping stone from subnetting to CIDR, lifted the restrictions of subnetting by relaying subnet information through routing protocols. This idea leads us directly to CIDR.