Skip to content

IPv4 Address Classes

Understanding how IPv4 addresses are structured and allocated is fundamental to networking. While historically IPv4 addresses were categorized into rigid “classes,” modern networking primarily uses a more flexible system called Classless Inter-Domain Routing (CIDR).

IPv4 addresses are 32-bit numbers, typically represented in “dotted-decimal notation” (e.g., 192.168.1.1). Each number between the dots is an octet (8 bits) and can range from 0 to 255.

The Internet Assigned Numbers Authority (IANA), along with Regional Internet Registries (RIRs), manages the global allocation of IP addresses.

Originally, IPv4 addresses were divided into five classes (A, B, C, D, E). This system helped define network sizes but lacked flexibility. While largely superseded by CIDR, understanding these classes provides historical context and helps in interpreting older network configurations.

The class was determined by the first few bits of the first octet:

  • Class A: First bit is 0. First octet: 1-126. Historically intended for very large networks. Default subnet mask: 255.0.0.0. The range 127.x.x.x (e.g., 127.0.0.1) is reserved for loopback addresses, used by a host to send packets to itself.
  • Class B: First two bits are 10. First octet: 128-191. Historically for medium to large networks. Default subnet mask: 255.255.0.0.
  • Class C: First three bits are 110. First octet: 192-223. Historically for small networks. Default subnet mask: 255.255.255.0.

Modern Approach: Classless Inter-Domain Routing (CIDR)

Section titled “Modern Approach: Classless Inter-Domain Routing (CIDR)”

CIDR, pronounced “cider,” replaced classful addressing to allow for more efficient and flexible IP address allocation. CIDR uses a subnet mask, often represented by a prefix length (e.g., /24), to define the boundary between the network portion and the host portion of an IP address.

For example, in 192.168.1.10/24:

  • The /24 indicates that the first 24 bits (the first three octets: 192.168.1) represent the network ID.
  • The remaining 8 bits (the last octet: .10) represent the host ID within that network.

The subnet mask for /24 is 255.255.255.0. With CIDR, network administrators can create subnets of various sizes, optimizing address space usage.

Calculating Usable IP Addresses:

For any given network defined by a prefix length, two IP addresses are unusable for hosts:

  • Network Address: The first address in the range (host bits are all 0s). It identifies the network itself.
  • Broadcast Address: The last address in the range (host bits are all 1s). Packets sent to this address are received by all hosts on that specific network.

The number of available host addresses in a subnet is 2H - 2, where H is the number of bits available for the host portion (H = 32 - prefix_length).

Example: For a /24 network, H = 32 - 24 = 8 bits for hosts. So, 28 - 2 = 256 - 2 = 254 usable host IPs.

Certain IPv4 address ranges are reserved for specific purposes:

These ranges are for use within private networks (e.g., homes, businesses) and are not routable on the public internet. Devices using private IPs typically access the internet via Network Address Translation (NAT).

  • 10.0.0.0 to 10.255.255.255 (10.0.0.0/8)
  • 172.16.0.0 to 172.31.255.255 (172.16.0.0/12)
  • 192.168.0.0 to 192.168.255.255 (192.168.0.0/16)

The 127.0.0.0/8 range is reserved for loopback. The most common loopback address is 127.0.0.1, which a host uses to test its own network stack or communicate with services running on itself.

The 169.254.0.0/16 range (specifically 169.254.1.0 to 169.254.254.255) is used for Automatic Private IP Addressing (APIPA). If a device is configured for DHCP but cannot find a DHCP server, it may assign itself an IP address from this range to communicate with other devices on the same local segment that have also self-assigned addresses.

The range 224.0.0.0 to 239.255.255.255 (224.0.0.0/4) is reserved for IP multicast. Multicasting allows a single packet to be sent to multiple specific recipients who have joined a multicast group. This is different from broadcasting (one-to-all on a subnet) and unicasting (one-to-one). There is no concept of a subnet mask or network/host division for multicast addresses in the traditional sense.

Reserved for Future Use (Formerly Class E)

Section titled “Reserved for Future Use (Formerly Class E)”

The range 240.0.0.0 to 255.255.255.255 (240.0.0.0/4) is reserved for experimental or future use. The address 255.255.255.255 is used as a limited broadcast address.