Module 2.1 40 minBeginner

IPv4 address structure

An IPv4 address is 32 bits split into a network portion and a host portion. This chapter explains classful history (A/B/C), CIDR notation, and how every dotted-decimal address really lives in binary.

Course plan — preview

What you'll learn

  • Convert between dotted decimal and binary for any /8 boundary.
  • Explain why classful addressing was replaced by CIDR.
  • Describe what the prefix length actually counts.

32 bits, four octets

An IPv4 address is 32 bits. Humans write it as four decimal numbers, each 0–255, separated by dots: 192.168.10.42. Each octet is 8 bits, so 192.168.10.42 in binary is 11000000.10101000.00001010.00101010.

The address has two parts: the network portion identifies which network it belongs to, and the host portion identifies the specific device within that network. The boundary between them is set by the subnet mask.

Thirty-two bits give 2^32 combinations: 4,294,967,296 addresses in total. That sounds like plenty until every phone, laptop and server wants one. The rest of this module is about spending addresses carefully: subnets sized to fit, private ranges reused behind NAT, and finally IPv6.

Classful addressing — historical context only

Originally the first octet alone decided the boundary. Class A (1–126) had an /8 mask, Class B (128–191) had /16, Class C (192–223) had /24. This was wasteful — a Class B gave you 65,534 hosts whether you needed them or not — and it has been obsolete since CIDR arrived in 1993.

The class was read from the first bits of the address. A Class A address starts with the bit 0, Class B with 10, Class C with 110 and Class D with 1110. That is why the ranges fall where they do: 0 to 127 is every first octet whose top bit is 0, and 128 to 191 is every first octet that starts 10.

Two first-octet values never became Class A networks. 0.0.0.0/8 means 'this network': a host that does not know its own address yet, such as a DHCP client, sends from 0.0.0.0. 127.0.0.0/8 is loopback: a packet to 127.0.0.1 never leaves the host. That is why the usable Class A range is 1–126, not 0–127.

ClassFirst octetDefault maskHosts per network
A1–126/816,777,214
B128–191/1665,534
C192–223/24254
D (multicast)224–239——
E (reserved)240–255——

6 more sections in this chapter, plus a 4-question quiz and a hands-on lab.

Course plan

Modules 2–8 are part of the Course & Lab Pass and All-Access Max — start with a free account

You can see the title, summary, learning objectives and the opening sections. The rest of this chapter, like all of modules 2–8, comes with the Course & Lab Pass and All-Access Max. A free account opens Module 1: How Networks Work end-to-end and saves your labs — start there, no card required.

  • Read every chapter in Module 1 — How Networks Work
  • Save labs of up to 5 devices
  • Save up to 3 topologies
  • See the full course syllabus + chapter titles

Free account · no card required · compare plans any time

Build it step by step