Classful addressing: IP address classes A, B, C, D and E

Introduction

Until 1993 every IPv4 address belonged to one of five classes, and the class said how many of its 32 bits named the network and how many named the host. This scheme is called classful addressing. The classes were defined in RFC 791 in 1981. They are obsolete now, but the names "class A", "class B" and "class C" are still used for the networks 10.0.0.0, 172.16.0.0 and 192.168.0.0, and they explain why many old tools guess a mask from an address.

The five classes

The class is set by the first bits of the first octet.

ClassFirst bitsFirst octetDefault maskUse
A00 - 127255.0.0.0 (/8)Very large networks
B10128 - 191255.255.0.0 (/16)Medium networks
C110192 - 223255.255.255.0 (/24)Small networks
D1110224 - 239noneMulticast
E1111240 - 255noneReserved for experiments

Classes A, B and C are unicast: an address names one device. In class A the first octet is the network and the other three are the host. In class B two octets are the network, in class C three. Class D is multicast: one sender and a group of receivers. Class E was never put to general use.

How to find the class of an address

Look at the first octet, or at its first bits in binary.

AddressFirst octet in binaryClass
10.1.2.300001010A
172.16.5.410101100B
192.168.1.1011000000C
224.0.0.511100000D
250.1.1.111111010E

127.0.0.1 is formally in class A, but the whole 127.0.0.0/8 block is reserved for the loopback, so a real class A network starts at 1 and ends at 126.

How many networks and hosts

The host part of an address cannot be all zeros (that is the network address) or all ones (that is the broadcast address), so every network loses two addresses.

ClassNetworksHosts in one network
A12616,777,214
B16,38465,534
C2,097,152254

Why it was dropped

The step between the classes is too big. A company with 300 computers did not fit in a class C network of 254 hosts, so it got a class B network of 65,534 addresses and used less than one percent of them. Multiplied by thousands of organizations, this emptied the pool of IPv4 addresses much faster than the number of real devices required. At the same time the routing tables of the internet grew with every new class C network.

The fix was classless addressing. In 1993 RFC 1519 introduced CIDR (Classless Inter-Domain Routing): the network part can be any number of bits, written as a prefix length such as /22, and addresses can be given out in blocks that fit the need and combined in routing tables. The current text is RFC 4632.

What is left of it today

The rest of the subject, the mask, the prefix length and how to cut a network into subnets, is in the CIDR section of the IPv4 article and in the IP address and mask examples.

Article author: Andrei Olegovich