Welcome back. In our last lesson, we established the "why" of Variable Length Subnet Masking (VLSM). You learned that using a single, fixed subnet size (FLSM) is inefficient and wasteful, while VLSM allows you to "right-size" each network segment, which is essential for designing the large-scale architecture you're aiming for.
Today, we move from the "why" to the "how." This lesson focuses on the first and most critical step in any VLSM plan: determining the optimal CIDR prefix for a given set of host requirements. By the end of this lesson, you'll be able to look at a need—like "the engineering department needs 150 computers"—and instantly know the most efficient subnet size to use.
1. From Host Requirements to Subnet Size
The core task is to find the smallest possible subnet that can accommodate the required number of hosts. This involves a simple but crucial calculation.
Remember from our foundational module that a subnet prefix reserves a certain number of bits for the network portion of an address, leaving the rest for hosts. If a subnet has H host bits, the total number of addresses in that subnet is . However, two of these addresses are reserved: one for the network address itself and one for the broadcast address.
Therefore, the number of usable host addresses is .
Our goal is to find the smallest value of H for which is greater than or equal to the number of hosts we need.
For example, if a department needs 25 hosts:
- A subnet with 4 host bits () gives usable hosts. Too small.
- A subnet with 5 host bits () gives usable hosts. This works. It's the smallest size that meets the requirement.
Since an IPv4 address has 32 bits total, a subnet with 5 host bits will have a prefix length of . So, the optimal prefix is /27.
2. Building a Reference Chart
Constantly doing these calculations in your head is possible, but most network engineers use a mental or written reference chart. This is the "well explained" theoretical foundation you asked for, presented in a practical format.
The following video shows how to build and use a simple decimal-based chart to map host requirements directly to CIDR prefixes, without needing to work in binary.
This video from Andrea Schauer is an excellent tutorial on building a VLSM chart. This is a powerful tool for quickly determining subnet sizes.
Watch the first part of the video, from the beginning (00:04) to 06:33. Focus on how she creates a table that links the number of hosts to a specific CIDR prefix and its properties. You might want to jot this table down yourself.
Here is a summary of that information in a table format, which you can use as a quick reference. This is a powerful tool for any network planning task.
| Hosts Needed | Next Power of 2 (Total Addresses) | Usable Hosts () | Host Bits (H) | CIDR Prefix (32-H) |
|---|---|---|---|---|
| 1-2 | 4 | 2 | 2 | /30 |
| 3-6 | 8 | 6 | 3 | /29 |
| 7-14 | 16 | 14 | 4 | /28 |
| 15-30 | 32 | 30 | 5 | /27 |
| 31-62 | 64 | 62 | 6 | /26 |
| 63-126 | 128 | 126 | 7 | /25 |
| 127-254 | 256 | 254 | 8 | /24 |
| 255-510 | 512 | 510 | 9 | /23 |
| 511-1022 | 1024 | 1022 | 10 | /22 |
| ...and so on |
How to use the table: Find your host requirement in the first column. The CIDR prefix in the last column is your optimal choice.
3. Applying the Method
Now let's see this method in action. The next video walks through several examples, showing how to select the right prefix based on different host requirements. It provides a slightly different visualization that you might also find helpful.
Variable-Length Subnet Mask (VLSM) - Subnetting Mastery - FLSM and VLSM Appendix Part 2 of 2
This video from Practical Networking reinforces the concept by working through a few examples. Pay close attention to how they handle a requirement of 31 hosts.
Watch from 01:43 to 05:18. This clip demonstrates the process of choosing the smallest possible subnet for requirements of 25, 50, and 10 hosts. Notice the crucial point made about needing 31 hosts—a /27 (30 usable) is not enough, so you must go to the next size up (/26).
This highlights a critical rule: always round up. If your requirement falls between two sizes, you must choose the larger one. Wasting a few addresses is better than not having enough for all your devices.
4. A Special Case: Point-to-Point Links
A common requirement in any large network is connecting your switches and routers. These "point-to-point" (P2P) links only ever need two IP addresses—one for the interface at each end.
Using our table, the optimal prefix is a /30, which provides exactly 2 usable addresses. This has been the standard for years.
However, modern networking offers an even more efficient option. Since there will only ever be two devices on a P2P link, a broadcast is technically unnecessary. RFC 3021 recognized this and allows for the use of a /31 prefix on these links.
- A /30 uses 4 total addresses to provide 2 usable addresses.
- A /31 uses 2 total addresses to provide 2 usable addresses.
Using /31s can save a significant number of addresses in a large network with many routed links. For your goal of building an architecture with L3 switches, this is a highly relevant technique.
The next segment of the video you just watched covers this topic perfectly.
Variable-Length Subnet Mask (VLSM) - Subnetting Mastery - FLSM and VLSM Appendix Part 2 of 2
Let's finish the video from Practical Networking. It explains how to handle address allocation for point-to-point links using both /30 and the more efficient /31 prefixes.
Watch from 08:03 to 10:51. This section explains the traditional /30 subnet for P2P links and introduces the address-saving /31 alternative.
5. Let's Practice
You've got the theory down. Now it's time to apply it. This is the core skill for this lesson.
Let's work through an example from a Cisco design guide.
Given Requirements:
netA: must support 330 hostsnetB: must support 6 hosts (P2P link)netC: must support 2 hosts (P2P link)
Determining the Prefixes:
-
netA (330 hosts):
- Looking at our chart, 330 hosts is between the 254 hosts provided by a /24 and the 510 hosts provided by a /23.
- We must round up.
- Optimal Prefix: /23
-
netB (6 hosts):
- Our chart shows that for 3-6 hosts, a /29 is the perfect fit.
- Optimal Prefix: /29
-
netC (2 hosts):
- For exactly 2 hosts, we can use a /30. If we want to be more efficient, we could use a /31.
- Optimal Prefix: /30 (or /31)
This process of analyzing requirements and selecting a prefix is the first step in creating a full VLSM allocation plan.
Your Turn: Practice Exercise
Now it's your turn to perform this step. The image below shows a set of requirements for a company's network. Your task is to determine the optimal CIDR prefix for each network segment listed.

