Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 24

Understanding Subnet Masks and Network Boundaries

Recommended resources

Hello! Welcome back to our journey into the internet's architecture.

In the last lesson, we established that every IPv4 address is composed of two parts: a network portion and a host portion. You also learned that the subnet mask is the key that unlocks this structure, using a sequence of binary 1s and 0s to distinguish between the two parts.

Today, we'll build on that foundation to address the learning outcome: Explain the role of subnet masks in defining network boundaries. We'll move from what a subnet mask is to what it does. You'll see how this 32-bit number doesn't just reveal the structure of an address—it actively defines the size and limits of a network.

The Subnet Mask as a Boundary Line

As we covered, the subnet mask works at a binary level. When an IP address and its subnet mask are aligned:

  • The bits in the IP address that correspond to 1s in the mask make up the network portion. This part is fixed for all devices on the same local network.
  • The bits that correspond to 0s in the mask make up the host portion. This part is unique for each device on that network.

The number of 1s and 0s in the mask draws a clear boundary. This boundary determines the size of your network—specifically, how many unique host addresses are available within it.

Binary Notation of IP Address and Subnet Mask
This image provides a clear visual of how a subnet mask works. The mask's binary `1`s "lock" the network portion of the IP address, while the `0`s leave the host portion free to be assigned to individual devices.

Let's watch a short video to see this binary masking in action.

Subnet Mask - Explained

This clip from PowerCert Animated Videos visually demonstrates how the binary 1s in the subnet mask perfectly align with and reveal the network portion of an IP address.

Watch the segment from 04:44 to 06:15. Focus on how the 1s in the subnet mask consistently mark the network bits, regardless of whether the mask falls on an octet boundary.


From Binary to Network Size

The "boundary" set by the subnet mask has a direct mathematical consequence. Since the host portion is what you can assign to devices, the number of 0s in the mask determines the number of available IP addresses in a network.

Given your background in computer science, the logic is straightforward. If you have n host bits (the 0s), you can create 2^n unique binary combinations for the host portion.

However, in any given network, two addresses are always reserved:

  1. The Network Address: The first address in the range, where all host bits are 0. It represents the network itself.
  2. The Broadcast Address: The last address in the range, where all host bits are 1. It's used to send messages to all devices on the network simultaneously.

Therefore, the number of usable IP addresses for devices is:

where n is the number of 0s in the subnet mask.

Let's watch a video that explains this crucial formula.

What is a Subnet Mask??? (you NEED to know it!!)

This video from NetworkChuck clearly explains how to calculate the number of hosts in a network by counting the zeros in the subnet mask.

Watch from 06:54 to 09:30. Pay close attention to how the video counts the 'host bits' (the zeros) and applies the 2^n - 2 formula to find the number of usable IP addresses.


Subnet Masks in Context: The "Why" and the "How"

Now that you understand the mechanics, let's explore the bigger picture. Why is this flexibility so important? The following guide provides excellent context, moving from the history of IP address allocation to the modern, flexible system we use today. It's written in an accessible, conceptual style that aligns well with your goal of understanding the internet's design principles.

A COMPLETE BEGINNER'S GUIDE TO SUBNETTING

This guide, 'A COMPLETE BEGINNER'S GUIDE TO SUBNETTING', explains the philosophy behind subnetting and the role of the subnet mask. It avoids heavy math in favor of clear concepts.

Please read the following sections from the article: 'CLASSFUL ADDRESSES': To understand the wasteful old system. 'CLASSLESS INTER-DOMAIN ROUTING': To see how the modern system solved the problem. 'SUBNET MASKS – THE EASY EXPLANATION': A great high-level review. 'SLASH NOTATION': This introduces the shorthand we'll discuss next. 'SUBNET MASKS – THE NEXT LEVEL': This dives into the bit-by-bit logic, which will be familiar to you. 'THE FIRST AND LAST IP IN ANY RAGE IS RESERVED': This formalizes the -2 rule we just learned.


Slash Notation: The Engineer's Shorthand

As you saw in the reading, writing out 255.255.255.0 is cumbersome. In practice, network engineers use a shorthand called Classless Inter-Domain Routing (CIDR) notation, or more simply, slash notation.

The notation is just a / followed by the number of network bits (the number of 1s in the mask).

  • 255.255.255.0 has 24 ones (11111111.11111111.11111111.00000000), so it's written as /24.
  • 255.255.0.0 has 16 ones, so it's /16.
  • 255.255.255.192 has 26 ones (...11000000), so it's /26.

This notation is clean and tells you the size of the network at a glance. A /24 network has 32 - 24 = 8 host bits, giving you 2^8 - 2 = 254 usable hosts. A /26 network has 32 - 26 = 6 host bits, giving you 2^6 - 2 = 62 usable hosts.

The table under "Subnet Mask Chart" in the resource How To Subnet is a great reference for mapping slash notation to decimal subnet masks.


Why Do We Need Boundaries?

The core reason for defining network boundaries is manageability and efficiency. Imagine an organization with thousands of devices all in one massive network.

In such a network, certain operations (like a device trying to find another for the first time) generate broadcast traffic, which is sent to every single device on the network. On a huge network, this constant chatter would slow everything down to a crawl.

By using subnet masks to create smaller networks (called subnets), we create separate broadcast domains. A broadcast sent in one subnet does not cross over into another. This is the fundamental reason IP addresses have network and host portions—it allows us to logically divide and conquer large physical networks.

This final video clearly explains this critical concept.

Subnet Mask - Explained

This segment from PowerCert Animated Videos explains the motivation behind subnetting—breaking down large networks to reduce broadcast traffic and improve manageability.

Watch the video from 07:26 to 10:25. Focus on the problem of broadcast traffic in a large, flat network and how routers, which connect different subnets, are used to contain it.


Conclusion

In this lesson, you've seen that the subnet mask is far more than a passive descriptor; it is an active tool for network design. By adjusting the number of network and host bits, an engineer can create networks of virtually any size to meet specific needs.

Key Takeaways:

  • The subnet mask's primary role is to set the boundary between the network and host portions of an IP address range.
  • This boundary directly defines the size of the network. The number of host bits (the 0s) determines the number of usable addresses with the formula 2^n - 2.
  • CIDR (slash) notation (e.g., /24) is a concise way to represent the subnet mask by counting the number of network bits (the 1s).
  • Defining these boundaries is crucial for creating manageable and efficient networks by containing broadcast traffic within smaller subnets.

Preview of the Next Lesson:
Now that you have a solid conceptual grasp of how subnet masks define boundaries, we'll move on to a core practical skill. In the next lesson, we will focus on the learning outcome: Calculate the network address given an IP address and subnet mask. This will involve applying the logical AND operation we briefly touched on before to more complex examples where the subnet boundary doesn't fall neatly on an octet line.