Skip to content

IPv4 address classes and subnet masks

Classful addressing divided the IPv4 space into fixed-size blocks identified by the first octet. Modern networks use CIDR instead, but the vocabulary survives — “a Class B range”, “a /24” — and the classes still explain the shape of the RFC 1918 private ranges.

The network portion of an address is the network ID; the remainder identifies a host within it.

  • First octet: 1–126
  • Default mask: 255.0.0.0 (/8, or 11111111.00000000.00000000.00000000)
  • Format: NETWORK.HOST.HOST.HOST
  • Roughly 16.7 million addresses per network
  • Intended for very large networks
  • First octet: 128–191
  • Default mask: 255.255.0.0 (/16)
  • Format: NETWORK.NETWORK.HOST.HOST
  • 65,536 addresses per network
  • Intended for medium and large organisations
  • First octet: 192–223
  • Default mask: 255.255.255.0 (/24)
  • Format: NETWORK.NETWORK.NETWORK.HOST
  • 256 addresses per network, 254 usable on a conventional network
  • Intended for small networks

The first octet 127 is reserved for loopback and belongs to no class. 224–239 is multicast and 240–255 is reserved.

Subnet mask: 255.0.0.0
Binary: 11111111.00000000.00000000.00000000
NETWORK | HOST | HOST | HOST

On a conventional network, two addresses in each subnet cannot be assigned — the network address and the broadcast address — so the usable count is 2^n − 2, where n is the number of host bits.

In a VPC subnet, AWS reserves five addresses in every subnet, so the usable count is 2^n − 5. For a /24 that is 251 rather than 254. The reserved addresses are the network address, the VPC router, the Amazon DNS resolver, one address held for future use, and the broadcast address.

Classful allocation wasted address space: an organisation needing 300 addresses had to be given a Class B block of 65,536. Classless Inter-Domain Routing lets the prefix length be any value, so the same organisation gets a /23. Every current network — AWS VPCs included — is allocated and routed classlessly.