Classful IP Addressing

Classful IP Addressing


For a protocol to be routable, its address structure must be hierarchical, meaning that the address must contain at least two parts. For IP addresses, these parts are the network portion and the host portion. A host is an end station such as a computer workstation, router interface, or printer, while a network consists of one or more hosts. Figure 2-1 is a simple network consisting of two networks connected by a two-port router. The address of each host on this network, including the router interfaces, is given by its network and host numbers.





Figure 2-1: Hierarchical addressing



When the IP address scheme was designed, the decision was made to create five classes of IP addresses simply named Class A, B, C, D, and E. The logic behind the first three network classes was that the IP addressing scheme would be used for a few networks with a large number of hosts (Class A), a moderate number of networks with a moderate number of hosts (Class B), and a large number of networks with a small number of hosts (Class C). Class D addresses would be used for multicasting and Class E addresses would be reserved for experimental use.


Having three classes of IP addresses to handle different size networks requires that the network part and the host part for each address class have unequal sizes. The breakdown for the allocation of bits for the network and host portion for the first four IP address classes is shown in Figure 2-2.





Figure 2-2: Classful IP address structure



Class A addresses use 8 bits to identify the network and 24 bits to identify the host with the most significant bit of the first octet set to zero. Class B addresses use 16 bits to identify the network and 16 bits to identify the host with the first two bits of the first octet set to 1 0. Class C addresses use 24 bits to identify the network and 8 bits to identify the host with the first 3 bits of the first octet set to 1 1 0.


Class D or multicast addresses differ from unicast addresses in their interpretation.


A Class A, B, or C address is used to identify a network and a host on that network. A Class D multicast address is used to identify a group of receivers and senders of multicast traffic. Additionally, multicast senders and receivers can be present on any network.


If we examine the first octet of each class, we can see that the range of values for the four classes is


00000001 (1)—01111110 (126) for Class A

10000000 (128)—10111111 (191) for Class B

11000000 (192)—11011111 (223) for Class C

11100000 (224)—11101111 (239) for Class D


Looking at the first octet of the IP address can easily identify the network class. For example, the address used previously, 156.26.30.60, is a Class B address because the first octet is between 128 and 191. Another (and more tedious) way to identify the class is to represent the first octet of the address in binary and see what the first couple of bits are set to. For example, 156 equals 10011100 in binary. The first two bits are 1 0, so according to Figure 2-1, this is a Class B address.


How many Class A, B, and C networks are there? Class A networks use 7 bits for the network ID, so 128 Class A networks are possible. Class B addresses use 6 bits from the first octet and all 8 bits of the second octet, so there are 16,384 networks (64 x 256), 64 from the first octet and 256 from the second octet. Class C addresses use 5 bits from the first octet, 8 bits from the second octet, and 8 bits from the third octet, so there are 2,097,152 possible Class C networks (32 x 256 x 256). Class D addresses are not associated with networks but with multicast groups.


Class A, B, and C addresses are unicast addresses. Each IP address in the first three classes is used to identify a particular and unique Internet host, while a Class D address is used to identify a group of hosts belonging to a particular IP multicast group. The multicast addresses are in the range 224.0.0.0 through 239.255.255.255 (currently assigned multicast addresses are listed in Appendix B). The range of addresses between 224.0.0.0 and 224.0.0.255, inclusive, is reserved for the use of routing protocols and other low-level topology discovery or maintenance protocols, such as gateway discovery and group membership reporting. Multicast routers should not for ward any multicast datagram with destination addresses in this range, regardless of the TTL.


How many hosts can each network have? Class A networks have 24 bits to identify a host; this equals 1,677,216 possible hosts per network! Class B networks have 16 bits to identify a host, which equals 65,536 hosts, and Class C networks have 8 bits to identify a host, which equals 256 possible hosts. Table 2-2 lists the capabilities for Class A, B, and C addresses.