Skip to main content

Welcome to a Grasp lesson

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

Lesson 5

Subnetting Fundamentals

Recommended resources

Welcome back! In our previous lesson, you learned how to calculate the number of subnets you can create from a network and the number of usable hosts within each subnet. This is a vital skill for planning network capacity.

Today, we'll take the next logical step. Instead of just knowing how many addresses exist, you will learn how to pinpoint the exact addresses that define a subnet. This lesson focuses on determining the four critical addresses for any given IP and CIDR prefix: the subnet address (or network ID), the first usable host address, the last usable host address, and the broadcast address. Mastering this skill is essential for configuring devices, setting up routing, and troubleshooting connectivity issues for your project.

1. The Four Key Addresses of a Subnet

As a quick refresher, every IP subnet is a range of consecutive addresses defined by four key values. Understanding these is the first step.

What is a Subnet?

This article from NetworkAcademy.IO clearly defines the four key addresses that make up any subnet.

Read the section "What is a Subnet?". Focus on the four rules, especially the definitions of the network identifier (also called the subnet ID), the subnet broadcast address, and the usable addresses that fall between them.

To visualize this, consider a simple /24 network. The usable addresses are simply the ones between the network and broadcast addresses.

IPv4 Subnet Mask: First Host and Last Host Addresses
This diagram shows the relationship between the network address (10.1.1.0), the first usable host (10.1.1.1), the last usable host (10.1.1.254), and the broadcast address (10.1.1.255) for a /24 subnet. The usable hosts are the range of addresses you can assign to devices.

The first usable host address is always the network address + 1. The last usable host address is always the broadcast address - 1. Therefore, our main task is to find the network and broadcast addresses.


2. The Foundational Method: Using Binary

The most fundamental way to find the network and broadcast addresses is by working in binary. This method reveals the underlying logic of subnetting. Since you have a background in IT, the binary operations should be familiar. The process is a direct application of the network mask.

  1. Find the Network Address: Perform a bitwise AND operation between the IP address and the subnet mask. A simpler way to think about this is to convert the IP address to binary and change all the host bits to 0.
  2. Find the Broadcast Address: Convert the IP address to binary and change all the host bits to 1.

The following video from Jeremy's IT Lab demonstrates this process clearly.

Free CCNA | Subnetting (Part 2) | Day 14 | CCNA 200-301 Complete Course

This video shows how to find the subnet an IP address belongs to by using binary operations.

First, watch the demonstration of how to find the subnet for a host. Notice how he identifies the host bits and sets them all to 0 to find the network address. The process is identical for Class C, B, or A addresses. Then, watch the same process applied to a Class B network example. This reinforces that the method is universal, regardless of the address class.

Let's walk through an example for the IP address 192.168.10.150 with a /26 prefix.

  1. CIDR Prefix: /26 means the first 26 bits are for the network and the remaining bits are for the host.

  2. IP Address in Binary: We only need to convert the last octet, since the first three are fully part of the network portion (255.255.255).

    • 150 = 10010110
  3. Find Network and Host Portions: A /26 mask in the last octet is 11000000. So, for 10010110:

    • Network portion: 10
    • Host portion: 010110
  4. Calculate Network Address: Set the host bits to 0.

    • 10 000000 -> 10000000 in binary, which is 128 in decimal.
    • Network Address: 192.168.10.128
  5. Calculate Broadcast Address: Set the host bits to 1.

    • 10 111111 -> 10111111 in binary, which is 191 in decimal.
    • Broadcast Address: 192.168.10.191
  6. Determine Usable Range:

    • First Usable Host: 192.168.10.129 (Network + 1)
    • Last Usable Host: 192.168.10.190 (Broadcast - 1)

3. The Shortcut Method: Using the Block Size

While the binary method is precise, it's too slow for practical use, especially during an exam or when quickly planning a network. A much faster method relies on calculating the "block size" (sometimes called the "magic number") of the subnet.

This method focuses on the "interesting octet"—the last octet in the subnet mask that is not a 255 or a 0.

How to solve ANY Subnetting Problems in 60 seconds or less - Subnetting Mastery - Part 3 of 7

This video from Practical Networking demonstrates a very fast, table-based method for solving any subnetting problem.

