Classless Inter-Domain Routing

This is an old revision of this page, as edited by Baccala@freesoft.org (talk | contribs) at 22:28, 8 November 2005 (Key Concepts). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Classless Inter-Domain Routing (CIDR), introduced starting in 1993, is the latest refinement to the way IP addresses are interpreted. It replaced the previous generation of IP address syntax, classful networks. It allowed increased flexibility when dividing ranges of IP addresses into separate networks. It thereby promoted:

  • More efficient use of increasingly scarce IPv4 addresses.
  • Greater use of hierarchy in address assignments (prefix aggregation), lowering the overhead of the Internet-wide routing.


Key Concepts

 

CIDR is principally a bitwise, prefix-based standard for the interpretation of IP addresses. It facilitates routing by allowing blocks of addresses to be grouped together into single routing table entries. These groups, commonly called CIDR blocks, share an initial sequence of bits in the binary representation of their addresses, and are identified using a syntax similar to that of IP addresses: a four-part dotted-decimal address, followed by a slash, then a number from 0 to 32: A.B.C.D/N. The dotted-decimal portion is interpreted, like an IP address, as a 32-bit binary number that has been broken into four 8-bit bytes. The number following the slash is the prefix length, the number of shared initial bits, counting from the left-hand side of the address. When speaking in abstract terms, the dotted-decimal portion is sometimes omitted, thus a /20 is a CIDR block with an unspecified 20-bit prefix.

An IP address is part of a CIDR block, and is said to match the CIDR prefix, if the initial N bits of the address and the CIDR prefix are the same. Thus, understanding CIDR requires that IP address be visualized in binary. Since the length of an IP address is fixed at 32 bits, an N-bit CIDR prefix leaves   bits unmatched, and there are   possible combinations of these bits, meaning that   IP addresses match a given N-bit CIDR prefix. Shorter CIDR prefixes match more IP addresses, while longer CIDR prefixes match fewer. An IP address can match multiple CIDR prefixes of different lengths.

CIDR is also be used with IPv6 addresses, where the prefix length can range from 0 to 128, due to the larger number of bits in the address.

Assignment of CIDR blocks

 

The Internet Assigned Numbers Authority (IANA) issues to Regional Internet Registries (RIRs) large CIDR blocks. The RIRs, each responsible for a single, large, geographic area (such as North America), then subdivide these blocks into smaller blocks and issue them publically, typically (but not always), to Internet Service Providers (ISPs). This process can be repeated several times at different levels of delegation. ISPs often issue CIDR blocks to subscribers.

For example, in the late 1990s, the IP address 208.130.29.33 (since reassigned) was used by the www.freesoft.org web server. An analysis of this address identified three CIDR prefixes. 208.128.0.0/11, a large block containing over 2 million addresses, had been assigned by ARIN (the North American RIR) to MCI. Automation Research Systems, a Virginia VAR, leased an Internet connection from MCI and was assigned the 208.130.28.0/22 sub-prefix, capable of addressing just over 1000 devices. ARS used a /24 block for its public web servers, of which 208.130.29.33 was one.

All of these CIDR prefixes would be used, at different locations in the network. Outside of MCI's network, the 208.128.0.0/11 prefix would be used to direct to MCI traffic bound not only for 208.130.29.33, but also for any of the roughly two million IP addresses with the same initial 11 bits. Within MCI's network, 208.130.28.0/22 would be visible, directing traffic to the leased line serving this client. Only within the Automation Research Systems corporate network would the 208.130.29.0/24 prefix be used.

CIDR and masks

A subnet mask is a bitmask which shows where the network address ends and the host address begins. CIDR uses variable length subnet masks (VLSM) to allocate IP addresses to subnets according to individual need, rather than some general network-wide rule. Thus the network/host division can occur at any bit boundary in the address. The process can be recursive, with a portion of the address space being further divided into even smaller portions, through the use of masks which cover more bits.

Because the normal class distinctions are ignored, the new system was called classless routing. This led to the original system being called, by back-formation, classful routing.

CIDR/VLSM network addresses are now used throughout the public Internet, although they are also used elsewhere, particularly in large private networks. An average desktop LAN user generally does not see them in practice, as their LAN network is usually numbered using special private RFC 1918 addresses.

Prefix aggregation

Another benefit of CIDR is the possibility of routing prefix aggregation (also known as "summarization"). For example, sixteen contiguous /24 networks could now be aggregated together, and advertised to the outside world as a single /20 route (if the first 20 bits of their network addresses match). Two contiguous /20s could then be aggregated to a /19, and so forth. This allowed a significant reduction in the number of routes that had to be advertised over the Internet, preventing 'routing table explosion' from overwhelming routers, and stopping the Internet from expanding further.

CIDR
CIDR Class Hosts Mask
/32 1/256 C 1 255.255.255.255
/31 1/128 C 2 255.255.255.254
/30 1/64 C 4 255.255.255.252
/29 1/32 C 8 255.255.255.248
/28 1/16 C 16 255.255.255.240
/27 1/8 C 32 255.255.255.224
/26 1/4 C 64 255.255.255.192
/25 1/2 C 128 255.255.255.128
/24 1 C 256 255.255.255.000
/23 2 C 512 255.255.254.000
/22 4 C 1024 255.255.252.000
/21 8 C 2048 255.255.248.000
/20 16 C 4096 255.255.240.000
/19 32 C 8192 255.255.224.000
/18 64 C 16384 255.255.192.000
/17 128 C 32768 255.255.128.000
/16 256 C, 1 B 65536 255.255.000.000
/15 512 C, 2 B 131072 255.254.000.000
/14 1024 C, 4 B 262144 255.252.000.000
/13 2048 C, 8 B 524288 255.248.000.000
/12 4096 C, 16 B 1048576 255.240.000.000
/11 8192 C, 32 B 2097152 255.224.000.000
/10 16384 C, 64 B 4194304 255.192.000.000
/9 32768 C, 128B 8388608 255.128.000.000
/8 65536 C, 256B, 1 A 16777216 255.000.000.000
/7 131072 C, 512B, 2 A 33554432 254.000.000.000
/6 262144 C, 1024 B, 4 A 67108864 252.000.000.000
/5 524288 C, 2048 B, 8 A 134217728 248.000.000.000
/4 1048576 C, 4096 B, 16 A 268435456 240.000.000.000
/3 2097152 C, 8192 B, 32 A 536870912 224.000.000.000
/2 4194304 C, 16384 B, 64 A 1073741824 192.000.000.000
/1 8388608 C, 32768 B, 128 A 2147483648 128.000.000.000

Historical Background

IP addresses are separated into two parts: the network address (which identifies a whole network or subnet), and the host address (which identifies a particular machine's connection or interface to that network). This division is used to control how traffic is routed in and among IP networks.

Historically, the IP address space was divided into three main 'classes of network', where each class had a fixed network size. The class, and hence the length of the subnet mask and the number of hosts on the network, could always be determined from the most significant bits of the IP address. Without any other way of specifying the length of a subnet mask, routing protocols necessarily used the class of the IP address specified in route advertisements to determine the size of the routing prefixes to be set up in the routing tables.