Class-based IP addressing is fairly rigid. Thus, a small company with 50 hosts that wants to connect to the
Internet would need a Class C address. However, a Class C address range supports 253 hosts; therefore 203
addresses would be wasted. Similarly, a company with 4,000 hosts would require a Class B address to
connect to the Internet. A Class B address can support up to 65,023 hosts, resulting in 61,023 addresses
being wasted. This problem can be overcome by extending the default subnet mask by adding more
continuous 1s to it. The result is that the network can support less hosts. Thus, the company that has 4,000
hosts would use a Class B address with a subnet mask of 255.255.240.0. This is achieved by extending the
subnet mask by 4 bits so that the first 20 bits represent the network ID and 12 bits only represent the host ID.
Thus the address range now supports only 4,094 hosts, representing a loss of only 94 addresses. We can
calculate the number of hosts supported by using the formula: 2n-2 where n is the number of bits used for the
host ID. We need to subtract 2 addresses: the network address and the broadcast address. In this example, 12
bits are used for the host ID. Thus using the formula we can see that this subnet mask supports 4,094 hosts
(212-2).
We can calculate the number of subnets supported by a subnet mask by using the same formula: 2n-2.
However, this time n is the number of bits used for the network ID. We again need to subtract 2 addresses:
the network address and the broadcast address. Thus, in the example 255.255.240.0, 20 bits represent the
network ID therefore this subnet mask supports 1048,574 subnets (220-2).
This solves the problem of IP address allocation on the internet but presents a problem for routing tables, as
the routing table cannot determine the subnet mask on the basses of the IP address class. Hence a different
format of representing the IP address and its subnet mask is required. This format is called the Classless
Interdomain Routing (CIDR) notation, or prefix notation. CIDR is in essence an adaptation of the Dotted
Decimal Format and represents the subnet mask as a number of bits used for the network ID. This number of
bits is indicated after the IP address by the number that follows the slash (/) symbol. For example, the CIDR
notation IP address 140.12.2.128/20 indicates that the first 20 bits of the IP address is used for the subnet
mask, i.e., the first 20 bits are all 1s. Thus, the subnet mask expressed in binary format is
111101111.111101111.111100000.000000000, being represented in dotted decimal format as
255.255.240.0. In addition, the routing protocols must send the mask with the routing update.