Virtual Network Address Spaces
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
Virtual Network Address Spaces in Microsoft Azure
Introduction: The Foundation of Cloud Connectivity
When you begin architecting a solution in Microsoft Azure, one of the first and most critical decisions you will make involves the Virtual Network (VNet). A Virtual Network acts as the primary building block for your private network in the cloud. It enables Azure resources—such as virtual machines, databases, and application gateways—to communicate securely with each other, the internet, and on-premises networks. At the heart of this network architecture lies the "Address Space."
The address space is essentially the range of private IP addresses that you assign to your virtual network. Think of it as the digital real estate you are staking out in the cloud. If you get this wrong at the start, you may find yourself facing significant hurdles later, such as IP address exhaustion, routing conflicts, or the need to perform a costly and complex network migration. Understanding how to plan, calculate, and implement these address spaces is not just a technical requirement; it is a strategic necessity for any cloud engineer.
In this lesson, we will peel back the layers of Azure Virtual Network address spaces. We will explore how CIDR notation works, how to subnet your network effectively, and how to plan for future growth while avoiding the common traps that lead to connectivity issues. By the end of this guide, you will be prepared to design networking environments that are logical, scalable, and secure.
Understanding IP Addressing and CIDR Notation
Before we dive into Azure-specific configurations, we must ensure a solid grasp of how IP addresses are structured. Azure Virtual Networks use Classless Inter-Domain Routing (CIDR) notation to define address ranges. A CIDR block consists of an IP address followed by a slash and a number (e.g., 10.0.0.0/16). This number, known as the prefix length, tells us how many bits of the address are fixed.
The IP address space is divided into two parts: the network portion and the host portion. A smaller prefix length (like /8) means a larger number of available host addresses, while a larger prefix length (like /24) means a smaller number of host addresses. For example, a /16 network provides 65,536 addresses, whereas a /24 network provides 256 addresses.
Callout: The Anatomy of a CIDR Block An IP address is represented as 32 bits. In a /24 network, the first 24 bits are reserved for the network address, leaving 8 bits for host addresses. Since 2 to the power of 8 is 256, you get 256 total addresses. Azure reserves 5 of these addresses for internal system use, meaning you have 251 usable IP addresses in a /24 subnet.
Private IP Address Ranges
Azure follows the RFC 1918 standards for private IP addresses. When building your virtual networks, you should stick to these ranges to ensure your cloud environment does not conflict with public internet addresses:
- 10.0.0.0/8 (10.0.0.0 – 10.255.255.255)
- 172.16.0.0/12 (172.16.0.0 – 172.31.255.255)
- 192.168.0.0/16 (192.168.0.0 – 192.168.255.255)
Most enterprise architectures prefer the 10.0.0.0/8 range because it offers the most flexibility for large-scale deployments and multi-region connectivity.
Planning Your Address Space Strategy
One of the biggest mistakes teams make is assigning an arbitrary address space to a VNet without considering the broader enterprise network. If your company has an on-premises data center or plans to connect multiple Azure VNets together using VNet Peering or VPN Gateways, you must ensure that your address spaces do not overlap.
The Overlap Problem
If you define your VNet as 10.0.0.0/16 and your on-premises network is also using 10.0.0.0/16, the routing tables will become confused. Traffic destined for a specific server might be routed to the wrong location, or worse, dropped entirely. Before creating your first VNet, you should maintain a centralized IP Address Management (IPAM) sheet—a simple spreadsheet or database that tracks which ranges are assigned to which environments (Production, Staging, Dev, On-Premises, etc.).
Scalability and Future-Proofing
When choosing the size of your address space, it is better to be generous. While you can add additional address ranges to a VNet later, you cannot change an existing range once subnets have been created within it. Therefore, choose a range that is large enough to support your current needs plus a significant buffer for future expansion. A /16 is often the standard "starting point" for a large VNet, which can then be carved into smaller /24 or /26 subnets as needed.
Tip: Start Large, Subnet Small Always allocate a larger address space than you think you need. You can create smaller subnets within that space to isolate different tiers of your application (e.g., Web, App, Data). It is much easier to manage a single, large VNet address space than to try and merge multiple small, fragmented VNets later.
Implementing Virtual Networks in Azure
Now that we have covered the theory, let us look at how to implement this in the Azure environment. You can create virtual networks using the Azure Portal, Azure CLI, or PowerShell.
Step-by-Step: Creating a VNet via Azure CLI
The Azure CLI is a powerful tool for repeatable deployments. To create a VNet with a specific address space, follow these steps:
Define your variables:
RESOURCE_GROUP="my-network-rg" LOCATION="eastus" VNET_NAME="prod-vnet" ADDRESS_PREFIX="10.1.0.0/16"Create the Resource Group:
az group create --name $RESOURCE_GROUP --location $LOCATIONCreate the Virtual Network:
az network vnet create \ --resource-group $RESOURCE_GROUP \ --name $VNET_NAME \ --address-prefixes $ADDRESS_PREFIX \ --location $LOCATIONVerify the creation:
az network vnet show --resource-group $RESOURCE_GROUP --name $VNET_NAME --query addressSpace.addressPrefixes
Adding Subnets
Once the VNet is created, you must carve it into subnets. Subnets allow you to logically segment your network. For example, you might put your web servers in a "Frontend" subnet and your databases in a "Backend" subnet.
az network vnet subnet create \
--resource-group $RESOURCE_GROUP \
--vnet-name $VNET_NAME \
--name "FrontendSubnet" \
--address-prefixes "10.1.1.0/24"
az network vnet subnet create \
--resource-group $RESOURCE_GROUP \
--vnet-name $VNET_NAME \
--name "BackendSubnet" \
--address-prefixes "10.1.2.0/24"
Best Practices for Network Design
Designing a network is an exercise in balancing simplicity with security. Below are industry-standard best practices that will help you maintain a clean and manageable Azure environment.
1. Use Hierarchical IP Allocation
Adopt a consistent naming and numbering scheme. For example, you could assign the third octet of your IP addresses to represent different regions or environments. If your address space is 10.0.0.0/16, you might use 10.0.10.0/24 for the "Dev" environment and 10.0.20.0/24 for the "Prod" environment. This makes troubleshooting significantly faster, as you can identify the environment simply by looking at the IP address.
2. Segregate by Traffic Type
Never put all your resources in a single, massive subnet. Use subnets to enforce security boundaries. By placing your databases in a separate subnet from your web servers, you can apply Network Security Groups (NSGs) that strictly permit traffic only from the web subnet to the database subnet, effectively blocking all other traffic.
3. Plan for Hybrid Connectivity
If you intend to connect to an on-premises network via a VPN or ExpressRoute, you must ensure that your Azure address space does not overlap with any of your corporate office networks or branch office subnets. This is a common point of failure for companies migrating to the cloud. Always verify your on-premises routing tables before finalizing your Azure IP plan.
4. Avoid Over-Subnetting
While segmentation is good, do not go overboard. Creating dozens of tiny subnets (e.g., /29 or /30) makes routing tables complex and difficult to manage. Keep your subnet sizes consistent where possible—for example, sticking to /24 subnets makes it easy to visualize how many IPs are available at a glance.
Common Pitfalls and How to Avoid Them
Even with the best intentions, networking errors happen. Here are the most frequent mistakes engineers encounter and how to mitigate them.
Pitfall 1: IP Address Exhaustion
You define a /28 subnet for your web servers, thinking you only need 10 VMs. However, you forget that Azure reserves 5 IPs per subnet, and you may eventually need to add load balancers, private endpoints, or jump boxes. Suddenly, you are out of addresses.
- Solution: Always allocate more space than the current count. A /24 is rarely "too big" for a subnet, but a /28 is very easy to outgrow.
Pitfall 2: Overlapping Address Spaces
You create a VNet with 10.0.0.0/16, and later, you realize you need to peer it with another VNet that also uses 10.0.0.0/16. Peering will fail because Azure cannot route traffic between two networks that share the same IP range.
- Solution: Use a centralized IPAM tool or a shared Excel spreadsheet to track all allocated ranges across your entire organization.
Pitfall 3: Ignoring Service Endpoints and Private Links
Modern Azure services (like Azure SQL or Storage) often use Private Links, which consume an IP address from your subnet. If your subnet is too small, you won't be able to enable these services.
- Solution: When sizing your subnets, account for the potential growth of PaaS (Platform as a Service) resources that will require their own private IP addresses within your network.
Callout: Azure Reserved IP Addresses Azure reserves five IP addresses within each subnet:
- x.x.x.0: Network address
- x.x.x.1: Default gateway
- x.x.x.2: Reserved by Azure for DNS mapping
- x.x.x.3: Reserved by Azure for DNS mapping
- x.x.x.255: Network broadcast address Always calculate your usable IP space as
(2^n) - 5.
Comparison Table: Subnet Sizing
To help you choose the right size for your subnets, use this quick reference table. Remember, the "Usable IPs" column accounts for the 5 addresses reserved by Azure.
| CIDR Prefix | Total IP Addresses | Usable IP Addresses | Best Use Case |
|---|---|---|---|
| /29 | 8 | 3 | Small VPN gateways or specialized appliances |
| /28 | 16 | 11 | Small test environments or dedicated small services |
| /27 | 32 | 27 | Small subnets for specific service tiers |
| /26 | 64 | 59 | Medium-sized application tiers |
| /25 | 128 | 123 | Large application tiers |
| /24 | 256 | 251 | Standard subnet size for most workloads |
| /23 | 512 | 507 | Large subnets for high-density deployments |
Advanced Networking: Managing Multiple VNets
As your architecture grows, you will likely move from a single VNet to a "Hub and Spoke" topology. In this model, you have a central "Hub" VNet that acts as the gateway to the internet and on-premises networks, and multiple "Spoke" VNets that host your actual applications.
Hub and Spoke Address Planning
In a Hub and Spoke model, the Hub VNet usually holds the shared services like Firewall, VPN Gateway, and ExpressRoute Gateway. The Spoke VNets hold the application logic.
- Hub VNet: Needs a large address space (e.g., 10.0.0.0/16) to accommodate various gateway subnets and management services.
- Spoke VNets: Can have smaller, dedicated address spaces (e.g., 10.1.0.0/16 for Spoke 1, 10.2.0.0/16 for Spoke 2) that do not overlap with the Hub or each other.
This structure allows you to maintain clean routing tables and makes it easy to scale. If you need to add a new environment, you simply create a new Spoke VNet with a non-overlapping range and peer it to the Hub.
Security Considerations for Address Spaces
While address spaces are about connectivity, they are also a security boundary. By carefully assigning address ranges, you can simplify your Network Security Group (NSG) rules.
Simplified NSG Rules
If all your production web servers are in a specific address range (e.g., 10.1.1.0/24) and your databases are in another (e.g., 10.1.2.0/24), your NSG rules become very readable:
- Rule 1: Allow TCP 443 from 10.1.1.0/24 to 10.1.2.0/24.
- Rule 2: Deny all other traffic.
If your address ranges are scattered or overlapping, your NSG rules will become complex and hard to audit. Security-through-design starts with a well-planned IP addressing strategy.
Using Azure Firewall
When you implement an Azure Firewall in your Hub VNet, it will inspect traffic between your Spokes. Because the Hub and Spokes have distinct address spaces, the Firewall can easily apply granular policies based on source and destination IP ranges. This is a fundamental layer of defense-in-depth.
Frequently Asked Questions (FAQ)
Q: Can I change the address space of a VNet after it is created? A: You can add an additional address range to a VNet after creation, but you generally cannot modify or remove an existing address range if there are subnets associated with it. You must plan carefully during the initial design phase.
Q: What happens if I run out of IP addresses in a subnet? A: If a subnet is full, you cannot add new resources to it. You would need to create a new, larger subnet and migrate your resources to it, which is a disruptive process. This is why we recommend starting with a /24 or larger.
Q: Can I use public IP addresses for my VNet address space? A: Technically, yes, but it is highly discouraged. Using public IP space for internal resources can lead to routing issues and security vulnerabilities. Always use the private ranges defined in RFC 1918.
Q: Does Azure charge for the size of the address space? A: No, Azure does not charge based on the size of the address space you define. You are charged for the resources you deploy within those networks, not the IP addresses themselves.
Summary and Key Takeaways
Mastering Virtual Network address spaces is the cornerstone of professional Azure infrastructure management. It is a task that requires foresight, planning, and a disciplined approach to documentation. By understanding how to structure your network, you enable your organization to scale without the fear of running into address conflicts or connectivity bottlenecks.
Here are the essential takeaways to remember as you design your next Azure environment:
- Plan for Growth: Always allocate a larger address space than you currently need. It is significantly easier to have "wasted" space than it is to re-architect an entire network because you ran out of IPs.
- Avoid Overlaps: Maintain a central IPAM record to prevent address conflicts between your Azure VNets, on-premises data centers, and other cloud providers.
- Standardize Subnetting: Use consistent subnet sizes (e.g., /24) to make your network easier to read, audit, and secure.
- Security by Design: Use logical address ranges to simplify your Network Security Group rules. Grouping resources by function and network segment makes security policies much more effective.
- Respect Reserved IPs: Always account for the five IP addresses that Azure reserves in every subnet for system management, DNS, and routing.
- Adopt Hub and Spoke: For enterprise environments, utilize a Hub and Spoke topology to centralize management and gateway services while keeping application networks isolated.
- Document Everything: Even in a small project, document your address space choices. Networking is often the first thing people forget when troubleshooting, and having a clear map of your IP ranges will save you hours of frustration in the future.
As you move forward in your career, remember that networking is not just about connecting machines; it is about creating a stable, predictable, and secure environment. Your address space design is the map that will guide all your future cloud operations. Treat it with the care that a foundational architectural element deserves.
Reach the last section to complete this lesson and earn points — you're on section 1 of 10.
- Introduction to Azure Networking
- Introduction to Azure Networking Quiz5q
- Virtual Network Address Spaces
- Virtual Network Address Spaces Quiz5q
- Subnet Design and Configuration
- Subnet Design and Configuration Quiz5q
- Public and Private IP Addressing
- Public and Private IP Addressing Quiz5q
- Network Interface Configuration
- Network Interface Configuration Quiz5q
- Azure DNS Configuration
- Azure DNS Configuration Quiz5q
- Virtual Network Peering
- Virtual Network Peering Quiz5q
- Global VNet Peering
- Global VNet Peering Quiz5q
- Azure Virtual WAN
- Azure Virtual WAN Quiz5q
- Virtual WAN Hub Configuration
- Virtual WAN Hub Configuration Quiz5q
- Service Chaining and UDR
- Service Chaining and UDR Quiz5q
- Network Virtual Appliances
- Network Virtual Appliances Quiz5q
- Azure VPN Gateway Overview
- Azure VPN Gateway Overview Quiz5q
- Site-to-Site VPN Configuration
- Site-to-Site VPN Configuration Quiz5q
- Point-to-Site VPN Configuration
- Point-to-Site VPN Configuration Quiz5q
- VPN Gateway SKUs and Sizing
- VPN Gateway SKUs and Sizing Quiz5q
- VPN Gateway High Availability
- VPN Gateway High Availability Quiz5q
- VPN Gateway Troubleshooting
- VPN Gateway Troubleshooting Quiz5q
- ExpressRoute Overview
- ExpressRoute Overview Quiz5q
- ExpressRoute Circuit Configuration
- ExpressRoute Circuit Configuration Quiz5q
- ExpressRoute Peering Types
- ExpressRoute Peering Types Quiz5q
- ExpressRoute Global Reach
- ExpressRoute Global Reach Quiz5q
- ExpressRoute FastPath
- ExpressRoute FastPath Quiz5q
- ExpressRoute High Availability
- ExpressRoute High Availability Quiz5q
- Azure Load Balancer Overview
- Azure Load Balancer Overview Quiz5q
- Internal Load Balancer Configuration
- Internal Load Balancer Configuration Quiz5q
- Public Load Balancer Configuration
- Public Load Balancer Configuration Quiz5q
- Load Balancer Health Probes
- Load Balancer Health Probes Quiz5q
- Cross-Region Load Balancer
- Cross-Region Load Balancer Quiz5q
- Application Gateway Overview
- Application Gateway Overview Quiz5q
- Application Gateway Components
- Application Gateway Components Quiz5q
- URL Path-Based Routing
- URL Path-Based Routing Quiz5q
- Multi-Site Hosting
- Multi-Site Hosting Quiz5q
- SSL Termination and End-to-End SSL
- SSL Termination and End-to-End SSL Quiz5q
- Web Application Firewall Integration
- Web Application Firewall Integration 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