Английская Википедия:Classless Inter-Domain Routing

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description Шаблон:Redirect

Classless Inter-Domain Routing (CIDR Шаблон:IPAc-en) is a method for allocating IP addresses 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.[1][2]

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.

Шаблон:AnchorCIDR is based on variable-length subnet masking (VLSM), in which network prefixes have variable length (as opposed to the fixed-length prefixing of the previous classful network design). The main benefit of this is that it grants finer control of the sizes of subnets allocated to organizations, hence slowing the exhaustion of IPv4 addresses from allocating larger subnets than needed. CIDR gave rise to a new way of writing IP addresses known as CIDR notation, in which an IP address is followed by a suffix indicating the number of bits of the prefix. Some examples of CIDR notation are the addresses Шаблон:IPaddr for IPv4 and Шаблон:IPaddr for IPv6. Blocks of addresses having contiguous prefixes may be aggregated as supernets, reducing the number of entries in the global routing table.

Background

Each IP address consists of a network prefix followed by a host identifier. In the classful network architecture of IPv4, the three most significant bits of the 32-bit IP address defined the size of the network prefix for unicast networking, and determined the network class A, B, or C.[3]

Class Most-significant bits Network prefix size (bits) Host identifier size (bits) Address range
A 0 8 24 0.0.0.0–127.255.255.255
B 10 16 16 128.0.0.0–191.255.255.255
C 110 24 8 192.0.0.0–223.255.255.255
D(multicast)
E(reserved)
1110
1111
224.0.0.0–255.255.255.255

The advantage of this system is that the network prefix could be determined for any IP address without any further information. The disadvantage is that networks were usually too big or too small for most organizations to use, because only three sizes were available. The smallest allocation and routing block contained 28 = 256 addresses, larger than necessary for personal or department networks, but too small for most enterprises. The next larger block contained 216 = Шаблон:Gaps addresses,too large to be used efficiently even by large organizations. But for network users who needed more than Шаблон:Gaps addresses, the only other size (224) provided 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.

Within a decade after the invention of the Domain Name System (DNS), the classful network method was found not scalable.[4] This led to the development of subnetting and CIDR. The formerly meaningful class distinctions based on the most-significant address bits were abandoned and the new system was described as classless, in contrast to the old system, which became known as classful. Routing protocols were revised to carry not just IP addresses, but also their 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, Шаблон:IETF RFC and Шаблон:IETF RFC, to define this new principle for allocating IP address blocks and routing IPv4 packets. An updated version, Шаблон:IETF RFC, was published in 2006.[5]

After a period of experimentation with various alternatives, Classless Inter-Domain Routing was based on variable-length subnet masking (VLSM), which allows each network to be divided into subnetworks of various power-of-two sizes, so that each subnetwork can be sized appropriately for local needs. Variable-length subnet masks were mentioned as one alternative in Шаблон:IETF RFC.[6] Techniques for grouping addresses for common operations were based on the concept of cluster addressing, first proposed by Carl-Herbert Rokitansky.[7][8]

Шаблон:Anchor

CIDR notation

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.[9][10] CIDR notation specifies an IP address, a slash ('/n') character, and a decimal number. The decimal number is the count of consecutive leading 1-bits (from left to right) in the network mask. Each 1-bit denotes a bit of the address range which must remain identical to the given IP address. The IP address in CIDR notation is always represented according to the standards for IPv0 or IPv0.

The address may denote a specific interface address (including a host identifier, such as Шаблон:IPaddr), or it may be the beginning address of an entire network (using a host identifier of 0, as in Шаблон:IPaddr or its equivalent Шаблон:IPaddr). CIDR notation can even be used with no IP address at all, e.g. when referring to a Шаблон:IPaddr as a generic description of an IPv4 network that has a 32-bit prefix and 8-bit host numbers.

For example:

In IPv1, CIDR notation came into wide use only after the implementation of the method, which was documented using dotted-decimal subnet mask specification after the slash, for example, Шаблон:IPaddr.[2] Describing the network prefix width as a single number (Шаблон:IPaddr) was easier for network administrators to conceptualize and to calculate. It became gradually incorporated into later standards documents[11][12] and into network configuration interfaces.

