Virtual Networks, Subnets and Public IP Addresses
30-second answer
An Azure virtual network (VNet) is a private IP address space (for example 10.0.0.0/16) in one region and subscription, split into subnets. Azure reserves 5 addresses in every subnet (network, default gateway, two for Azure DNS and broadcast), so a /29 leaves 3 usable and a /24 leaves 251. Address spaces must not overlap anything you'll connect to. A public IP address today is the Standard SKU: always static, zone-redundant where the region has zones, and closed to inbound traffic until an NSG allows it. Basic SKU public IPs were retired on 30 September 2025.
Simulate it » No Azure account neededExam objective: 4.1.1 Create and configure virtual networks and subnets. 4.1.3 Configure public IP addresses. (Skills measured as of April 17, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Search for <strong>virtual networks</strong> to plan the hub.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Search for virtual networks to plan the hub.
- Type virtual networks in the search bar and pick Virtual networks under Services.
- Select + Create.
- A VNet lives in one region and one subscription. Pick the resource group and name it.
- You can add Bastion or Firewall here, but we'll do Bastion separately so you see its subnet rules.
- Plan ranges that don't overlap the spokes or on-premises. Azure keeps 5 addresses in every subnet, so a /29 leaves you only 3.
- Review and Create.
- Deployment done. Now the public IP for the hub's VPN gateway.
- Search Public IP addresses and select + Create.
- Standard SKU, Static, Zone-redundant. A Standard IP is closed to inbound traffic until an NSG allows it.
- The address never changes while the resource exists, so firewalls and partners can allow it. Associate it later to a VPN gateway, load balancer, Bastion or NIC.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
VNets, subnets and a public IP
A virtual network is your private range in one region, split into subnets. Azure keeps 5 addresses in every subnet. A Standard public IP is static, zone-redundant where the region has zones, and closed to inbound traffic until an NSG opens it.
🤔 What happens if…
Read this tour as text
- VNets, subnets and a public IP. A virtual network is your private range in one region, split into subnets. Azure keeps 5 addresses in every subnet. A Standard public IP is static, zone-redundant where the region has zones, and closed to inbound traffic until an NSG opens it.
- Peering is not transitive. VNet peering joins two VNets over the Microsoft backbone. Each side has its own link, address spaces can't overlap, and the hub can share its VPN gateway (gateway transit). Peering never chains: spoke 1 and spoke 2 can't talk through the hub on their own.
- User-defined routes to the NVA. A route table on a subnet overrides system routes. Next hop Virtual appliance sends traffic to a firewall or NVA, which needs IP forwarding on its NIC. Longest prefix wins, and a user route beats a system route on the same prefix.
- NSGs, ASGs and effective rules. An NSG has rules checked by priority (100 to 4096, lowest first). Inbound traffic meets the subnet NSG first, then the NIC NSG, and both must allow. An application security group lets a rule say "to the web servers" instead of listing IPs.
- Azure Bastion. Azure Bastion lives in AzureBastionSubnet (/26 or larger) and opens RDP and SSH to VMs on their private IPs, from the portal over TLS 443 or with the native client on Standard and Premium. One Bastion in the hub serves peered spokes.
- Service endpoint vs private endpoint. A service endpoint sends a subnet's traffic to the service's public IP over the backbone, and the service firewall allows that subnet. A private endpoint gives the service a private IP in your VNet, and a privatelink private DNS zone makes the name resolve to it.
- Azure DNS: public and private zones. A public zone answers the internet once you delegate the domain to Azure's name servers. Alias records point at Azure resources such as a public IP. A private zone answers only VNets with a virtual network link, and can auto-register VM names.
- Standard load balancer and health probes. A load balancer spreads TCP/UDP flows from a frontend (public or internal) to a backend pool by load-balancing rules. A health probe pulls a VM out of rotation when it stops answering. Probes come from 168.63.129.16.
- Troubleshoot with Network Watcher. Network Watcher tools answer one question each. IP flow verify: which NSG rule allows or denies this flow? Next hop: where does this packet go? Connection troubleshoot: can A reach B, and if not, at which hop?
Contoso wants one hub VNet for shared services and two spoke VNets for apps. Build the address plan, give the hub a static public IP and a VPN gateway, peer everything, then find out the hard way that spoke 1 can't talk to spoke 2 until you route it through a firewall in the hub.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
The new subnet ran out of addresses after 10 VMs and the IP ranges clash with the office.
😊 THE SOLUTION
Plan non-overlapping address spaces, size subnets for growth and use Standard static public IPs.
- Subnet too small✓ Remember the 5 reserved addresses
- Ranges overlap on-premises✓ Plan the address space first
- Public IP changes after a restart✓ Standard SKU, always static
Start with a question
Why does a new office building get its floor plan before anyone moves in?
Before the furniture arrives, someone decides which floor is sales, which is finance, and how many desks each gets. Move in first and plan later, and you end up knocking down walls.
An Azure virtual network is that building and its subnets are the floors. You pick the address ranges up front, size each subnet for what will live there, and keep the ranges clear of every other building you’ll ever connect to. The public IP address is the street address on the front door: fixed, so visitors and firewalls can find you.
Explain it like I’m 10
The technical explanation
Virtual networks
A VNet has one or more address spaces in CIDR notation, usually private ranges from RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). It belongs to one region and one subscription, and it’s free. Resources inside it talk to each other privately by default, and they can reach the internet outbound.
Plan the ranges first. Peered VNets and on-premises networks you connect over VPN or ExpressRoute can’t overlap, and fixing an overlap later means rebuilding peerings and gateways.
Subnets and the 5 reserved addresses
Each subnet takes a slice of the address space. Azure keeps 5 addresses in every one:
| Address in 10.0.1.0/24 | Used for |
|---|---|
| 10.0.1.0 | Network address |
| 10.0.1.1 | Default gateway |
| 10.0.1.2 and 10.0.1.3 | Azure DNS mapping |
| 10.0.1.255 | Broadcast |
| Prefix | Addresses | Usable |
|---|---|---|
| /29 (smallest) | 8 | 3 |
| /28 | 16 | 11 |
| /27 | 32 | 27 |
| /26 | 64 | 59 |
| /24 | 256 | 251 |
Some services need their own subnet with a fixed name or size: GatewaySubnet for VPN and ExpressRoute gateways (/27 or bigger recommended), AzureBastionSubnet (/26 or bigger), AzureFirewallSubnet (/26). Others delegate a subnet, such as App Service VNet integration or Container Instances. Subnets are where you attach NSGs, route tables and service endpoints.
You can change a subnet’s range only when nothing is using the addresses being removed. You can add address spaces to a VNet later, and peerings then need a sync.
Public IP addresses
| Setting | What to pick |
|---|---|
| SKU | Standard. Basic was retired on 30 September 2025. |
| Assignment | Static (the only option for Standard). The address stays until you delete the resource. |
| Availability zone | Zone-redundant (default in zone regions), a single zone, or no zone. |
| Tier | Regional, or Global for a cross-region load balancer. |
| Routing preference | Microsoft network (default) or Internet. |
| DNS name label | Optional, gives label.region.cloudapp.azure.com. |
A Standard public IP is secure by default: inbound traffic is blocked until an NSG on the subnet or NIC allows it. You attach it to a VM’s NIC, a Standard load balancer frontend, a VPN gateway, Bastion, NAT gateway or Azure Firewall. Price feel: about $3.65 a month (illustrative).
Portal and CLI
Portal: Virtual networks → + Create → Basics → Security → IP addresses (address space and subnets) → Review + create. Then Public IP addresses → + Create.
az network vnet create -g rg-net-hub -n vnet-hub \
--address-prefixes 10.0.0.0/16 --subnet-name snet-shared --subnet-prefixes 10.0.1.0/24
az network vnet subnet create -g rg-net-hub --vnet-name vnet-hub -n snet-tiny --address-prefixes 10.0.9.0/29
az network vnet subnet list-available-ips -g rg-net-hub --vnet-name vnet-hub -n snet-tiny
az network public-ip create -g rg-net-hub -n pip-hub-vpn \
--sku Standard --allocation-method Static --zone 1 2 3
$sub = New-AzVirtualNetworkSubnetConfig -Name snet-shared -AddressPrefix 10.0.1.0/24
New-AzVirtualNetwork -Name vnet-hub -ResourceGroupName rg-net-hub -Location eastus -AddressPrefix 10.0.0.0/16 -Subnet $sub
New-AzPublicIpAddress -Name pip-hub-vpn -ResourceGroupName rg-net-hub -Location eastus -Sku Standard -AllocationMethod Static -Zone 1,2,3
Architect level Why a VNet can't span regions
A VNet is tied to one region’s network fabric. To join regions you use global VNet peering, which still keeps traffic on Microsoft’s backbone. Subnets, though, span every availability zone in their region, so zone-redundant designs don’t need one subnet per zone.
Real-world business scenario
Contoso Retail (fictional)
- The problem
- Teams created VNets on the fly with 10.0.0.0/16 everywhere. When the company tried to peer them and connect the stores' VPN, every range collided, and a /28 subnet for checkout VMs ran out of addresses on a busy weekend.
- What they used
- A central address plan: hub 10.0.0.0/16, spokes 10.1.0.0/16 to 10.9.0.0/16, stores in 192.168.0.0/16. Subnets sized as /24 for app tiers, GatewaySubnet /27, AzureBastionSubnet /26. A zone-redundant Standard static public IP for the VPN gateway.
- Why that choice
- No overlaps means peering and VPN just work, and sizing with the 5 reserved addresses in mind stops scale-out failures.
- The result
- The network team connected 9 spokes and 140 stores with no re-addressing, and checkout scaled to 40 VMs without hitting the subnet limit.
When to use it and when not to
✓ Use it when…
- Any Azure workload that needs private addresses, from a single VM to a hub and spoke estate.
- A Standard static public IP whenever partners or firewalls must allow a fixed address.
- Separate subnets per tier so NSGs and route tables can treat them differently.
✕ Think twice when…
- Address spaces that overlap on-premises or other VNets you might peer later.
- Tiny subnets for anything that scales out.
- Public IPs on every VM. Use a load balancer, NAT gateway or Bastion instead.
↔ Alternatives to consider
- NAT gateway for outbound internet from a subnet with a few fixed IPs.
- Azure Bastion for admin access without public IPs on VMs.
- Azure Virtual Network Manager to manage many VNets and their connectivity centrally.
Test yourself with exercises
5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Why can't I use all 256 addresses in a /24 subnet?
Model answer
Azure keeps five of them in every subnet. The first is the network address, .1 is the default gateway, .2 and .3 map to Azure DNS, and the last one is the broadcast address. So a /24 gives me 251 usable addresses and a /29 gives me just 3.
Intermediate What changes when you pick a Standard public IP instead of the old Basic one?
Model answer
Standard is always static, it's zone-redundant by default in regions with availability zones, and it's secure by default: nothing comes in until an NSG allows it. It also works with Standard Load Balancer, NAT gateway and Bastion. Basic was retired in September 2025, so in practice every new public IP is Standard.
Experienced developer How do you plan address spaces for a hub and spoke design?
Model answer
I get the on-premises ranges first, then give the hub and each spoke its own block that doesn't overlap anything, for example 10.0.0.0/16 for the hub and 10.1.0.0/16, 10.2.0.0/16 for spokes. I leave room for growth, because peered VNets can't overlap and resizing later means coordinating peerings. Inside each VNet I size subnets for the biggest thing that'll live there, remembering services like Bastion need a /26 and the gateway subnet should be /27 or bigger.
Scenario A team created a subnet of 10.5.1.0/28 for a VM scale set that needs 14 instances. What happens?
Model answer
A /28 has 16 addresses, minus 5 reserved, so only 11 are usable. The scale set will fail to place the last instances. I'd move to a bigger subnet, such as a /27 (27 usable) or a /26, and I'd check nothing else shares it.
Quick revision
Key points
- A VNet is one region, one subscription, one or more CIDR ranges. VNets are free.
- Every subnet loses 5 addresses. /29 is the smallest IPv4 subnet (3 usable).
- Address spaces must not overlap VNets or on-premises networks you'll connect to.
- Standard public IP = static, zone-redundant in zone regions, closed until an NSG allows traffic.
- Basic SKU public IPs were retired on 30 September 2025.
Important terminology
- Virtual network (VNet)
- A private, isolated network in one Azure region and subscription, defined by one or more address ranges in CIDR notation.
- Subnet
- A range inside a VNet's address space where you place resources. NSGs, route tables and service endpoints attach to subnets.
- Reserved addresses
- The 5 IPs Azure keeps in every subnet - the network address, .1 for the default gateway, .2 and .3 for Azure DNS, and the broadcast address.
- Standard public IP
- The current public IP SKU. Static only, zone-redundant by default in zone regions, secure by default (inbound needs an NSG).
- Routing preference
- A public IP setting that picks Microsoft network (traffic stays on Microsoft's backbone as long as possible) or Internet (cheaper, hands off to ISPs sooner).
- Delegated subnet
- A subnet handed to one Azure service, such as Azure Container Instances or App Service VNet integration, which then manages it.
Common mistakes
- Forgetting the 5 reserved addresses when sizing a subnet.
- Expecting a Standard public IP to accept traffic with no NSG.
- Choosing overlapping ranges and discovering it only when peering fails.
Exam tips
- "How many VMs fit in a /27?" = 32 - 5 = 27.
- "Public IP must never change" = Static (Standard is always static).
- "Public IP must survive a zone failure" = Standard, zone-redundant.
Five quick revision questions
-
1.How many addresses does Azure reserve per subnet?Show
Five.
-
2.What is the smallest IPv4 subnet Azure allows?Show
A /29, with 3 usable addresses.
-
3.Which allocation methods does a Standard public IP support?Show
Static only.
-
4.Can a VNet span two regions?Show
No. A VNet lives in one region; connect regions with global peering.
-
5.Which CLI command creates a public IP?Show
az network public-ip create --sku Standard --allocation-method Static.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Configure Virtual Network Peering and Gateway Transit
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.