For each "Network" listed in the table (Headquarters, Inventory, Sales, etc.), write down the required number of hosts and the optimal CIDR prefix you would choose. Don't worry about the other columns (Network Address, Host IPs, etc.) for now; we will cover those in the next lesson.
Take your time and use the reference chart we discussed.
Click here to check your answers.
- Headquarters (10,000 hosts): Needs a subnet with at least 10,000 usable IPs. A /18 provides 16,382. Answer: /18
- Inventory (5,000 hosts): Needs at least 5,000. A /19 provides 8,190. Answer: /19
- Sales (2,000 hosts): Needs at least 2,000. A /21 provides 2,046. Answer: /21
- WLAN 1 (1,000 hosts): Needs at least 1,000. A /22 provides 1,022. Answer: /22
- Manufacturing (500 hosts): Needs at least 500. A /23 provides 510. Answer: /23
- WLAN 2 (200 hosts): Needs at least 200. A /24 provides 254. Answer: /24
- IT (100 hosts): Needs at least 100. A /25 provides 126. Answer: /25
- Marketing (50 hosts): Needs at least 50. A /26 provides 62. Answer: /26
- WAN Link 1 (2 hosts): Needs 2. Answer: /30
- WAN Link 2 (2 hosts): Needs 2. Answer: /30
Conclusion
Excellent work. You have now mastered the first and most fundamental skill in VLSM design: translating a list of network requirements into a set of optimal CIDR prefixes.
Key Takeaways:
- To find the optimal prefix, you find the smallest power of two () that provides enough addresses for your requirement, keeping the rule for usable hosts in mind.
- The CIDR prefix is then calculated as .
- Using a reference chart makes this process fast and reliable.
- For point-to-point links, a
/30is the standard, but a/31is a more efficient, modern alternative.
In our next lesson, we will build directly on this skill. You'll learn how to take the list of prefixes you've just determined and assign actual, non-overlapping subnets from a larger parent address block, following the "largest-to-smallest" allocation strategy we introduced previously.