Study Guide

Classful Addressing, Subnet Masks and CIDR

Why an address needs a network and host boundary, how historical classes set it, and how subnet masks and CIDR prefixes set it today.

Lesson 3.6 Networking Fundamentals

The previous lesson split an IPv4 address into a network portion and a host portion, but left one question open: where exactly does the boundary fall? This lesson works out why the boundary matters, then how it has been set, in the past and today.

Stage: Think

My network or another?

Think it through

A laptop at 192.168.1.10 wants to send something to 192.168.1.77, and later something to 203.0.113.5. What must it decide before sending each one?

Show what happens

Whether the destination is on its own network, so it can deliver directly, or on another network, so it must hand the data to a router. To decide, it has to know exactly where the network portion of an address ends.

Think it through

Suppose the network portion of an address is made one bit shorter, giving the host portion one more bit. What happens to the number of possible host addresses?
Show the answer

Answer: B. It doubles.

It doubles: every extra host bit doubles the possible host addresses. So the boundary decides both which addresses are local and how many devices a network can hold.

Stage: Explain

Why a boundary is needed

Every time a device sends data, it must decide: is the destination on my network, so I can deliver it directly, or on another network, so I must send it to a router? To decide, the device compares the network portion of its own address with the network portion of the destination. That only works if it knows where the network portion ends.

The same boundary also decides how many devices a network can hold. Every bit given to the host portion doubles the number of possible host addresses.

Stage: Explain

Historical classful addressing

In early IPv4, the boundary was implied by the address itself. This scheme is called classful addressing. The historical classes were each recognised from the first octet:

Historical Class A, B and C addressing

The class was identified from the first octet, which set a default split between network (N) and host (H) octets.

  • Class A

    First octet 1–126

    Octets: network, host, host, host

    Default mask 255.0.0.0 (/8)

  • Class B

    First octet 128–191

    Octets: network, network, host, host

    Default mask 255.255.0.0 (/16)

  • Class C

    First octet 192–223

    Octets: network, network, network, host

    Default mask 255.255.255.0 (/24)

N Network octet H Host octet

127 is reserved for loopback, 224–239 was Class D (multicast) and 240–255 Class E (reserved). Modern networks use CIDR, so the prefix length is configured rather than implied by the class.

Check your understanding

Under the historical scheme, what decided which class an address belonged to?
Show the answer

Answer: C. Its first octet.

The first octet alone. The class, and so the boundary, was implied by the address itself.

A common question is whether both of the first two octets of a Class B address had to fall within the class range. They did not: the class was decided only by the first octet.

Strictly, the class was decided by the first octet’s leading bits: a Class A address starts with 0, Class B with 10 and Class C with 110. That is where the ranges come from. The fixed sizes were very wasteful: an organisation needing 300 addresses was too big for a Class C (254 hosts) but would receive a whole Class B with 65,534. Classes were replaced by CIDR in the 1990s.

Stage: Predict

Subnet masks

Think it through

Suppose you had to mark which of an address’s 32 bits belong to the network part, using another 32-bit number. How could you do it?

Show what happens

Put a 1 under every network bit and a 0 under every host bit. That second number is a subnet mask.

A subnet mask marks the boundary explicitly. Like an address, it is 32 bits. Its 1 bits mark the network portion and its 0 bits the host portion, and the 1s always come first, in one unbroken run.

The mask 255.255.255.0: twenty-four 1s (network) followed by eight 0s (host)

The subnet mask 255.255.255.0 is 24 one-bits marking the network portion, followed by 8 zero-bits marking the host portion.

N Network portion: 24 bits H Host portion: 8 bits

Because the 1s are always filled in from the left, each mask octet can only take one of nine values: 0, 128, 192, 224, 240, 248, 252, 254 or 255. Binary, Decimal and Hexadecimal shows where they come from.

Stage: Predict

CIDR notation

Think it through

The mask 255.255.255.0 is twenty-four 1 bits followed by eight 0 bits. What shorter way could you write the same boundary?
Show the answer

