Classless Inter-Domain Routing (CIDR)

Classless inter-domain routing is an addressing scheme for the Internet which allows IP addresses to be allocated more efficiently than the original class-based system of IP addressing, and is now used by most gateway routers. All Internet service providers are expected to use it for routing, and CIDR is supported by many routing protocols, including BGP and OSPF. Using the class-based addressing scheme the Internet could support the following:

Class-based IP Addressing
ClassNetwork bitsHost bitsNetwork address rangeNo of networksNo of hosts
A8241-12612616,777,214
B1616128-19165,53365,534
C248192-2232,097,152254


In theory, a 32-bit IP addressing scheme would yield 2 32 (4,294,967,296) possible IP addresses. The use of the class system reduces the total number of IP addresses possible to just over half that number (2,147,483,774). Even this number is somewhat academic, since the allocation of IP addresses under the class system means that many addresses are not used. A single class C network that uses global IP addresses, for example, accounts for 254 global IP addresses. If the network has only 100 hosts, 154 of these addresses remain unused and are unavailable for use by other networks. The result is that only a small percentage of the addresses assigned are actually used. CIDR was developed as a short term solution to this problem, and provides a more flexible way for routers to specify network addresses. Despite the introduction of CIDR, the continued rapid growth of the Internet means that IP addresses are still treated as a scarce resource, and customers are required to document their projected needs. The long term solution to the shortage of global IP adrresses is the introduction of IPv6 with its 128-bit addressing scheme, but it may be some time before IPv6 is in widespread use.

Another problem relates to the size of Internet routing tables. As the number of networks increases, so do the number of possible routes through the Internet. A routing table can contain a theoretical maximum number of entries of about 60,000. This number would have proved inadequete by now if it had not been for CIDR, which uses hierarchical routing aggregation to minimise the number of entries required. CIDR IP addresses contain a network prefix that can identify either an individual network gateway or an aggregation of gateways. The length of the network prefix can vary from 13 to 27 bits, enabling blocks of addresses to be assigned according to the needs of an organisation, allowing for networks with as few as 32 hosts, or as many as half a million hosts. The length of the CIDR network prefix is specified using a suffix that follows the 32-bit IP address, as illustrated below:

206.13.01.48/25

In the above example, the first 25 bits are used to identify the network, and the remaining bits identify the host. A shorter suffix can be used to describe many possible destinations, and is less specific. A routing table entry can thus represent an aggregation of networks, sometimes referred to as a supernet . Routers that support CIDR are required to use the most specific suffix available to them when forwarding packets. Large blocks of addresses are assigned by Regional Internet Registries (RIRs) to Internet Service Providers (ISPs), who allocate smaller blocks of addresses to their customers, with a network prefix of a length appropriate to their needs. In global routing tables, all of the networks and hosts connected to a single ISP may be represented by just one routing table entry. In this way, the growth in the number of routing table entries required at each level of the network hierarchy has been significantly reduced. The table below shows the effect of the length of network prefix used on the number of hosts a network can support.

Classless Inter Domain Routing (CIDR)
CIDR SuffixEquivalent classNo of hostsSubnet mask
/27Class C * 1/832255.255.255.224
/26Class C * 1/464255.255.255.192
/25Class C * 1/2128255.255.255.128
/24Class C256255.255.255.000
/23Class C * 2512255.255.254.000
/22Class C * 41,024255.255.252.000
/21Class C * 82,048255.255.248.000
/20Class C * 164,096255.255.240.000
/19Class C * 328,192255.255.224.000
/18Class C * 6416,384255.255.192.000
/17Class C * 12832,768255.255.128.000
/16Class B65,536255.255.000.000
/15Class B * 2131,072255.254.000.000
/14Class B * 4262,144255.252.000.000
/13Class B * 8524,288255.248.000.000