But where did those 16,777,214 addresses come from? The answer to that lies in another small calculation. Since binary numbers can only have two values – 0 or 1 – the numbering system is referred to as Base 2. In order to calculate how many hosts a given network can support, you simply take the number of bits available in the host portion of an address, and calculate the exponential value using a base value of 2. In the case of a Class A address, there are 24 bits used to represent a host (the last 3 octets, 8 bits each). As such, a Class A network supports 224 or 16,777,216 addresses. Notice that this number does not match the one in the table. This is because two addresses are never valid to be applied to a host – the host address of all binary 0s, and the host address of all binary 1s. For this reason, you always subtract 2 from number of available host addresses. In this case, it brings us to a value of 16,777,214.
When the Internet Protocol was first defined, nobody ever thought that it would become as popular as it did – it was mainly designed for academic and military purposes, after all. The original idea behind classes of IP addresses was to broadly define groupings that would account for small, medium, and large organizations and their addressing needs. Notice the huge discrepancy between the ranges – while a Class B address supports 65,534 hosts, a Class C address supports only 254. So what happened when a company had only 2000 hosts? Well, in many cases they were allocated an entire Class B address range – not only is this wasteful, but it also ultimately resulted in changes being made to the way in which addresses are allocated. We’ll look at how things have changed shortly.
But how many networks does each class support? For the Class A range, the answer is clear – 128, or the range from 0-127 (remember that the 127 address range is reserved for diagnostics). In the case of Class B and C networks, the answer is slightly more complex. The table below outlines how the number of available networks is defined. The leading bit value represents the binary digits that always start off the first octet of that class of address. For example, a Class A address always starts with its first digit set to binary 0 – this makes the maximum value that could appear in the first octet 127, or 01111111.
Leading Bit Value | Remaining Network Bits | Number of Networks | |
Class A | 0 | 7 | 27 = 128 |
Class B | 10 | 14 | 214 = 16,384 |
Class C | 110 | 21 | 221 = 2,097,152 |
Notice the Class B example – since a class B address always starts with the first two bits set to binary 10, the remaining bits in the network portion tell us how many networks are available. If the first two bits are reserved, that leaves 14 bits – remember that the first two octets (or 16 bits) represent the network portion of a Class B address. By calculating 214, we find that there are 16,384 Class B networks available. For a Class C address, the calculation would be 221, since the first three bits are fixed and the network is represented by the first 3 octets.
Because the first two octets of a Class B address represent a network uniquely, the IP addresses 131.107.2.200 and 131.108.2.200 are actually on different networks – the first is on network 131.107.0.0, and the second on network 131.108.0.0.