Azure Virtual Networks: Address Spaces, Subnets, IP Addressing, DNS and Network Interfaces
What Is a VNet?
A virtual network (VNet) is your private network in Azure inside one region and subscription. Resources in a VNet can talk to each other privately by default.
Address Space and Subnets
- Pick private ranges:
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 - Use CIDR notation:
10.20.0.0/16has 65,536 addresses - A subnet is a slice, for example
10.20.1.0/24(256 addresses) - Azure reserves 5 addresses in every subnet, so a
/24has 251 usable - Do not overlap with other VNets or on-premises if you will connect them
bash
az network vnet create -g rg-net -n vnet-app --address-prefixes 10.20.0.0/16 --subnet-name web --subnet-prefixes 10.20.1.0/24 -l centralindia
az network vnet subnet create -g rg-net --vnet-name vnet-app -n data --address-prefixes 10.20.2.0/24
az network vnet subnet list -g rg-net --vnet-name vnet-app -o table
powershell
$web = New-AzVirtualNetworkSubnetConfig -Name web -AddressPrefix 10.20.1.0/24
New-AzVirtualNetwork -Name vnet-app -ResourceGroupName rg-net -Location centralindia -AddressPrefix 10.20.0.0/16 -Subnet $web
Special Subnets
| Name | Used by |
|---|---|
GatewaySubnet | VPN and ExpressRoute gateways |
AzureBastionSubnet | Bastion (/26 or bigger) |
AzureFirewallSubnet | Azure Firewall (/26 or bigger) |
IP Addresses
| Type | Notes |
|---|---|
| Private IP | Inside the VNet. Dynamic (default) or static |
| Public IP | Reachable from the internet. Basic SKU is being retired, use Standard (static, zone-aware, secure by default) |
bash
az network public-ip create -g rg-net -n pip-web --sku Standard --allocation-method Static --zone 1 2 3
az network nic create -g rg-net -n nic-web --vnet-name vnet-app --subnet web --private-ip-address 10.20.1.10 --public-ip-address pip-web
- Standard public IPs are closed until you allow traffic with an NSG
- A VM can have several NICs (needs a size that supports it)
- Enable accelerated networking on supported sizes for lower latency
DNS
| Need | Solution |
|---|---|
| Names inside a VNet | Azure-provided DNS (VM names) or Private DNS zone |
| Public domain hosting | Azure DNS public zone (you change the registrar's name servers) |
| Custom DNS server | Set DNS servers on the VNet |
| On-premises and Azure name resolution | DNS Private Resolver |
bash
az network dns zone create -g rg-net -n contoso.com
az network dns record-set a add-record -g rg-net -z contoso.com -n www --ipv4-address 20.1.2.3
az network private-dns zone create -g rg-net -n corp.internal
az network private-dns link vnet create -g rg-net -z corp.internal -n link-app -v vnet-app -e true
-e trueenables auto-registration of VM records in the private zone- Record types: A, AAAA, CNAME, MX, TXT, NS, SRV, PTR. CNAME cannot be at the zone apex. Use an alias record
Practice
- Create a VNet with web and data subnets
- Create a Standard static public IP and attach it to a NIC
- Create a private DNS zone linked to the VNet with auto-registration
- Calculate usable addresses in a /26 subnet
Conclusion
A VNet has an address space split into subnets. Plan non-overlapping ranges, use Standard public IPs, and use Azure DNS and private DNS zones for names.
Quick Summary: VNet; addressing; special subnets; IPs; DNS.

