A routing system used by routers and gateways on the backbone of the Internet for routing packets. Classless interdomain routing (CIDR) is a more efficient routing mechanism than the original method of segregating network IP addresses into classes named class A, class B, and class C.
The reason for CIDR is that while class A networks support large numbers of network nodes, there are not enough class A network IDs to go around. Similarly, while many class C network IDs are available, many companies require more than the 254 IP addresses available on a class C network, but not nearly as many as the 65,534 IP addresses available on a class B network.
CIDR replaces the old class method of allocating 8, 16, or 24 bits to the network ID, and instead allows any number of contiguous bits in the IP address to be allocated as the network ID. For example, if a company needs a few thousand IP addresses for its network, it can allocate 11 or 12 bits of the address for the network ID instead of 8 bits for a class C (which wouldn’t work because you would need to use several class C networks) or 16 bits for class B (which is wasteful).
CIDR assigns a numerical prefix to each IP address. For example, a typical destination IP address using CIDR might be 18.104.22.168/13. The prefix 13 indicates that the first 13 bits of the IP address identify the network, while the remaining 32 - 13 = 19 bits identify the host.
The prefix helps to identify the Internet destination gateway or group of gateways to which the packet will be forwarded. Prefixes vary in size, with longer prefixes indicating more specific destinations.
Routers use the longest possible prefix in their routing tables when determining how to forward each packet. CIDR enables packets to be sent to groups of networks instead of to individual networks, which considerably simplifies the complex routing tables of the Internet's backbone routers.