IP defines four network classes called A, B, C, and D. Class A networks provide the largest number of addresses. Before subnetting is done, a Class A network has a mask of 255.0.0.0. Unsubnetted, it supports up to 16,777,214 host addresses. Of course, it would be extremely unusual to use a Class A address without subnetting. Similarly, Class B networks have a mask of 255.255.0.0 before subnetting. Continuing the pattern, Class C networks use 255.255.255.0 and Class D networks consist of only one address, 255.255.255.255.
Strictly speaking, Class only refers to the network mask before any subnetting is done. Sometimes people use the language loosely and call a subnet that has a mask of 255.255.255.0 a Class C subnet. That is not really what "class" means, however. There is actually a simple rule involving the first few bits of any IP address that determines what the class of a network is. If the first bit is a 0, which is to say that the first octet of the address has a value from 1 to 127, then it is a Class A address. If the first bit is 1 and the second bit is 0, then it is a Class B address. Class B addresses run from 128 to 191; Class C addresses have 1s in the first 2 bits and a 0 in the third bit, which includes everything from 192 to 223; Class D networks begin with 3 bits of 1s and a 0 in the fourth bit; a final group of Class E addresses includes everything else. Table 5-3 illustrates this.
Class |
Range of network addresses |
Mask |
Maximum number of host addresses per network |
Number of networks |
---|---|---|---|---|
A |
0.0.0.0-127.0.0.0 |
255.0.0.0 |
16,777,214 |
128 |
B |
128.0.0.0-191.255.0.0 |
255.255.0.0 |
65,534 |
16,384 |
C |
192.0.0.0-223.255.255.0 |
255.255.255.0 |
254 |
2,097,152 |
D |
224.0.0.1-239.255.255.255 |
255.255.255.255 |
1 |
248,720,625 |
E |
240.0.0.1-255.255.255.255 |
255.255.255.255 |
1 |
248,720,625 |
Note that some of these address ranges are reserved and will never be available for normal network addressing. For example, the networks 0.0.0.0 and 127.0.0.0 are reserved. The network 0.0.0.0 is used as a generic broadcast address and every host has a local loopback address of 127.0.0.1 by which it knows itself. In many routing protocols, the global default address is designated as 0.0.0.0 with a netmask of 0.0.0.0.
These entire ranges are set aside and not used for anything. The other important block of reserved addresses is the 224-239 range. Everything that starts with 224 through 239 is reserved for multicast addresses. An address starting with 255 in its first octet will probably not be assigned because of potential confusion with broadcast address conventions. Similarly, the entire range of Class E addresses is effectively unusable.
Originally, the classification scheme stopped with the last two classes taken together as Class D. The newer Class E range was developed to separate a distinct group of single-host addresses from the emerging multicast requirements.
Class is now considered an outdated concept. I have discussed it here because the word is still used. The various Internet authorities have stopped allocating IP addresses according to class, and all routing through the Internet uses Classless Inter-Domain Routing (CIDR). The currently preferred method for expressing the size of a network is to use the number of bits in the mask. For example, you would refer to the Class A address 10.0.0.0 as 10.0.0.0/8. If you grouped together the first two unregistered Class B networks, you would call the resulting range of addresses 172.16.0.0/15.
In CIDR, the IP address can be divided into host and network portions at any bit, but there are still some important addresses in this scheme. The address 0.0.0.0 is sometimes used as a source address. Any host can use it, particularly when the host doesn't know its own address (for example, during the first steps of a DHCP query). Similarly, it is possible to use an address in which the network part consists of all zeros and the host part is properly specified. Again, this address can only be used as a source address.
The address 255.255.255.255, which is all ones in binary, is used as a destination address in a local broadcast. In effect, it indicates all hosts on the local network. This address is also used frequently when a device doesn't know anything about its local network number, as in the first steps of a DHCP query.
Related to this issue is the address in which the host portion is all ones in binary and the network portion is a real subnet address. Again, this address can only be used as a destination address. In this case, the packet is intended for all hosts on a particular subnet. The CIDR specification also allows one to specify a broadcast destination address in which the main network address is a real address and the subnet address and the host portion of the address are all ones. This specification is intended as a broadcast to all hosts in all subnets. However, I have never seen this specification used in practice, and it seems less than useful, if not unwise.
As in the Class system, any address with the decimal number 127 in the first octet is reserved as a local loopback address. Even in CIDR, all Class D addresses are reserved for multicast purposes.