Answer: B. Write the count of 1 bits: /24.

Count the 1 bits. Because they always come first in one run, the count alone fixes the boundary. That count is the prefix length.

Writing out a full mask is clumsy, so CIDR (Classless Inter-Domain Routing) writes the number of network bits after a slash instead. That number is the prefix length. Three prefixes match the old class defaults:

Subnet maskPrefixNetwork bitsHost bits
255.0.0.0/8824
255.255.0.0/161616
255.255.255.0/24248
255.255.240.0/202012
255.255.255.192/26266

The last two rows show the point of CIDR: the boundary no longer has to fall between octets. A prefix can be any length from /0 to /32.

Mask to prefix: 255.255.240.0

  1. Each 255 octet is eight 1 bits: 255.255 gives 8 + 8 = 16.
  2. 240 is 11110000: four more 1 bits, so 16 + 4 = 20.
  3. The last octet is 0: no more 1 bits. The prefix is /20.

Prefix to mask: /26

  1. 26 bits of 1s fill three whole octets (24 bits): 255.255.255.
  2. Two 1 bits remain for the fourth octet: 11000000 = 192.
  3. The mask is 255.255.255.192.

Check your understanding

What is the prefix length for the mask 255.255.255.224?
Show the answer

Answer: C. /27

/27: three 255 octets give 24 bits, and 224 is 11100000, three more.

Stage: Predict

Network and host identifiers under CIDR

Think it through

The address 131.107.5.15 starts with 131, which was historically Class B and so implied /16. Can it be given a /24 today?
Show the answer

Answer: C. Yes: the prefix is configured, not implied.

Yes. Under CIDR the prefix is configured, so the historical class no longer matters.

With CIDR, the class of an address no longer matters. Take the address 131.107.5.15 with the mask 255.255.255.0. The first octet, 131, was historically Class B, which would have implied /16. Is /24 still possible? It is: the prefix is configured, not taken from the class.

131.107.5.15/24: network 131.107.5, host 15

131.107.5.15/24: the first 24 bits are the network portion and the last 8 bits are the host portion. Applying the /24 mask gives the network address 131.107.5.0.

N Network portion: 24 bits H Host portion: 8 bits

The network identifier is the network portion with the host bits set to 0: 131.107.5.0. The host identifier is the host portion, here 15. The Subnetting lesson shows how to find these for any prefix.

A device’s subnet mask usually arrives automatically from DHCP, and operating systems show it either as a mask (Windows ipconfig shows 255.255.255.0) or as a prefix (Linux ip addr shows /24). Being able to switch between the two is essential when comparing settings across systems.

Stage: Apply

Apply it in a new situation

These questions use the lesson in situations it has not shown. For the strongest test of your understanding, come back to them on another day and answer each one at the first attempt.

Apply it

A device’s settings show a prefix of /22. What is its subnet mask?
Show the answer

Answer: A. 255.255.252.0

255.255.252.0: two full octets give 16 bits, and the remaining six 1 bits make the third octet 11111100, which is 252.

Apply it

A colleague configures the mask 255.255.0.255. What is wrong with it?
Show the answer

Answer: B. The 1 bits must come first, in one unbroken run.

A valid mask is an unbroken run of 1 bits followed by 0 bits, so a 255 cannot follow a 0.

Stage: Check

Check your understanding