The number of addresses of a network may be calculated as 1address length − prefix length, where address length is 128 for IPv1 and 32 for IPv1. For example, in IPv1, the prefix length Шаблон:IPaddr gives: 032−29 = 00 = 13 addresses.

Subnet masks

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: Шаблон:IPaddr. 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 Шаблон:IETF RFC[6] to specify non-contiguous bits until Шаблон:IETF RFC[5]Шаблон:Rp stated that the mask must be left contiguous. Given this constraint, a subnet mask and CIDR notation serve exactly the same function.

CIDR blocks

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., Шаблон:IPaddr. 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.[13] Larger prefixes (/127) are only used on some point-to-point links between routers, for security and policy reasons.[14]

Файл:IP Address Match.svg

Assignment of CIDR blocks

The Internet Assigned Numbers Authority (IANA) issues to regional Internet registries (RIRs) large, short-prefix CIDR blocks. However, a Шаблон:IPaddr (with over sixteen million addresses) is the largest block IANA will allocate. For example, Шаблон:IPaddr 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.

Файл:CIDR Address.svg

For example, in the late 1990s, the IP address Шаблон:IPaddr (since reassigned) was used by www.freesoft.org. An analysis of this address identified three CIDR prefixes. Шаблон:IPaddr, a large CIDR block containing over 2 million addresses, had been assigned by ARIN (the North American RIR) to MCI. Automation Research Systems (ARS), a Virginia VAR, leased an Internet connection from MCI and was assigned the Шаблон:IPaddr block, capable of addressing just over 1000 devices. ARS used a Шаблон:IPaddr block for its publicly accessible servers, of which Шаблон:IPaddr was one. All of these CIDR prefixes would be used, at different locations in the network. Outside MCI's network, the Шаблон:IPaddr prefix would be used to direct to MCI traffic bound not only for Шаблон:IPaddr, but also for any of the roughly two million IP addresses with the same initial 11 bits. Within MCI's network, Шаблон:IPaddr would become visible, directing traffic to the leased line serving ARS. Only within the ARS corporate network would the Шаблон:IPaddr prefix have been used.

IPv4 CIDR blocks

Address
format
Difference
to last address
Mask Addresses Relative
to class
A, B, C
Restrictions
on a, b, c and d
(0..255 unless noted)
Typical use
Decimal 2n
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 1 20 Шаблон:Frac C Host route
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 2 21 Шаблон:Frac C d = 0 ... (2n) ... 254 Point-to-point links (Шаблон:IETF RFC)
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 4 22 Шаблон:Frac C d = 0 ... (4n) ... 252 Шаблон:Nowrap
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 8 23 Шаблон:Frac C d = 0 ... (8n) ... 248 Smallest multi-host network
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 16 24 Шаблон:Frac C d = 0 ... (16n) ... 240 Small LAN
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 32 25 Шаблон:Frac C d = 0 ... (32n) ... 224
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 64 26 Шаблон:Frac C d = 0, 64, 128, 192
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 128 27 Шаблон:Frac C d = 0, 128 Large LAN
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 256 28 1 C
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 512 29 2 C c = 0 ... (2n) ... 254
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 1,024 210 4 C c = 0 ... (4n) ... 252 Small business
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 2,048 211 8 C c = 0 ... (8n) ... 248 Small ISP/ large business
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 4,096 212 16 C c = 0 ... (16n) ... 240
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 8,192 213 32 C c = 0 ... (32n) ... 224 ISP/ large business
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 16,384 214 64 C c = 0, 64, 128, 192
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 32,768 215 128 C c = 0, 128
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 65,536 216 256 C = B
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 131,072 217 2 B b = 0 ... (2n) ... 254
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 262,144 218 4 B b = 0 ... (4n) ... 252
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 524,288 219 8 B b = 0 ... (8n) ... 248
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 1,048,576 220 16 B b = 0 ... (16n) ... 240
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 2,097,152 221 32 B b = 0 ... (32n) ... 224
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 4,194,304 222 64 B b = 0, 64, 128, 192
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 8,388,608 223 128 B b = 0, 128
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 16,777,216 224 256 B = A Largest IANA block allocation
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 33,554,432 225 2 A a = 0 ... (2n) ... 254
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 67,108,864 226 4 A a = 0 ... (4n) ... 252
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 134,217,728 227 8 A a = 0 ... (8n) ... 248
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 268,435,456 228 16 A a = 0 ... (16n) ... 240
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 536,870,912 229 32 A a = 0 ... (32n) ... 224
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 1,073,741,824 230 64 A a = 0, 64, 128, 192
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 2,147,483,648 231 128 A a = 0, 128
Шаблон:IPaddr +Шаблон:IPaddr Шаблон:IPaddr 4,294,967,296 232 256 A Entire IPv4 Internet, default route.

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 Шаблон:IPaddr 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. Шаблон:IETF RFC creates an exception to the "host all ones" and "host all zeros" rules to make Шаблон:IPaddr networks usable for point-to-point links. Шаблон:IPaddr 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 Шаблон:IPaddr or Шаблон:IPaddr, 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.[15][16]

