Welcome to our next lesson in networking fundamentals. In our previous session, we established the roles of core network devices, learning that routers are the postmasters of the internet, connecting different networks together using IP addresses. Today, we're going to zoom in and look at the structure of those IP addresses themselves.
This lesson is all about understanding how IP addresses are organized and how we can divide large networks into smaller, more manageable pieces—a process called subnetting. We'll cover what an IP address is made of, why subnetting is essential for network performance and security, and how to read the modern shorthand used to define network sizes, known as CIDR notation. For an ethical hacker, mastering these concepts is non-negotiable. It's the equivalent of learning to read a map before planning a journey; you must understand the layout of a target network to navigate it effectively.
The Anatomy of an IP Address
At its core, an IPv4 address is simply a 32-bit number. To make it readable for humans, we divide it into four 8-bit sections called octets, and we write each octet as a decimal number from 0 to 255. For example, 192.168.1.10.
However, an IP address always has two distinct parts:
- Network Portion: This identifies the specific network the device is on. It's like the city and street in a postal address. All devices on the same local network share the same network portion.
- Host Portion: This identifies a unique device (a "host") on that network. It's like the house number in a postal address.
But how does a computer know which part of the IP address is the network and which part is the host? This is the job of the subnet mask.
The subnet mask is another 32-bit number that "masks" the IP address. In its binary form, all the 1s correspond to the network portion of the IP, and all the 0s correspond to the host portion.

To see how this works in detail, let's watch a short video. It will also walk you through the process of converting decimal IP addresses into the binary format that computers actually use. Given your computer science background, the concept of binary will be familiar, but this will show its direct application in networking.
This video from PowerCert Animated Videos provides an excellent animated explanation of the IP address structure, the role of the subnet mask, and how to perform decimal-to-binary conversion.
Please watch from the beginning up to the end of the main explanation. Pay close attention to how the subnet mask's binary 1s and 0s reveal the network and host portions of the IP address.
Why Do We Need Subnetting?
Now that we know an IP address has a network and a host part, you might wonder why this division is necessary. Why not just have one giant network? The answer lies in manageability and performance. This division allows us to perform subnetting, which is the process of taking one large network and breaking it into multiple smaller networks, or "subnets."
Imagine a huge office building with thousands of employees, all on a single, flat network. If one computer needed to find another, it would send a broadcast message, which is a message that every single device on the network receives and has to process. The amount of broadcast traffic would be immense, slowing everything down to a crawl.
Subnetting solves this. By creating smaller, isolated subnets (e.g., one for the Sales department, one for Engineering), broadcast messages are contained within their respective subnets. Routers are used to pass traffic between these subnets, but they do not forward broadcasts.
Let's continue with the same video, which now explains the rationale behind subnetting.
Watch the section from "Why does an IP address have a network and a host part?". This will clarify why breaking a large network into smaller subnets is crucial for efficiency and order.
From a security perspective, this is also incredibly important. Subnets allow a network administrator to create security boundaries. For instance, you could create a firewall rule that prevents devices on the guest Wi-Fi subnet from accessing servers on the corporate finance subnet.
How Subnetting Works: Borrowing Bits and CIDR Notation
Subnetting is achieved by "borrowing" bits from the host portion of the address and reassigning them to the network portion. Each bit you borrow doubles the number of subnets you can create, but it also halves the number of hosts available in each subnet.
Let's see this in action.
This next part of the video demonstrates the process of borrowing bits to create subnets.
Watch from the demonstration of borrowing bits. Notice the inverse relationship: as the number of network bits increases, the number of available host bits decreases.
As you saw, changing the subnet mask from 255.255.255.0 to 255.255.255.192 meant we took two bits from the host portion. This changed the number of network bits from 24 to 26 and reduced the host bits from 8 to 6.
Calculating Usable Hosts
For any given subnet, two addresses are always reserved and cannot be assigned to hosts:
- Network ID: The very first address in the range (where all host bits are
0). This address identifies the subnet itself. - Broadcast Address: The very last address in the range (where all host bits are
1). A packet sent to this address is delivered to all hosts on the subnet.
This is why the formula for calculating the number of usable hosts in a subnet is , where is the number of available host bits.
CIDR Notation: A Necessary Shorthand
Writing out 255.255.255.192 is cumbersome. To simplify this, network engineers use Classless Inter-Domain Routing (CIDR) notation. It's much simpler: you just write a forward slash (/) followed by the number of bits in the network portion of the address.
255.255.255.0in binary has 24 ones followed by 8 zeros. In CIDR notation, it's/24.255.255.255.192in binary has 26 ones followed by 6 zeros. In CIDR notation, it's/26.- An IP address and its subnet mask are written together, like
192.168.1.15/26.
This is the standard you will see everywhere. Let's get a quick formal introduction to it.
The final clip from this video introduces CIDR notation.
Watch the short segment from the start of the CIDR explanation.
Here is a handy cheat sheet that connects CIDR notation, the decimal subnet mask, and the total number of addresses in that subnet.

A Practical Method for Subnetting
As an ethical hacker, you'll often be given a network range (e.g., 172.16.10.0/23) and need to figure out which IP addresses are valid hosts within it. Manually converting to binary is slow. Fortunately, there's a systematic way to solve these problems quickly.
The following reading explains how to create and use a simple "Subnetting Cheat Sheet" to answer key questions about any subnet:
- What is the Network ID?
- What is the Broadcast Address?
- What is the first usable host IP?
- What is the last usable host IP?
This tutorial from Subnetting.net will walk you through creating a simple chart and using it to solve common subnetting problems without tedious binary math. This procedural approach should feel natural given your background.
Please read the sections "Subnetting Cheat Sheet" and "Putting it all Together". Follow the examples to see how the chart makes finding the Network ID, Broadcast Address, and number of hosts much faster.
Practice Your Skills
The best way to solidify this knowledge is through practice. The following website provides an interactive tool that generates random subnetting problems for you to solve. Try a few to test your understanding of the method you just learned.
This interactive tool is an excellent way to drill your subnetting skills. Don't worry if you make mistakes; the goal is to practice the process.
Read the Instructions on the page, then try to solve a few problems. Use the cheat sheet method you learned from the previous article. If you get stuck, the "Show" button will reveal the correct answers and help you see where you went wrong.
Conclusion
You've now unpacked one of the most fundamental concepts in networking. Understanding how to dissect an IP address and map out a subnet is a skill you will use constantly during the reconnaissance and scanning phases of a security assessment.
Key Takeaways:
- An IPv4 address is a 32-bit number with a network portion and a host portion.
- The subnet mask is used to distinguish between these two portions. In binary,
1s represent the network and0s represent the host. - Subnetting is the process of dividing a large network into smaller ones to improve performance and security. It involves "borrowing" bits from the host portion.
- CIDR notation (e.g.,
/24) is a shorthand that represents the number of network bits in the subnet mask. - Every subnet reserves the first IP for the Network ID and the last IP for the Broadcast Address, so they cannot be assigned to devices.
In our next lesson, we will build directly on this by exploring the difference between public IP addresses, which are routable on the global internet, and private IP addresses, which are used for internal networks like the ones we've been designing today.