Subnet Strategies and CIDR Planning
Complete the full lesson to earn 25 points — 50 with Pro
Work through each section, then tap “Mark as Complete” on the last one.
✦ Skip the page breaks, the wait, and see fewer ads — read each lesson on a single page with Pro
Lesson: Subnet Strategies and CIDR Planning
Introduction: The Architecture of Connectivity
In the early days of networking, the internet was a flat, open space where every device could theoretically talk to every other device. As networks grew from a handful of computers in a university lab to millions of interconnected systems across the globe, this "flat" approach became a nightmare for performance, security, and management. Network segmentation—the practice of splitting a large network into smaller, distinct sub-networks—emerged as the fundamental solution to these challenges. At the heart of this practice lies Subnetting and Classless Inter-Domain Routing (CIDR).
Understanding how to slice up an IP address range is not just a technical requirement for passing certification exams; it is a critical skill for building secure, scalable, and efficient infrastructure. When you design a network, you are essentially creating a blueprint for how traffic flows. If your design is flawed, you will face broadcast storms, security vulnerabilities where a single compromised device can infect an entire organization, and address space exhaustion. This lesson will guide you through the mechanics of CIDR, the logic behind effective subnetting, and the best practices that keep enterprise networks running smoothly.
Understanding the Fundamentals: IP Addressing and Binary Logic
To master subnetting, you must first understand how computers see an IP address. While we are used to seeing decimal notation like 192.168.1.1, computers operate in binary. An IPv4 address consists of 32 bits, divided into four octets of 8 bits each. Each bit represents a power of two, ranging from 128 down to 1.
When we talk about subnetting, we are talking about drawing a line through those 32 bits. Everything to the left of the line is the "network portion," which identifies the specific segment of the network. Everything to the right is the "host portion," which identifies the individual device. The Subnet Mask—or in modern terms, the CIDR prefix—tells the network devices exactly where that line is drawn.
The Anatomy of CIDR Notation
CIDR (Classless Inter-Domain Routing) replaced the old "Classful" system (Class A, B, and C networks) in the early 1990s. In the old system, a Class C network was always a fixed size, which led to massive waste. CIDR allows us to be flexible. Instead of using a clunky subnet mask like 255.255.255.0, we use a slash followed by a number, such as /24.
The number after the slash represents how many bits are set to "1" in the subnet mask. If you have a /24, it means the first 24 bits are dedicated to the network, leaving 8 bits for hosts. Since there are 32 bits total, the math is simple: 32 - 24 = 8 host bits.
Callout: The Binary Power of Two The number of available hosts in a subnet is calculated using the formula 2^h - 2, where 'h' is the number of host bits. We subtract 2 because the first address in any range is reserved as the "Network Address," and the last address is reserved as the "Broadcast Address." Understanding this power-of-two relationship is vital for sizing your subnets correctly without wasting address space.
Step-by-Step: Designing a Subnet Plan
When you are tasked with designing a network, you should never start by assigning random IPs. Instead, you should follow a structured planning process. This ensures that your network remains readable, maintainable, and expandable.
Step 1: Determine the Requirements
Before you touch a configuration file, document your needs. Ask yourself:
- How many devices will be in each department (e.g., HR, Engineering, Public Wi-Fi)?
- Will these departments need to talk to each other directly, or should they be isolated?
- Do you anticipate growth in the next 1-3 years?
Step 2: Choose Your Address Space
Use Private IP address ranges defined by RFC 1918. These are non-routable on the public internet, making them perfect for internal networks.
10.0.0.0/8: Massive scale, ideal for large enterprises.172.16.0.0/12: Medium scale, frequently used in data centers.192.168.0.0/16: Small scale, common for office or home environments.
Step 3: Calculate Subnet Sizes
If you have a department with 50 computers, you don't want to use a /24 (which supports 254 hosts) if you can avoid it, as that wastes space. However, you also don't want to use a /26 (which supports 62 hosts) if you expect that department to grow to 70 people next month. A good rule of thumb is to size your subnet to accommodate the current need plus a 50% buffer for growth.
Step 4: Map the Network
Create a spreadsheet or a diagram. List your subnets, their CIDR ranges, and their purposes. For example:
- Management:
10.0.1.0/27(30 usable IPs) - Servers:
10.0.1.32/27(30 usable IPs) - Workstations:
10.0.2.0/24(254 usable IPs)
Note: Always start your subnet allocations in contiguous blocks. If you assign
10.0.1.0/24for one purpose and then10.0.3.0/24for another, you leave10.0.2.0/24"orphaned" in the middle. This makes route summarization—a technique used to keep routing tables small—much harder later on.
Practical Example: Implementing a Segmented Office Network
Imagine you are setting up a network for a small company with three departments: Finance, Engineering, and Guest Wi-Fi. You have been assigned the 192.168.10.0/24 block.
1. Finance (Needs 20 IPs):
You choose a /27 mask. A /27 provides 32 total addresses. After removing the network and broadcast addresses, you have 30 usable slots. This is perfect for 20 people plus growth.
- Range:
192.168.10.0to192.168.10.31
2. Engineering (Needs 50 IPs):
A /27 is too small (only 30 IPs). You move up to a /26, which provides 64 total addresses (62 usable).
- Range:
192.168.10.64to192.168.10.127
3. Guest Wi-Fi (Needs 100 IPs):
A /26 is too small. You move up to a /25, which provides 128 total addresses (126 usable).
- Range:
192.168.10.128to192.168.10.255
By following this approach, you have neatly carved up your single /24 into three distinct segments. If you need to add a security rule later to prevent the Guest Wi-Fi from talking to Finance, you can simply write a firewall rule that says "Deny traffic from 192.168.10.128/25 to 192.168.10.0/27."
The Importance of Isolation and Security
Segmentation is the primary tool for implementing the "Principle of Least Privilege" in networking. If every device is on the same subnet, a compromised laptop in the lobby can scan the entire company network, including the servers holding sensitive data. By isolating these groups into different subnets and placing a firewall or an Access Control List (ACL) between them, you limit the "blast radius" of any security incident.
VLANs and Subnets
While subnets are a Layer 3 (IP) concept, they are almost always paired with VLANs (Virtual Local Area Networks) at Layer 2 (Data Link). A VLAN acts as a broadcast domain. If you have 100 computers in a VLAN, they all receive each other's broadcast traffic. By mapping one subnet to one VLAN, you keep your broadcast traffic contained, which improves overall network performance.
Best Practices for Segmentation
- Keep it consistent: Use a standardized naming and numbering scheme across all sites. If Finance is
10.x.10.0/24in your New York office, try to keep the same scheme in your London office. - Document everything: A network map that isn't updated is worse than no map at all. Use tools like NetBox or simple version-controlled spreadsheets.
- Use smaller subnets for security: If you have a group of servers that only need to talk to one specific database, put them in their own isolated subnet.
- Avoid "Supernetting" unless necessary: While you can combine subnets, it often creates confusion. Stick to clean boundaries.
Callout: Subnetting vs. Supernetting Subnetting is the act of taking a large network and breaking it into smaller ones. Supernetting (or CIDR aggregation) is the opposite: taking multiple smaller networks and advertising them as one large block to a router. Supernetting is essential for keeping the global internet routing table small, but it should be avoided within your internal LAN to ensure granular security controls.
Common Pitfalls and How to Avoid Them
Even experienced network engineers make mistakes when planning address space. Here are the most common traps:
1. The "Off-by-One" Error
This happens when you miscalculate the network or broadcast addresses. Always remember that the first address is the network ID and the last is the broadcast. For a /24 network, the range is .0 to .255. If you try to assign .256 to a device, the system will reject it.
2. Over-Segmentation
Some administrators go too far, creating dozens of tiny subnets for every individual service. This leads to "VLAN sprawl," where managing the firewall rules becomes exponentially more complex. If you have 50 subnets, you have 50 potential points of failure and a massive firewall policy to audit. Find a balance between security and manageability.
3. Ignoring Growth
Never size a subnet for your current headcount. If a team has 10 people, a /28 (14 usable) seems fine. But what if they hire two more people and add a printer and a network scanner? You are suddenly out of space. Always plan for at least 50-100% growth for localized segments.
4. Overlapping Subnets
This is the cardinal sin of networking. If you have an office in New York using 10.0.1.0/24 and you open an office in Chicago that also uses 10.0.1.0/24, you will never be able to connect the two via a VPN. The routers will not know which "10.0.1.0" you are trying to reach. Always maintain a master IP address plan (IPAM) for your entire organization.
Technical Implementation: Configuring a Subnet
In a real-world environment, you configure subnets on a router or a Layer 3 switch. Here is a conceptual look at how this is applied in a Cisco-style environment.
# Enter global configuration mode
configure terminal
# Create a VLAN for the Finance department
vlan 10
name Finance
# Assign an IP address to the virtual interface (SVI)
interface vlan 10
ip address 192.168.10.1 255.255.255.224
no shutdown
# Explain the settings:
# 192.168.10.1 is the Default Gateway for the Finance devices.
# 255.255.255.224 is the subnet mask (equivalent to a /27).
# Any device in this VLAN must have an IP between 192.168.10.2 and 192.168.10.30.
When a device in the Finance VLAN wants to talk to a device in the Engineering VLAN, the traffic hits the SVI (Switch Virtual Interface), which acts as the router for that subnet. The router checks its routing table and forwards the packet to the correct destination. This is where you would apply Access Control Lists (ACLs) to filter the traffic.
Quick Reference Table: CIDR to Subnet Mask
| CIDR | Subnet Mask | Usable Hosts | Use Case |
|---|---|---|---|
| /30 | 255.255.255.252 | 2 | Point-to-point links |
| /29 | 255.255.255.248 | 6 | Small server clusters |
| /28 | 255.255.255.240 | 14 | Small office groups |
| /27 | 255.255.255.224 | 30 | Medium department |
| /26 | 255.255.255.192 | 62 | Large department |
| /25 | 255.255.255.128 | 126 | Large office floor |
| /24 | 255.255.255.0 | 254 | Standard LAN |
Warning: Be very careful with
/30and/31subnets. A/30provides only two usable host addresses, which is perfect for connecting two routers together. However, a/31is a special case used in modern point-to-point links that treats the entire range as usable IPs. Do not use/31unless you are certain your hardware supports it, as older equipment will treat the network and broadcast addresses as invalid.
Advanced Concepts: Variable Length Subnet Masking (VLSM)
Variable Length Subnet Masking (VLSM) is the technique we used in our example earlier: using different subnet masks for different segments of the same network block. In the early days, you had to use the same mask for every subnet in a network. This was incredibly inefficient.
With VLSM, you can allocate a /26 to a large department and a /30 to a router-to-router link within the same /24 address space. This maximizes the use of your available IP addresses. When designing your network, always use VLSM to ensure you are not wasting precious address space on links that only require two IPs.
The Math of VLSM
To implement VLSM successfully, always allocate your largest subnets first. If you have a /24 network and you need one subnet for 60 hosts and one for 10 hosts, start with the 60-host subnet.
- Allocate the
/26(64 addresses) for the 60 hosts. This uses192.168.10.0through192.168.10.63. - Now you can start your next subnet at
192.168.10.64. - If you had started with the small one, you might have fragmented your space, making it impossible to fit the larger block later.
Security Considerations: Beyond Subnetting
While subnets provide isolation, they are not a security panacea. A subnet boundary is just a logical barrier. If an attacker has access to a device on that subnet, they can still perform internal reconnaissance.
Network Access Control (NAC)
Modern networks often combine subnetting with NAC. NAC ensures that only authorized devices can join a specific subnet. For example, when a user plugs their laptop into the wall, the switch checks their identity (via 802.1X authentication). If they are in the Finance department, the switch dynamically assigns their port to the Finance VLAN. This prevents unauthorized devices from simply plugging into a "Finance" port and gaining access to that subnet.
Micro-segmentation
In high-security environments, we take subnetting to the extreme with micro-segmentation. This is often done at the virtual machine or container level, where every single workload has its own firewall policy, regardless of what subnet it is on. While this is the gold standard for security, it requires significant automation and orchestration software. For most standard office networks, traditional VLAN/Subnet segmentation remains the most effective balance of cost and security.
Common Questions and Troubleshooting
Q: Why can't my devices in different subnets communicate? A: By design, subnets are isolated. To allow communication, you need a router or a Layer 3 switch to perform "inter-VLAN routing." If you have the routing enabled and it still doesn't work, check your firewall rules or ACLs to ensure you aren't explicitly blocking the traffic.
Q: How do I know if I'm running out of IPs? A: Monitor your DHCP scopes. Most DHCP servers provide reports on address utilization. If a scope is consistently at 80% capacity, it is time to either expand the subnet (which is difficult) or move some devices to a new, separate subnet.
Q: Can I change a subnet size after it's live? A: Generally, no. Changing a subnet mask requires changing the IP settings on every single device in that subnet, including the gateway. It is far easier to create a new, larger subnet and migrate devices over to it during a maintenance window.
Q: What is a "Default Gateway," and why does it matter? A: The Default Gateway is the IP address of the router interface on your local subnet. It is the "exit door" for all traffic destined for a network outside of your local subnet. If your gateway is misconfigured, your device will only be able to talk to other devices in the same room, but never to the internet or other departments.
Best Practices Checklist for Network Design
- Plan before you build: Never assign IPs on the fly. Use a central IPAM tool.
- Use RFC 1918 space: Stick to
10.0.0.0/8,172.16.0.0/12, or192.168.0.0/16. - Keep it contiguous: Keep subnets for a single location or function together to make routing easier.
- Document the "Why": Don't just record the IP; record why that subnet exists and who owns the devices on it.
- Automate where possible: Use DHCP for workstations to prevent manual configuration errors.
- Review your ACLs: Regularly audit your firewall rules to ensure they still align with your business needs.
- Test your failover: If you have redundant routers, ensure your subnets are advertised correctly through both paths.
Key Takeaways
- Subnetting is the foundation of network design: It provides the structure required to manage traffic, improve performance, and enforce security policies.
- CIDR is the standard: Using CIDR notation (
/24,/27, etc.) is essential for flexible and efficient address space allocation, replacing the outdated classful system. - Binary math is required: Understanding the power-of-two relationship is the only way to accurately size subnets and avoid wasting IP addresses.
- Plan for the future: Always factor in growth when sizing your subnets. A subnet that is full today will be a major headache tomorrow.
- Isolation equals security: Use subnet boundaries to contain broadcast traffic and limit the reach of potential security threats.
- Hierarchy matters: Keep your network design logical and hierarchical. This makes troubleshooting significantly faster and allows for easier route summarization.
- Documentation is non-negotiable: A network is a living organism. If you don't track your changes in a central registry, you will inevitably run into overlapping subnets or configuration conflicts.
By mastering these concepts, you move from being a "tinkerer" who just makes things work to an architect who builds systems that are resilient, secure, and ready for the future. Remember that the best networks are often the ones that are boring—they are well-planned, clearly documented, and operate predictably because the fundamental design is sound.
Reach the last section to complete this lesson and earn points — you're on section 1 of 11.
- AWS Organizations Network Architecture
- AWS Organizations Network Architecture Quiz5q
- Multi-Account VPC Strategy
- Multi-Account VPC Strategy Quiz5q
- Cross-Region Network Connectivity
- Cross-Region Network Connectivity Quiz5q
- Transit Gateway Cross-Region Peering
- Transit Gateway Cross-Region Peering Quiz5q
- Global Accelerator for Multi-Region
- Global Accelerator for Multi-Region Quiz5q
- Route 53 Routing Policies
- Route 53 Routing Policies Quiz5q
- AWS Direct Connect Architecture
- AWS Direct Connect Architecture Quiz5q
- Direct Connect Gateway Design
- Direct Connect Gateway Design Quiz5q
- Site-to-Site VPN Design Patterns
- Site-to-Site VPN Design Patterns Quiz5q
- VPN over Direct Connect
- VPN over Direct Connect Quiz5q
- Transit Gateway with Hybrid Networks
- Transit Gateway with Hybrid Networks Quiz5q
- BGP Routing for Hybrid Connectivity
- BGP Routing for Hybrid Connectivity Quiz5q
- VPC Design Patterns
- VPC Design Patterns Quiz5q
- Subnet Strategies and CIDR Planning
- Subnet Strategies and CIDR Planning Quiz5q
- Network ACLs Design
- Network ACLs Design Quiz5q
- Security Group Architectures
- Security Group Architectures Quiz5q
- VPC Endpoints Strategy
- VPC Endpoints Strategy Quiz5q
- AWS PrivateLink Design
- AWS PrivateLink Design Quiz5q
- Multi-AZ Network Architectures
- Multi-AZ Network Architectures Quiz5q
- Elastic Load Balancing Design
- Elastic Load Balancing Design Quiz5q
- Application Load Balancer Features
- Application Load Balancer Features Quiz5q
- Network Load Balancer Use Cases
- Network Load Balancer Use Cases Quiz5q
- Gateway Load Balancer Design
- Gateway Load Balancer Design Quiz5q
- DNS Failover Strategies
- DNS Failover Strategies Quiz5q
- VPC Creation and Configuration
- VPC Creation and Configuration Quiz5q
- VPC Peering Implementation
- VPC Peering Implementation Quiz5q
- Transit Gateway Implementation
- Transit Gateway Implementation Quiz5q
- VPC Endpoint Configuration
- VPC Endpoint Configuration Quiz5q
- NAT Gateway and NAT Instance
- NAT Gateway and NAT Instance Quiz5q
- Internet Gateway and Egress-Only IGW
- Internet Gateway and Egress-Only IGW Quiz5q
- VPC Flow Logs Configuration
- VPC Flow Logs Configuration Quiz5q
- Direct Connect Setup
- Direct Connect Setup Quiz5q
- Virtual Interfaces Configuration
- Virtual Interfaces Configuration Quiz5q
- Direct Connect Resiliency
- Direct Connect Resiliency Quiz5q
- Site-to-Site VPN Configuration
- Site-to-Site VPN Configuration Quiz5q
- Customer Gateway Setup
- Customer Gateway Setup Quiz5q
- VPN Monitoring and Troubleshooting
- VPN Monitoring and Troubleshooting Quiz5q
- CloudHub Implementation
- CloudHub Implementation Quiz5q
- Route 53 Hosted Zones
- Route 53 Hosted Zones Quiz5q
- Route 53 Health Checks
- Route 53 Health Checks Quiz5q
- Route 53 Resolver
- Route 53 Resolver Quiz5q
- CloudFront Distribution Setup
- CloudFront Distribution Setup Quiz5q
- CloudFront Origin Configuration
- CloudFront Origin Configuration Quiz5q
- Lambda@Edge Implementation
- Lambda@Edge Implementation Quiz5q
- CloudFront Security Features
- CloudFront Security Features Quiz5q
- VPC Flow Logs Analysis
- VPC Flow Logs Analysis Quiz5q
- CloudWatch for Network Monitoring
- CloudWatch for Network Monitoring Quiz5q
- Network Manager Overview
- Network Manager Overview Quiz5q
- Traffic Mirroring
- Traffic Mirroring Quiz5q
- Reachability Analyzer
- Reachability Analyzer Quiz5q
- Network Access Analyzer
- Network Access Analyzer Quiz5q
- CloudFormation for Networking
- CloudFormation for Networking Quiz5q
- AWS CDK for Network Infrastructure
- AWS CDK for Network Infrastructure Quiz5q
- Terraform for AWS Networking
- Terraform for AWS Networking Quiz5q
- AWS Config for Network Compliance
- AWS Config for Network Compliance Quiz5q
- Systems Manager for Network Management
- Systems Manager for Network Management Quiz5q
- Security Groups Best Practices
- Security Groups Best Practices Quiz5q
- Network ACLs Best Practices
- Network ACLs Best Practices Quiz5q
- AWS Network Firewall
- AWS Network Firewall Quiz5q
- AWS WAF Implementation
- AWS WAF Implementation Quiz5q
- AWS Shield Standard and Advanced
- AWS Shield Standard and Advanced Quiz5q
- DDoS Mitigation Strategies
- DDoS Mitigation Strategies Quiz5q
- TLS/SSL Implementation
- TLS/SSL Implementation Quiz5q
- VPN Encryption Options
- VPN Encryption Options Quiz5q
- Direct Connect Encryption
- Direct Connect Encryption Quiz5q
- Certificate Manager Integration
- Certificate Manager Integration Quiz5q
- PrivateLink for Secure Access
- PrivateLink for Secure Access Quiz5q
- Macie for Network Data
- Macie for Network Data Quiz5q
- Network Compliance Frameworks
- Network Compliance Frameworks Quiz5q
- AWS Config Network Rules
- AWS Config Network Rules Quiz5q
- IAM for Network Resources
- IAM for Network Resources Quiz5q
- Service Control Policies for Networking
- Service Control Policies for Networking Quiz5q
- Resource Access Manager
- Resource Access Manager Quiz5q
- Network Audit and Reporting
- Network Audit and Reporting Quiz5q
- GuardDuty for Network Threats
- GuardDuty for Network Threats Quiz5q
Enjoying the courses?
Everything stays free. Pro shows fewer ads, doubles the points you earn on every lesson and quiz so you progress twice as fast, unlocks half of every practice exam — plus full case studies — with the Learn & Exam study modes, and lets you read each lesson on one page.
- ✓ Fewer advertisements
- ✓ 2× points per lesson & quiz
- ✓ 50% of every exam unlocked
- ✓ Learn & Exam modes
- ✓ Distraction-free lessons