Classless Inter-Domain Routing
Classless Inter-Domain Routing (CIDR / -/,) is a method for allocating IP addresses and for IP routing. The Internet Engineering Task Force introduced CIDR in 1993 to replace the previous classful network addressing architecture on the Internet. Its goal was to slow the growth of routing tables on routers across the Internet, and to help slow the rapid exhaustion of IPv4 addresses.
IP addresses are described as consisting of two groups of bits in the address: the most significant bits are the network prefix, which identifies a whole network or subnet, and the least significant set forms the host identifier, which specifies a particular interface of a host on that network. This division is used as the basis of traffic routing between IP networks and for address allocation policies.
Whereas classful network design for IPv4 sized the network prefix as one or more 8-bit groups, resulting in the blocks of Class A, B, or C addresses, under CIDR address space is allocated to Internet service providers and end users on any address-bit boundary. In IPv6, however, the interface identifier has a fixed size of 64 bits by convention, and smaller subnets are never allocated to end users.
CIDR encompasses several concepts. It is based on variable-length subnet masking (VLSM) which allows the specification of arbitrary-length prefixes. CIDR introduced a new method of representation for IP addresses, now commonly known as CIDR notation, in which an address or routing prefix is written with a suffix indicating the number of bits of the prefix, such as 192.0.2.0/24 for IPv4, and 2001:db8::/32 for IPv6. CIDR introduced an administrative process of allocating address blocks to organizations based on their actual and short-term projected needs. The aggregation of multiple contiguous prefixes resulted in supernets in the larger Internet, which whenever possible are advertised as aggregates, thus reducing the number of entries in the global routing table.
An IP address is interpreted as composed of two parts: a network-identifying prefix followed by a host identifier within that network. In automating the routing of packets to a given IP network, the question is how many bits of the address are in the network prefix, and how many are in the host identifier. In the previous IPv4 classful network architecture, the top three bits of the 32-bit IP address defined how many bits were in the network prefix:
|Top 3 bits||Network prefix bits||Host identifier bits||Class||Example IP address|
|000 thru 011||8||24||Class A||22.214.171.124|
|100 thru 101||16||16||Class B||126.96.36.199|
The advantage of this system is that the network prefix could be determined for any IP address without any further information. The disadvantage is because only three sizes are available, networks were usually too big or too small for most organizations to use. The smallest allocation and routing block contained 256 addresses — larger than necessary for personal or department networks, but too small for most enterprises. The next larger block contained 65536 addresses—too large to be used efficiently even by large organizations. But for network users who needed more than 65536 addresses, the only other size gave them far too many, more than 16 million. This led to inefficiencies in address use as well as inefficiencies in routing, because it required a large number of allocated class-C networks with individual route announcements, being geographically dispersed with little opportunity for route aggregation.
During the first decade of the Internet after the invention of the Domain Name System (DNS) it became apparent that the devised system based on the classful network scheme of allocating the IP address space and the routing of IP packets was not scalable. This led to the successive development of subnetting and CIDR. The formerly meaningful class distinctions based on the top 3 address bits were removed, and the new system was described as being classless, with respect to the old system, which became known as classful. Routing protocols were revised to carry not just Internet addresses, but also their matching subnet masks. Implementing CIDR required every host and router on the Internet to be reprogrammed in small ways—no small feat at a time when the Internet was entering a period of rapid growth. In 1993, the Internet Engineering Task Force published a new set of standards, RFC 1518 and RFC 1519, to define this new concept of allocation of IP address blocks and new methods of routing IPv4 packets. An updated version of the specification was published as RFC 4632 in 2006.
After a period of experimenting with various alternatives, Classless Inter-Domain Routing was based on variable-length subnet masking (VLSM), which allows each network to be allocated and/or divided into various power-of-two-sized subnets, providing the opportunity to size each network or subnet appropriately for local needs. Variable-length subnet masks were mentioned as one alternative in RFC 950. Techniques for grouping addresses for common operations were based on the concept of cluster addressing, first proposed by Carl-Herbert Rokitansky.
CIDR notation is a compact representation of an IP address and its associated network mask. The notation was invented by Phil Karn in the 1980s. CIDR notation specifies an IP address, a slash ('/') character, and a decimal number. The decimal number is the count of leading 1 bits in the network mask. The number can also be thought of as the width (in bits) of the network prefix. The IP address in CIDR notation is always represented according to the standards for IPv4 or IPv6.
The address may denote a specific interface address (including a host identifier, such as 10.0.0.1/8), or it may be the beginning address of an entire network (using a host identifier of 0, as in 10.0.0.0/8 or its equivalent 10/8). CIDR notation can even be used with no IP address at all, e.g. when referring to a /24 as a generic description of an IPv4 network that has a 24-bit prefix and 8-bit host numbers.
- 192.168.100.14/24 represents the IPv4 address 192.168.100.14 and its associated network prefix 192.168.100.0, or equivalently, its subnet mask 255.255.255.0, which has 24 leading 1-bits.
- the IPv4 block 192.168.100.0/22 represents the 1024 IPv4 addresses from 192.168.100.0 to 192.168.103.255.
- the IPv6 block 2001:db8::/48 represents the block of IPv6 addresses from 2001:db8:0:0:0:0:0:0 to 2001:db8:0:ffff:ffff:ffff:ffff:ffff.
- ::1/128 represents the IPv6 loopback address. Its prefix length is 128 which is the number of bits in the address.
In IPv4, what is now called CIDR notation came into wide use only after the implementation of CIDR. It does not appear in the original CIDR standards, which instead used a dotted-decimal subnet mask after the slash; for example, 188.8.131.52/255.255.252.0. Describing the network prefix's width as a single number (184.108.40.206/22) was easier for network administrators to conceptualize and to mentally calculate, so it gradually became incorporated into later standards documents and into network configuration interfaces.
The number of addresses inside a network or subnet may be calculated as 2address length − prefix length, where address length is 128 for IPv6 and 32 for IPv4. For example, in IPv4, the prefix length /29 gives: 232 − 29 = 23 = 8 addresses.
A subnet mask is a bitmask that encodes the prefix length associated with an IPv4 address or network in quad-dotted notation: 32 bits, starting with a number of 1 bits equal to the prefix length, ending with 0 bits, and encoded in four-part dotted-decimal format: 255.255.255.0. A subnet mask encodes the same information as a prefix length but predates the advent of CIDR. In CIDR notation, the prefix bits are always contiguous. Subnet masks were allowed by RFC 950 to specify non-contiguous bits until RFC 4632:Section 5.1 stated that the mask must be left contiguous. Given this constraint, a subnet mask and CIDR notation serve exactly the same function.
CIDR is principally a bitwise, prefix-based standard for the representation of IP addresses and their routing properties. It facilitates routing by allowing blocks of addresses to be grouped into single routing table entries. These groups, commonly called CIDR blocks, share an initial sequence of bits in the binary representation of their IP addresses. IPv4 CIDR blocks are identified using a syntax similar to that of IPv4 addresses: a dotted-decimal address, followed by a slash, then a number from 0 to 32, i.e., a.b.c.d/n. The dotted decimal portion is the IPv4 address. The number following the slash is the prefix length, the number of shared initial bits, counting from the most-significant bit of the address. When emphasizing only the size of a network, the address portion of the notation is usually omitted. Thus, a /20 block 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. An IPv4 address is 32 bits so an n-bit CIDR prefix leaves 32 − n bits unmatched, meaning that 232 − n IPv4 addresses match a given n-bit CIDR prefix. Shorter CIDR prefixes match more addresses, while longer prefixes match fewer. In the case of overlaid CIDR blocks, an address can match multiple CIDR prefixes of different lengths.
CIDR is also used for IPv6 addresses and the syntax semantic is identical. The prefix length can range from 0 to 128, due to the larger number of bits in the address. However, by convention, a subnet on broadcast MAC layer networks always has 64-bit host identifiers. Larger prefixes are rarely used even on point-to-point links.
Assignment of CIDR blocks
The Internet Assigned Numbers Authority (IANA) issues to regional Internet registries (RIRs) large, short-prefix CIDR blocks. For example, 220.127.116.11/8 (with over sixteen million addresses) is administered by RIPE NCC, the European RIR. The RIRs, each responsible for a single, large, geographic area, such as Europe or North America, subdivide these blocks and allocate subnets to local Internet registries (LIRs). Similar subdividing may be repeated several times at lower levels of delegation. End-user networks receive subnets sized according to their projected short-term need. Networks served by a single ISP are encouraged by IETF recommendations to obtain IP address space directly from their ISP. Networks served by multiple ISPs, on the other hand, may obtain provider-independent address space directly from the appropriate RIR.
For example, in the late 1990s, the IP address 18.104.22.168 (since reassigned) was used by www.freesoft.org. An analysis of this address identified three CIDR prefixes. 22.214.171.124/11, a large CIDR 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 126.96.36.199/22 block, capable of addressing just over 1000 devices. ARS used a /24 block for its publicly accessible servers, of which 188.8.131.52 was one. All of these CIDR prefixes would be used, at different locations in the network. Outside MCI's network, the 184.108.40.206/11 prefix would be used to direct to MCI traffic bound not only for 220.127.116.11, but also for any of the roughly two million IP addresses with the same initial 11 bits. Within MCI's network, 18.104.22.168/22 would become visible, directing traffic to the leased line serving ARS. Only within the ARS corporate network would the 22.214.171.124/24 prefix have been used.
IPv4 CIDR blocks
to last address
A, B, C
on a, b, c and d
(0..255 unless noted)
|a.b.c.d/32||+0.0.0.0||255.255.255.255||1||20||1⁄256 C||Host route|
|a.b.c.d/31||+0.0.0.1||255.255.255.254||2||21||1⁄128 C||d = 0 ... (2n) ... 254||Point-to-point links (RFC 3021)|
|a.b.c.d/30||+0.0.0.3||255.255.255.252||4||22||1⁄64 C||d = 0 ... (4n) ... 252||Point-to-point links (glue network)|
|a.b.c.d/29||+0.0.0.7||255.255.255.248||8||23||1⁄32 C||d = 0 ... (8n) ... 248||Smallest multi-host network|
|a.b.c.d/28||+0.0.0.15||255.255.255.240||16||24||1⁄16 C||d = 0 ... (16n) ... 240||Small LAN|
|a.b.c.d/27||+0.0.0.31||255.255.255.224||32||25||⅛ C||d = 0 ... (32n) ... 224|
|a.b.c.d/26||+0.0.0.63||255.255.255.192||64||26||¼ C||d = 0, 64, 128, 192|
|a.b.c.d/25||+0.0.0.127||255.255.255.128||128||27||½ C||d = 0, 128||Large LAN|
|a.b.c.0/23||+0.0.1.255||255.255.254.0||512||29||2 C||c = 0 ... (2n) ... 254|
|a.b.c.0/22||+0.0.3.255||255.255.252.0||1,024||210||4 C||c = 0 ... (4n) ... 252||Small business|
|a.b.c.0/21||+0.0.7.255||255.255.248.0||2,048||211||8 C||c = 0 ... (8n) ... 248||Small ISP/ large business|
|a.b.c.0/20||+0.0.15.255||255.255.240.0||4,096||212||16 C||c = 0 ... (16n) ... 240|
|a.b.c.0/19||+0.0.31.255||255.255.224.0||8,192||213||32 C||c = 0 ... (32n) ... 224||ISP/ large business|
|a.b.c.0/18||+0.0.63.255||255.255.192.0||16,384||214||64 C||c = 0, 64, 128, 192|
|a.b.c.0/17||+0.0.127.255||255.255.128.0||32,768||215||128 C||c = 0, 128|
|a.b.0.0/16||+0.0.255.255||255.255.0.0||65,536||216||256 C = B|
|a.b.0.0/15||+0.1.255.255||255.254.0.0||131,072||217||2 B||b = 0 ... (2n) ... 254|
|a.b.0.0/14||+0.3.255.255||255.252.0.0||262,144||218||4 B||b = 0 ... (4n) ... 252|
|a.b.0.0/13||+0.7.255.255||255.248.0.0||524,288||219||8 B||b = 0 ... (8n) ... 248|
|a.b.0.0/12||+0.15.255.255||255.240.0.0||1,048,576||220||16 B||b = 0 ... (16n) ... 240|
|a.b.0.0/11||+0.31.255.255||255.224.0.0||2,097,152||221||32 B||b = 0 ... (32n) ... 224|
|a.b.0.0/10||+0.63.255.255||255.192.0.0||4,194,304||222||64 B||b = 0, 64, 128, 192|
|a.b.0.0/9||+0.127.255.255||255.128.0.0||8,388,608||223||128 B||b = 0, 128|
|a.0.0.0/8||+0.255.255.255||255.0.0.0||16,777,216||224||256 B = A||Largest IANA block allocation|
|a.0.0.0/7||+126.96.36.199||254.0.0.0||33,554,432||225||2 A||a = 0 ... (2n) ... 254|
|a.0.0.0/6||+188.8.131.52||252.0.0.0||67,108,864||226||4 A||a = 0 ... (4n) ... 252|
|a.0.0.0/5||+184.108.40.206||248.0.0.0||134,217,728||227||8 A||a = 0 ... (8n) ... 248|
|a.0.0.0/4||+220.127.116.11||240.0.0.0||268,435,456||228||16 A||a = 0 ... (16n) ... 240|
|a.0.0.0/3||+18.104.22.168||22.214.171.124||536,870,912||229||32 A||a = 0 ... (32n) ... 224|
|a.0.0.0/2||+126.96.36.199||192.0.0.0||1,073,741,824||230||64 A||a = 0, 64, 128, 192|
|a.0.0.0/1||+127.255.255.255||188.8.131.52||2,147,483,648||231||128 A||a = 0, 128|
In common usage, the first address in a subnet, all binary zero in the host identifier, is reserved for referring to the network itself, while the last address, all binary one in the host identifier, is used as a broadcast address for the network; this reduces the number of addresses available for hosts by 2. As a result, a /31 network, with one binary digit in the host identifier, would be unusable, as such a subnet would provide no available host addresses after this reduction. RFC 3021 creates an exception to the "host all ones" and "host all zeros" rules to make /31 networks usable for point-to-point links. /32 addresses (single-host network) must be accessed by explicit routing rules, as there is no room in such a network for a gateway.
In routed subnets larger than /31 or /32, the number of available host addresses is usually reduced by two, namely the largest address, which is reserved as the broadcast address, and the smallest address, which identifies the network itself.
IPv6 CIDR blocks
The large address size used in IPv6 permitted implementation of worldwide route summarization and guaranteed sufficient address pools at each site. The standard subnet size for IPv6 networks is a /64 block, which is required for the operation of stateless address autoconfiguration. At first, the IETF recommended in RFC 3177 as a best practice that all end sites receive a /48 address allocation, however, criticism and reevaluation of actual needs and practices has led to more flexible allocation recommendations in RFC 6177 suggesting a significantly smaller allocation for some sites, such as a /56 block for home networks.
This IPv6 subnetting reference lists the sizes for IPv6 subnetworks. Different types of network links may require different subnet sizes. The subnet mask separates the bits of the network identifier prefix from the bits of the interface identifier. Selecting a smaller prefix size results in fewer number of networks covered, but with more addresses within each network.
2001:0db8:0123:4567:89ab:cdef:1234:5678 |||| |||| |||| |||| |||| |||| |||| |||| |||| |||| |||| |||| |||| |||| |||| |||128 Single end-points and loopback |||| |||| |||| |||| |||| |||| |||| |||127 Point-to-point links (inter-router) |||| |||| |||| |||| |||| |||| |||| ||124 |||| |||| |||| |||| |||| |||| |||| |120 |||| |||| |||| |||| |||| |||| |||| 116 |||| |||| |||| |||| |||| |||| |||112 |||| |||| |||| |||| |||| |||| ||108 |||| |||| |||| |||| |||| |||| |104 |||| |||| |||| |||| |||| |||| 100 |||| |||| |||| |||| |||| |||96 |||| |||| |||| |||| |||| ||92 |||| |||| |||| |||| |||| |88 |||| |||| |||| |||| |||| 84 |||| |||| |||| |||| |||80 |||| |||| |||| |||| ||76 |||| |||| |||| |||| |72 |||| |||| |||| |||| 68 |||| |||| |||| |||64 Single LAN; default prefix size for SLAAC |||| |||| |||| ||60 Some (very limited) 6rd deployments (/60 = 16 /64 blocks) |||| |||| |||| |56 Minimal end sites assignment; e.g. home network (/56 = 256 /64 blocks) |||| |||| |||| 52 /52 block = 4096 /64 blocks |||| |||| |||48 Typical assignment for larger sites (/48 = 65536 /64 blocks) |||| |||| ||44 |||| |||| |40 |||| |||| 36 possible future local Internet registry (LIR) extra-small allocations |||| |||32 LIR minimum allocations |||| ||28 LIR medium allocations |||| |24 LIR large allocations |||| 20 LIR extra large allocations |||16 ||12 Regional Internet registry (RIR) allocations from IANA |8 4
CIDR provides fine-grained routing prefix aggregation. For example, if the first 20 bits of their network prefixes match, sixteen contiguous /24 networks can be aggregated and advertised to a larger network as a single /20 routing table entry. This reduces the number of routes that have to be advertised.
- Y. Rekhter; T. Li (September 1993). An Architecture for IP Address Allocation with CIDR. doi:10.17487/RFC1518. RFC 1518.
- V. Fuller; T. Li; J. Yu; K. Varadhan (September 1993). Classless Inter-Domain Routing (CIDR): an Address Assignment and Aggregation Strategy. doi:10.17487/RFC1519. RFC 1519.
- J. Reynolds; J. Postel, eds. (April 1985). Assigned Numbers. doi:10.17487/RFC0943. RFC 943.
- R. Hinden, ed. (September 1993). Applicability Statement for the Implementation of Classless Inter-Domain Routing (CIDR). doi:10.17487/RFC1517. RFC 1517.
- V. Fuller; T. Li (August 2006). Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan. doi:10.17487/RFC4632. RFC 4632.
- J. Mogul; J. Postel, eds. (August 1985). Internet Standard Subnetting Procedure. sec. 2.1. doi:10.17487/RFC0950. RFC 950.
- Carl-Herbert Rokitansky, "Internet Cluster Addressing Scheme and its Application to Public Data Networks", Proc. 9th International Conference on Computer Communication (ICCC' 88), pp. 482-491, Tel Aviv, Israel, Oct./Nov. 1988
- Cluster Addressing and CIDR in the mail archives of the IETF
- Brian Kantor (December 2018). "Re: Stupid Question maybe?". North American Network Operators Group.
/24 is certainly cleaner than 255.255.255.0. I seem to remember it was Phil Karn who in the early 80's suggested that expressing subnet masks as the number of bits from the top end of the address word was efficient, since subnet masks were always a series of ones followd by zeros with no interspersing, which was incorporated (or independently invented) about a decade later as CIDR a.b.c.d/n notation in RFC1519.
- William Simpson (December 2018). "Re: Stupid Question maybe?". North American Network Operators Group.
Actually, Brian is correct. Phil was w-a-y ahead of the times. But I don't remember him talking about it until the late '80s.
- T. Pummill; B. Manning (December 1995). Variable Length Subnet Table For IPv4. doi:10.17487/RFC1878. RFC 1878.
- S. Williamson; M. Kosters; D. Blacka; J. Singh; K. Zeilstra (June 1997). Referral Whois (RWhois) Protocol V1.5. doi:10.17487/RFC2167. RFC 2167.
IP networks are also lexically hierarchical labels using the Classless Inter-Domain Routing (CIDR) notation, but their hierarchy is not easily determined with simple text manipulation; for example, 184.108.40.206/22 is a part of 220.127.116.11/16, which is a part of 18.104.22.168/15.
- J. Mogul, ed. (October 1984). Broadcasting Internet Datagrams in the Presence of Subnets. sec. 7. doi:10.17487/RFC0922. RFC 922.
- F. Baker, ed. (June 1995). Requirements for IP Version 4 Routers. sec. 22.214.171.124. doi:10.17487/RFC1812. RFC 1812.
- RFC 4862
- IAB/IESG Recommendation on IPv6 Address Allocations to Sites. IAB/IESG. September 2001. doi:10.17487/RFC3177. RFC 3177.
- T. Narten; G. Huston; L. Roberts (March 2011). IPv6 Address Assignment to End Sites. doi:10.17487/RFC6177. RFC 6177.
- "ARIN IPv6 Addressing Plans". Getipv6.info. 2016-03-25. Retrieved 2018-03-12.
- "RIPE IP Allocation Rates". Archived from the original on 2011-02-03.
- "IANA IPv6 unicast address assignments". Iana.org. Retrieved 2018-03-12.
- Classless IN-ADDR.ARPA delegation. March 1998. doi:10.17487/RFC2317. RFC 2317.
- CIDR and Classful Routing. August 1995. doi:10.17487/RFC1817. RFC 1817.
- CIDR Report (updated daily)