Classless Inter-Domain Routing: Difference between revisions

Content deleted Content added
ce
Tags: Mobile edit Mobile app edit iOS app edit App section source
+at
Tags: Mobile edit Mobile app edit iOS app edit App full source
 
(One intermediate revision by the same user not shown)
Line 71:
 
==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||24|netmask=dotted}}. 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|950}}<ref name="RFC 950 2.1"/> to specify non-contiguous bits until {{IETF RFC|4632}}<ref name="RFC 4632"/>{{rp|at=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 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|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 2<sup>32−''n''</sup> 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.