Watch the entire video from the first and second examples. The key concept here is the "group size," which is the same as the block size. Pay close attention to how he uses the group size to quickly find the network boundaries around the target IP address.

Let's apply this faster method to our previous example: 192.168.10.150/26.

  1. Identify the Interesting Octet: The subnet mask for /26 is 255.255.255.192. The first three octets are 255, so the fourth octet is the interesting one. The IP address value in this octet is 150.

  2. Calculate the Block Size: The formula is 256 - (mask value of the interesting octet).

    • The mask value is 192.
    • Block Size = .
    • This means our subnets will be in blocks of 64: 0, 64, 128, 192.
  3. Find the Network Address: Find which block the IP address's interesting octet (150) falls into.

    • 150 is between 128 and 191.
    • The network address is always the beginning of the block.
    • Network Address: 192.168.10.128
  4. Find the Broadcast Address: This is the last address in the block, which is one less than the start of the next block.

    • The next block starts at 192.
    • So, the broadcast address is 191.
    • Broadcast Address: 192.168.10.191

As you can see, this method yields the same results as the binary method but is significantly faster. You can use this "magic number table" as a quick reference.

Subnetting Magic Number Table
This table shows the relationship between CIDR prefixes, the subnet mask value in the last octet, and the resulting block size. For our /26 example, you can see the block size is 64.

4. Practice Problems

The best way to master this is through practice. Use the shortcut method to solve these problems. For each, find the Network Address, First Usable Host, Last Usable Host, and Broadcast Address.

  1. 172.16.55.199/22
  2. 10.5.99.3/28
  3. 192.168.213.78/25
Click to see the solutions

Problem 1: 172.16.55.199/22

  • Interesting Octet: 3rd octet (Mask: 255.255.252.0)
  • Block Size: 256 - 252 = 4. Blocks are 0, 4, 8, ..., 52, 56, ...
  • Network: 55 falls in the 52 block. So, the network address is 172.16.52.0. The last octet becomes 0.
  • Broadcast: The next block is 56. So, the broadcast address is 172.16.55.255.
  • Network Address: 172.16.52.0
  • First Usable: 172.16.52.1
  • Last Usable: 172.16.55.254
  • Broadcast Address: 172.16.55.255

Problem 2: 10.5.99.3/28

  • Interesting Octet: 4th octet (Mask: 255.255.255.240)
  • Block Size: 256 - 240 = 16. Blocks are 0, 16, 32, ...
  • Network: 3 falls in the 0 block. So, the network address is 10.5.99.0.
  • Broadcast: The next block is 16. So, the broadcast is 15.
  • Network Address: 10.5.99.0
  • First Usable: 10.5.99.1
  • Last Usable: 10.5.99.14
  • Broadcast Address: 10.5.99.15

Problem 3: 192.168.213.78/25

  • Interesting Octet: 4th octet (Mask: 255.255.255.128)
  • Block Size: 256 - 128 = 128. Blocks are 0, 128.
  • Network: 78 falls in the 0 block. So, the network address is 192.168.213.0.
  • Broadcast: The next block is 128. So, the broadcast is 127.
  • Network Address: 192.168.213.0
  • First Usable: 192.168.213.1
  • Last Usable: 192.168.213.126
  • Broadcast Address: 192.168.213.127

Conclusion

In this lesson, you've put all the pieces of subnetting theory together. You can now take any IP address and CIDR prefix and determine the complete address range that defines its subnet.

Here are the key takeaways:

  • Every subnet is defined by four addresses: the network ID (first address, host bits are all 0s), the broadcast address (last address, host bits are all 1s), and the first and last usable host addresses (the addresses immediately following the network ID and preceding the broadcast).
  • The binary method is the foundational way to calculate these addresses by manipulating the host bits directly.
  • The block size (or magic number) method is a much faster shortcut for practical use. You find the interesting octet, calculate the block size (), and find the network boundaries around the given IP.

This skill is the final prerequisite for designing a complete IP addressing plan. In our next lesson, you will learn how to apply it to a real-world scenario using Variable Length Subnet Masking (VLSM), where you'll design an efficient IP scheme for a network with differently sized departments or locations.