These questions come from the approved revision bank. Choose an answer and check it; the explanation and its sources follow.

  1. IPv6 uses the same Class A, B and C categories as historical IPv4 addressing.

    Show answer

    Answer: False

    False. IPv6 does not use Class A/B/C. Modern IPv4 uses CIDR and subnet masks; its RFC 1918 private blocks should not be confused with three complete traditional classful networks.

    Revision sources: Session 5: Networking Fundamentals — Part 1 (Classroom session record)

  2. Historically, a first octet of 131 placed an address in Class B, whose default mask was 255.255.0.0. A device is configured with 131.107.5.15/24. What is its network address?

    Show answer

    Answer: 131.107.5.0

    Address classes are historical and modern networks use CIDR, so the configured /24, not the old Class B default, sets the boundary. /24 means the mask 255.255.255.0. AND the address with the mask octet by octet: 131 AND 255 = 131, 107 AND 255 = 107, 5 AND 255 = 5 and 15 AND 0 = 0, giving 131.107.5.0. 131.107.0.0 applies the Class B default of /16; 131.107.5.255 is the broadcast address, not the network address; 131.0.0.0 would need a /8.

    Revision sources: Session 5: Networking Fundamentals — Part 1 (Classroom session record) · Study Buddy — 23 September 2026 (Study Buddy session (supplementary))

  3. Which subnet mask and prefix-length pairs are correct? Select all that apply.

    Show answer

    Answer: 255.255.255.0 = /24; 255.255.255.192 = /26; 255.255.0.0 = /16

    A prefix length counts the 1 bits in the mask. 255.0.0.0 pairs with /8, 255.255.0.0 with /16 and 255.255.255.0 with /24, so 255.0.0.0 is /8, not /16. The same counting works inside an octet: 192 is 11000000, two more 1 bits, so 255.255.255.192 is 24 + 2 = /26; 240 is 11110000, four 1 bits, so 255.255.240.0 is 16 + 4 = /20, not /24.

    Revision sources: Study Buddy — 23 September 2026 (Study Buddy session (supplementary)) · Classful Addressing, Subnet Masks and CIDR (Supplementary Study Guide explanation)

Study and revision

Practise through the Networking & Protocols topic. Questions here cover classful history against a configured CIDR prefix, using the 23 September 131.107.5.15/24 example, and converting between masks and prefix lengths. Items that use this lesson’s supplementary conversions say so in their explanations.

Stage: Consolidate

What to remember

  • A device uses the boundary to decide whether a destination is local or must go to a router.
  • Every extra host bit doubles the possible host addresses.
  • Classful addressing implied the boundary from the first octet; it was wasteful and is historical.
  • A subnet mask is an unbroken run of 1 bits, then 0 bits; CIDR writes the count of 1 bits after a slash.
  • Under CIDR, the configured prefix sets the boundary, whatever the address’s old class.

Key terms

Classful addressing

The historical IPv4 scheme in which the first octet decided an address’s class (A, B or C) and so its default split between network and host.

Subnet mask

A 32-bit value that marks which bits of an IPv4 address belong to the network (1s) and which belong to the host (0s), such as 255.255.255.0.

CIDR (Classless Inter-Domain Routing)

Classless addressing that writes the number of network bits after a slash, such as 192.168.1.0/24, instead of relying on historical Class A, B and C categories.

Prefix length

The number of leading network bits in an address, written after a slash, such as /24.

Common misunderstandings

They are the same boundary written two ways. The prefix simply counts the mask’s 1 bits.

That was true historically. Under CIDR the prefix is configured, so 131.107.5.15/24 is perfectly valid.

A valid subnet mask is always an unbroken run of 1s followed by 0s.

Lesson sources and acknowledgements

Sources and scope

  • From the Study Buddy session on 23 September (see the entry): Class A, B and C first-octet ranges and N/H octet patterns, default masks, the chat questions about classes and masks, the introduction of CIDR, the /8, /16 and /24 prefixes, and the 131.107.5.15/24 example.
  • Taught in Session 5: that classes are historical and modern networks use CIDR and subnet masks.
  • Supplementary explanation: why a boundary is needed, leading bits and the waste of classful sizes, the /20 and /26 rows, the conversion walkthrough and the misunderstandings.

Guided version (published 1 November 2026, awaiting the site owner’s editorial review): the opening questions about local and remote destinations, every question asked in the lesson with its feedback and hints, the conversion exercises and the closing summary are supplementary explanation written for the Study Guide. The settings are fictional. The questions in the lesson’s steps are not revision-bank items; those in “Check your understanding” are, unchanged.