What is a VNet?
A Virtual Network is a logically isolated section of the Azure cloud where you can launch Azure resources in a network that you define. It is similar to a traditional network in your own data centre, but with the added benefits of Azure's scale, availability, and isolation.
Address Space and CIDR
When creating a VNet, you define its address space using CIDR (Classless Inter-Domain Routing) notation. For example, 10.0.0.0/16 gives you 65,536 IP addresses.
Private IP Ranges (RFC 1918)
Always use private IP ranges for VNets:
| Range | CIDR | Available IPs |
|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | ~16 million |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | ~1 million |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 |
CIDR Quick Reference
| CIDR | Usable IPs | Typical Use |
|---|---|---|
| /8 | ~16.7 million | Enterprise — very large |
| /16 | 65,536 | Large VNet — recommended for production |
| /24 | 256 | Small VNet or subnet |
| /26 | 64 | Small subnet (minimum for Bastion) |
| /28 | 16 | Very small subnet (minimum for Gateway) |
Reserved Addresses per Subnet
Azure reserves 5 IP addresses in every subnet:
- x.x.x.0 — Network address
- x.x.x.1 — Default gateway
- x.x.x.2, x.x.x.3 — Azure DNS
- x.x.x.255 — Broadcast
So a /24 subnet has 256 – 5 = 251 usable IPs.
VNet Scope
A VNet exists within a single Azure region and a single subscription. Resources in different regions cannot be in the same VNet — but they can be connected via VNet Peering or VPN Gateway.
| Scope | Can Communicate Without Peering? |
|---|---|
| Same VNet, same subnet | ✅ Yes — directly |
| Same VNet, different subnets | ✅ Yes — by default (unless NSG blocks) |
| Different VNets, same region | ❌ No — need VNet Peering or VPN |
| Different VNets, different regions | ❌ No — need Global VNet Peering or VPN |
| VNet to on-premises | ❌ No — need VPN Gateway or ExpressRoute |
DNS Settings
VNets have a DNS setting that controls how VMs resolve hostnames. Three options:
- Azure-provided DNS (default) — Uses Azure's built-in DNS (
168.63.129.16). Resolves Azure resource names automatically. Sufficient for most workloads. - Custom DNS servers — Specify your own DNS servers (on-premises Active Directory, custom resolvers). Required when integrating with on-premises AD.
- Private DNS Zones — Azure-managed private DNS for custom domain resolution within VNets.
VNet Peering
VNet Peering connects two VNets so resources in each can communicate privately using private IP addresses. Traffic never traverses the public internet — it uses Microsoft's backbone network.
| Feature | Regional Peering | Global Peering |
|---|---|---|
| VNet location | Same region | Different regions |
| Latency | Very low (<1ms) | Low (cross-region) |
| Bandwidth | Full VNet bandwidth | Full VNet bandwidth |
| Cost | Charged per GB | Charged per GB (higher rate) |
| Encryption | No (Microsoft backbone is trusted) | No |
# Peer VNet-A to VNet-B
az network vnet peering create \
--name VNetA-to-VNetB \
--resource-group myRG \
--vnet-name VNetA \
--remote-vnet VNetB \
--allow-vnet-access
# Peer VNet-B to VNet-A (peering must be created in BOTH directions)
az network vnet peering create \
--name VNetB-to-VNetA \
--resource-group myRG \
--vnet-name VNetB \
--remote-vnet VNetA \
--allow-vnet-access
Creating a VNet
# Create the VNet
az network vnet create \
--name myVNet \
--resource-group myResourceGroup \
--location centralindia \
--address-prefix 10.0.0.0/16
# Add a web subnet
az network vnet subnet create \
--name web-subnet \
--resource-group myResourceGroup \
--vnet-name myVNet \
--address-prefix 10.0.1.0/24
# Add an app subnet
az network vnet subnet create \
--name app-subnet \
--resource-group myResourceGroup \
--vnet-name myVNet \
--address-prefix 10.0.2.0/24
# List subnets
az network vnet subnet list \
--resource-group myResourceGroup \
--vnet-name myVNet \
--output table
VNet Limits
| Resource | Default Limit |
|---|---|
| VNets per subscription per region | 1,000 |
| Subnets per VNet | 3,000 |
| VNet Peerings per VNet | 500 |
| DNS servers per VNet | 20 |
| Address prefixes per VNet | 200 (via support: 1,000) |
Best Practices
- Use /16 for production VNets — Plenty of room to grow without recreating
- Don't overlap address spaces — Plan IP ranges across all VNets and on-premises to avoid conflicts
- Segment with subnets — Separate web, app, data, and management tiers into different subnets
- Use Hub-Spoke topology — One hub VNet with shared services (Firewall, Bastion, VPN), spoke VNets for workloads
- Document your IP scheme — Track which ranges are used where to prevent future conflicts