UNIX System Administration Handbook - Evi Nemeth [168]
With CIDR, several class C networks can be allocated to a site without requiring the Internet to have separate routing table entries for each one. The site could also be allocated a subspace of a class A or B address. For example, suppose a site has been given a block of 8 class C addresses numbered 192.144.0.0 through 192.144.7.0 (in CIDR notation, 192.144.0.0/21). Internally, the site could use them as
• 1 network of length /21, 2,046 hosts,6
netmask 255.255.248.0
• 8 networks of length /24, 254 hosts each, netmask 255.255.255.0
• 16 networks of length /25, 126 hosts each, netmask 255.255.255.128
• 32 networks of length /26, 62 hosts each, netmask 255.255.255.192
and so on. It’s also possible to mix and match regions of different subnet lengths, as long as all the pieces fit together without overlaps. This is called variable length subnetting. For example, an ISP with the 192.144.0.0/21 allocation could define some /30 networks for PPP dial-up customers, some /24s for large customers, and some /27s for smaller folks.
When you mix and match like this, all the hosts on a particular network must be configured with the same netmask. You cannot tell one host on the network that it is a /24 and another host on that same network that it is a /25.
The beauty and value of CIDR is that from the perspective of the Internet, it’s not necessary to have 256, 128, or even 32 routing table entries for these addresses. They all refer to the same organization, and the packets all need to go to the same place. A single routing entry for the address 192.144.0.0/21 suffices.
With the advent of CIDR, system administrators have gotten good at binary and hex arithmetic, or have discovered that the UNIX utility bc can do math in any base, using the ibase and obase directives.7
You can use Table 13.5 as a cheat sheet.
Table 13.5 Network configurations for various lengths of netmask
a. The network length + the number of host bits is always 32, since we are dividing up the fixed-size “pie” of a 32-bit IP address.
b. Mathy folks will notice that the number of hosts per net is 2^#hostbits – 2; the –2 reflects the fact that the all-0 and all-1 host addresses are special.
When CIDR was introduced in 1993, the backbone tables contained approximately 20,000 routes. Despite the exponential growth of the Internet since that time, the size of the routing tables had grown to only 80,000 routes by the summer of 2000. This modest growth in routing entries is due to extensive aggregation of both old and new address allocations.8
There is still an unaggregated region of the address space, called the 192 swamp (and smaller swamps in the 199 and 205 ranges), consisting of early class C addresses whose owners cannot aggregate them and do not want to turn them in and then have to renumber. The United States is particularly bad in this regard. Europe and Asia, which started a bit later, learned from our mistakes and did a much better job of allocating addresses. Sites with an unaggregated 192 network should turn it back into the American Registry for Internet Numbers (ARIN) and get a new block from their ISP. Unfortunately, the cost of renumbering (in IPv4 space at least) precludes most sites from doing this.
Although CIDR was only intended as an interim solution, it has proved to be strong enough to handle the Internet’s growth problems for the foreseeable future. In fact, CIDR has worked so well that it is unclear if we really need a new IP protocol. An enormous amount of engineering work has gone into the IPv6 specification and prototype implementations of IPv6. It would be a shame to waste this work, but wholesale deployment of IPv6 will probably require either a new killer application written only for IPv6, a yuppie toy that uses IPv6 addressing, or a decision by Microsoft to obsolete IPv4.
Address allocation
In the early days of the Internet, individual sites applied to the Internet Network Information Center (InterNIC)