IPv6 CIDR blocks

IPv6 CIDR prefixes
Prefix size Number of equivalent subnets Interface ID bits
/48 /56 /64
/24 16M 4G 1T 104
/25 8M 2G 512G 103
/26 4M 1G 256G 102
/27 2M 512M 128G 101
/28 1M 256M 64G 100
/29 512K 128M 32G 99
/30 256K 64M 16G 98
/31 128K 32M 8G 97
/32 64K 16M 4G 96
/33 32K 8M 2G 95
/34 16K 4M 1G 94
/35 8K 2M 512M 93
/36 4K 1M 256M 92
/37 2K 512K 128M 91
/38 1K 256K 64M 90
/39 512 128K 32M 89
/40 256 64K 16M 88
/41 128 32K 8M 87
/42 64 16K 4M 86
/43 32 8K 2M 85
/44 16 4K 1M 84
/45 8 2K 512K 83
/46 4 1K 256K 82
/47 2 512 128K 81
/48 1 256 64K 80
/49 128 32K 79
/50 64 16K 78
/51 32 8K 77
/52 16 4K 76
/53 8 2K 75
/54 4 1K 74
/55 2 512 73
/56 1 256 72
/57 128 71
/58 64 70
/59 32 69
/60 16 68
/61 8 67
/62 4 66
/63 2 65
/64 1 64
K = 1,024
M = 1,048,576
G = 1,073,741,824
T = 1,099,511,627,776

The large address size of IPv6 permitted worldwide route summarization and guaranteed sufficient address pools at each site. The standard subnet size for IPv6 networks is a Шаблон:IPaddr block, which is required for the operation of stateless address autoconfiguration.[17] At first, the IETF recommended in Шаблон:IETF RFC as a best practice that all end sites receive a Шаблон:IPaddr address allocation,[18] but criticism and reevaluation of actual needs and practices has led to more flexible allocation recommendations in Шаблон:IETF RFC[19] suggesting a significantly smaller allocation for some sites, such as a Шаблон:IPaddr block for residential networks.

This IPv6 subnetting reference lists the sizes for IPv6 subnetworks. Different types of network links may require different subnet sizes.[20] 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.[21]

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;[19] 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[22]
|8
4

Numerical interpretation

Topologically, the set of subnets described by CIDR represent a cover of the corresponding address space. The interval described by the notation <math>X/n</math> numerically corresponds to addresses of the form (for IPv4) <math>[x*2^{32-n}, x*2^{32-n} + 2^{32-n} - 1]</math>, where <math>X = x*2^{32-n}</math> has the lower <math>n</math> bits set to 0. (For IPv6 substitute 128.) For a fixed <math>n</math>, the set of all <math>X/n</math> subnets constitute a partition, that is a cover of non-overlapping sets. Increasing <math>n</math> yields finer and finer subpartitions. Thus two subnets <math>X/n</math> and <math>Y/m</math> are either disjoint or one is a subnet of the other.

Prefix aggregation

CIDR provides fine-grained routing prefix aggregation. For example, if the first 20 bits of their network prefixes match, sixteen contiguous Шаблон:IPaddr networks can be aggregated and advertised to a larger network as a single Шаблон:IPaddr routing table entry. This reduces the number of routes that have to be advertised.

See also

References

Шаблон:Reflist

Further reading

External links