When computers were first a thing, it was realized that networking them together could be helpful. Early networks were isolated, and linking them up required the development of addressing standards, resulting in IPv4. In the early days. It was assumed that computers would stay a relative niche item, grouped in rather large networks. As the Internet grew and home computers and home internet connections became popular. It became clear that this line of thought was wrong.
The original idea was to hand out large batches of IP addresses to organizations that requested them. This system would have only allowed 255 calls, though, something the growing popularity of the Internet clearly would exceed. To replace this, the concept of classful networking was standardized. This created two smaller network sizes. The previous network sizes were referred to as Class A networks. Class B and Class C offered significantly smaller networks. But it allowed more of those in the limited IPv4 address space.
Unfortunately, the classful networking system wasn’t particularly efficient in using the IPv4 address space. Class C networks offered 255 possible IP addresses. Much more than necessary for home networks but too small for large organizations. These large organizations were then forced to use Class B networks, which offered 65535 IP addresses. Which was more than needed for most organizations.
With the limited IPv4 address space still being used up to fast, a new solution was needed. This was presented in the form of CIDR, or Classless Inter-Domain Routing. CIDR, pronounced “cider,” allows the allocation and use of almost arbitrarily sized networks. The size of a network is defined through a subnet mask, sometimes shortened to just “netmask.”
The core issue with the classful system was that it was difficult to efficiently use the available IPv4 address space because only three network sizes were possible. Classes A, B, and C networks used the first, second, and third octets to denote the network address. The last three, two, and one octet(s) tell the host IP address, respectively.
The concept of the variable length subnet mask (VLSM) introduced with CIDR enabled any number of address bits to be used to identify the network address and the host address. While this doesn’t allow networks of arbitrary sizes, it will enable much more efficient use of the limited IPv4 address space as the address space can be constrained to the nearest power of 2.
A subnet mask uses the same dotted quad notation as an IP address or the “extent” notation of IPv6 addresses when referring to IPv6 networks.
Note: Hextet is technically inaccurate as it would imply 6 bits rather than 16, though it is used in IPv6 documentation as the shorthand for the more accurate hexadectet. It is sometimes more humorously referred to as a “chomp” in line with the bit, nibble, and byte terminology for groupings of one, four, and eight bytes, respectively.
A key differentiator between subnet masks and IP addresses is that the subnet mask will always have all network identifying bits be one and all host identifying bits be 0 in the binary notation. As such, a subnet mask of 11111111.11111111.11111111. 00000000 would be represented as 255.255.255.0 and would be equivalent to the classic Class C network, with the first three octets used to identify the network address. And the last octet is used to determine the hosts in that network.
The original CIDR specification denoted subnet masks in the same format as the IP addressing scheme they used. This meant that network stacks and configuration interfaces needed to be updated to handle this extra number. While this format helps transfer the information, it can be a little difficult to read and could lead to confusion with the actual IP address. The CIDR notation was proposed to compactify the data for ease of reading.
CIDR notation takes the form of a slash followed by a number, e.g.,/24, that goes on the end of an IP address in the format 192.168.2.0/24 or 127.0.0.1/32. The number represents the number of binary digits representing the network address. In this case,/24 means there are 24 leading binary 1s in the subnet mask. Again, this comes out to 255.255.255.0, a class C network.
Class A would use /8 and Class B /16. In IPv4, subnet masks can vary from /0, meaning the whole address space, to /32 meaning a single address. In IPv6, with the larger address space, subnet masks can vary between /0, meaning the whole address space, and /128 representing a single address.
Note: All networks require a network address and a broadcast address. By standards, these are the all 0s host address and the all 1s host address. A point-to-point link between two devices needs to use a /30 in IPv4 or a /126 in IPv6. /31 and /127 subnet masks should never be seen as there would be no usable host addresses in the network as the only two would be reserved. The /32 and /128 are sometimes used to denote individual devices on a network but are typically only used on loopback interfaces.
One of the handy features of CIDR is the concept of route aggregation. To route traffic to the intended destination, a router must keep a routing table. The routing table keeps track of which connected devices offer the best route to all destinations. While there can be a catch-all default route if no specific entry is available, this only works on edge routers.
This leads to routing tables’ unfortunate and constant growth as networking space is allocated and advertised. The effect is amplified with smaller networks as more of them take up one line in the routing table. To minimize this effect, contiguous networks can have their routes summarised singly. For example, if the networks 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24, and 10.0.3.0/24 were all best accessible by a single route, a router could summarise them all in its routing table to 10.0.0.0/22.
While this route summarization is helpful in IPv4, it’s a fundamental part of the design methodology of IPv6 address assignment. As part of a conscious effort to minimize the size of IPv6 routing tables, which, if not summarised in this manner, could grow to be obscenely large as the IPv6 address space usage grows.
CIDR is the current networking model for IPv4 and IPv6 networks. CIDR stands for Classless Inter-Domain Routing and is pronounced like “cider.” It is a variable-length subnet masking system or VLSM that enables efficient use of limited address space.
While subnet masks are officially represented in the same format as the IP addressing scheme they’re being used with, they are often compressed into CIDR notation consisting of a slash and then the number of network address bits in the IP address. Combined with an IP address, it is possible to determine the network’s IP address range.