Sunday, June 15, 2008

IP Address Classes

The original IP addressing design was based on Address Classes.

In the original Internet routing scheme developed in the 1970s, sites were assigned addresses from one of three classes: Class A, Class B and Class C. The address classes differ in size and number. Class A addresses are the largest, but there are few of them. Class Cs are the smallest, but they are numerous. Classes D and E are also defined, but not used in normal operation.

To say that class-based IP addressing in still used would be true only in the loosest sense. Many addressing designs are still class-based, but an increasing number can only be explained using the more general concept of CIDR, which is backwards compatible with address classes.

Suffice it to say that at one point in time, you could request the Internet NIC to assign you a class A, B or C address. To get the larger class B addresses, you might have to supply some justification, but only the class A was really tough to get. In any case, NIC would set the network bits, or n-bits, to some unique value and inform the local network engineer. It would then be up to the engineer to assign each of his hosts an IP address starting with the assigned n-bits, followed by host bits, or h-bits, to make the address unique.

Internet routing used to work like this: A router receiving an IP packet extracted its Destination Address, which was classified (literally) by examining its first one to four bits. Once the address's class had been determined, it was broken down into network and host bits. Routers ignored the host bits, and only needed to match the network bits to find a route to the network. Once a packet reached its target network, its host field was examined for final delivery.

Summary of IP Address Classes

Class A - 0nnnnnnn hhhhhhhh hhhhhhhh hhhhhhhh
  • First bit 0; 7 network bits; 24 host bits
  • Initial byte: 0 - 127
  • 126 Class As exist (0 and 127 are reserved)
  • 16,777,214 hosts on each Class A

Class B - 10nnnnnn nnnnnnnn hhhhhhhh hhhhhhhh

  • First two bits 10; 14 network bits; 16 host bits
  • Initial byte: 128 - 191
  • 16,384 Class Bs exist
  • 65,532 hosts on each Class B


Class C - 110nnnnn nnnnnnnn nnnnnnnn hhhhhhhh

  • First three bits 110; 21 network bits; 8 host bits
  • Initial byte: 192 - 223
  • 2,097,152 Class Cs exist
  • 254 hosts on each Class C


Class D - 1110mmmm mmmmmmmm mmmmmmmm mmmmmmmm

  • First four bits 1110; 28 multicast address bits
  • Initial byte: 224 - 247
  • Class Ds are multicast addresses - see RFC 1112


Class E - 1111rrrr rrrrrrrr rrrrrrrr rrrrrrrr

  • First four bits 1111; 28 reserved address bits
  • Initial byte: 248 - 255
  • Reserved for experimental use