Hub-Spoke Topology: Enterprise Network Architecture
The scalable pattern enterprises use to centralize shared services and connect dozens of VNets
π‘ Intermediate
β± 20 Minutes
π AZ-104 Β· Module 04
Why This Matters
Imagine managing 50 separate office buildings, each with its own security guard, firewall, and reception desk. Nightmare, right? Hub-spoke is how Azure organizations scale. One central hub handles shared services (firewall, VPN, DNS) and spokes connect to it like branches to a tree. Every major enterprise uses this pattern. Understanding it unlocks most exam scenarios.
Before You Start
| Prerequisites | VNets & Subnets, Network Security Groups, Routing Fundamentals, VNet Peering, VPN & ExpressRoute |
| Time to understand | 20 minutes |
| Difficulty | π‘ Intermediate (combines multiple networking concepts) |
| What you'll learn | Hub-spoke architecture, when to use it, how to implement at scale |
The Simple Idea
What Is Hub-Spoke?
Hub-Spoke = A network architecture where one central VNet (hub) holds shared services, and multiple VNets (spokes) peer to it β spokes don't talk directly to each other, they route through the hub.
What Goes in the Hub?
Hub VNet contains shared infrastructure:
- VPN Gateway (on-premises connection)
- ExpressRoute Gateway (dedicated circuit)
- Azure Firewall (centralized inspection)
- DNS Resolver (shared DNS)
- Network NVA (network appliance)
Airline Network (Hub-Spoke):
Old Model (Messy):
NYC β LA β Chicago β Denver β Boston
ββ Every city connected to every other city
ββ Too many routes, hard to manage, expensive β
Hub-Spoke Model (Clean):
ββββ NYC (Spoke)
β
Dallas (Hub) βββ LA (Spoke)
β
ββ Chicago (Spoke)
β
ββ Boston (Spoke)
All flights go through Dallas hub
ββ Easier to manage β
ββ Centralized security/customs β
ββ Economies of scale β
ββ Spokes don't need direct routes β
How Hub-Spoke Works
Architecture Diagram
On-Premises (192.168.0.0/16)
β
β VPN / ExpressRoute
β
Hub VNet (10.0.0.0/16)
βββ GatewaySubnet (10.0.1.0/24) β VPN/ExpressRoute Gateway
βββ AzureFirewallSubnet (10.0.2.0/24) β Firewall (centralized inspection)
βββ SharedServicesSubnet (10.0.3.0/24) β DNS, shared resources
βββ ManagementSubnet (10.0.4.0/24) β Admin tools
β Peering β
/ \
Spoke-Prod Spoke-Dev Spoke-Test
(10.1.0.0/16) (10.2.0.0/16) (10.3.0.0/16)
ββ App tier ββ App tier ββ App tier
ββ DB tier ββ DB tier ββ DB tier
Peering Features:
ββ Hub β Spoke: "Allow gateway transit" β
ββ Spoke β Hub: "Use remote gateway" β
ββ Result: Spokes use hub's VPN to reach on-premises β
Step 1: Create Hub VNet
Hub VNet: 10.0.0.0/16
βββ GatewaySubnet: 10.0.1.0/24
β ββ Used by: VPN Gateway
βββ AzureFirewallSubnet: 10.0.2.0/24
β ββ Used by: Azure Firewall
βββ SharedServicesSubnet: 10.0.3.0/24
β ββ Used by: DNS, shared apps
βββ ManagementSubnet: 10.0.4.0/24
ββ Used by: Admin VMs
Step 2: Create Spoke VNets
Spoke-Prod: 10.1.0.0/16
βββ WebSubnet: 10.1.1.0/24
βββ AppSubnet: 10.1.2.0/24
βββ DBSubnet: 10.1.3.0/24
Spoke-Dev: 10.2.0.0/16
βββ WebSubnet: 10.2.1.0/24
βββ AppSubnet: 10.2.2.0/24
βββ DBSubnet: 10.2.3.0/24
Spoke-Test: 10.3.0.0/16
βββ WebSubnet: 10.3.1.0/24
βββ AppSubnet: 10.3.2.0/24
βββ DBSubnet: 10.3.3.0/24
Requirement: No overlapping address spaces β
Step 3: Deploy Gateways in Hub
VPN Gateway in Hub:
βββ Deployed in GatewaySubnet (10.0.1.0/24)
βββ Connects to on-premises via Site-to-Site VPN
βββ Peering option: "Allow gateway transit" ENABLED
ββ Result: All spokes can reach on-premises through hub
Azure Firewall in Hub:
βββ Deployed in AzureFirewallSubnet (10.0.2.0/24)
βββ Private IP: 10.0.2.4
βββ All internet traffic from spokes routes through it
ββ Result: Centralized inspection, threat detection β
Step 4: Create Peering (Hub β Spokes)
Peering 1: Hub β Spoke-Prod
βββ Hub side: "Allow gateway transit" = YES
βββ Spoke side: "Use remote gateway" = YES
βββ Traffic forwarding: ENABLED
ββ Result: Spoke-Prod routes through hub β
Peering 2 & 3: Hub β Spoke-Dev, Hub β Spoke-Test
ββ Same pattern, both connected β
Note: Spokes are NOT directly peered to each other β
Step 5: Configure Routing
In Hub VNet, create User-Defined Routes:
Route Table "HubRoutes":
βββ 0.0.0.0/0 β Azure Firewall (10.0.2.4)
β ββ All internet traffic through firewall
βββ 192.168.0.0/16 β VPN Gateway
β ββ On-premises traffic through gateway
βββ Apply to: All hub subnets
In Each Spoke, create User-Defined Routes:
Route Table "Prod-Routes":
βββ 0.0.0.0/0 β Hub Firewall (10.0.2.4)
β ββ Internet traffic via hub firewall
βββ 192.168.0.0/16 β Hub VPN Gateway
β ββ On-premises via hub gateway
βββ 10.2.0.0/16 β Hub firewall
β ββ Dev traffic via hub (not direct)
βββ 10.3.0.0/16 β Hub firewall
β ββ Test traffic via hub (not direct)
βββ Apply to: All prod subnets (except spokes already peered)
Result:
ββ Prod internal traffic: Direct (10.1.0.0/16)
ββ Prod β Dev traffic: Through hub firewall β
ββ Prod β Internet: Through hub firewall β
ββ Prod β On-prem: Through hub VPN β
Step 6: Apply NSG Rules
Hub Firewall Subnet NSG:
βββ Allow inbound from all spokes (10.1.0.0/16, 10.2.0.0/16, etc.)
βββ Allow inbound from on-premises (192.168.0.0/16)
βββ Allow outbound to internet
ββ Result: Firewall can inspect all traffic β
Spoke-Prod App Subnet NSG:
βββ Allow inbound from Prod Web Subnet (10.1.1.0/24)
βββ Allow inbound from Hub Firewall (10.0.2.4/32)
βββ Deny all other inbound
ββ Result: App layer only accessible from web tier and hub β
Spoke-Dev App Subnet NSG:
βββ Allow inbound from Dev Web Subnet (10.2.1.0/24)
βββ Allow inbound from Hub Firewall (10.0.2.4/32)
βββ Deny Dev β Prod (traffic filtered at firewall)
ββ Result: Dev isolated from prod β
Mental Model: Hub-Spoke as Postal System
Postal Hub-Spoke Network:
Central Post Office (Hub)
βββ Sorting facility
βββ Border control (customs/inspection)
βββ International mail gateway
βββ Shared infrastructure
Regional Branches (Spokes)
βββ Branch 1 (Production)
βββ Branch 2 (Development)
βββ Branch 3 (Testing)
βββ All mail between branches goes through central office
Mail Flow:
βββ Branch1 β Central Hub β Inspection β Forward to Branch2 β
Benefits:
βββ Central inspection point (security)
βββ Shared border gateway (cost savings)
βββ Easy to add new branches
βββ Scalable architecture β
Worked Example: Real Scenario
The Scenario
TechCorp Enterprise:
- Headquarters: Dallas data center (192.168.0.0/16)
- 3 business units: Production, Development, Testing
- Each needs isolated Azure environment
- All need access to on-premises data
- All traffic to internet must be inspected for security
Architecture Design
Hub VNet (10.0.0.0/16) - Dallas region
βββ GatewaySubnet (10.0.1.0/24)
β ββ VPN Gateway (connects to on-premises)
βββ AzureFirewallSubnet (10.0.2.0/24)
β ββ Azure Firewall (centralized inspection)
βββ SharedServicesSubnet (10.0.3.0/24)
β ββ DNS resolver, monitoring agents
βββ ManagementSubnet (10.0.4.0/24)
ββ Admin VM for troubleshooting
Spoke-Prod (10.1.0.0/16) - Production
βββ WebSubnet (10.1.1.0/24) β Load balancer, web VMs
βββ AppSubnet (10.1.2.0/24) β App servers
βββ DBSubnet (10.1.3.0/24) β Production databases
Spoke-Dev (10.2.0.0/16) - Development
βββ WebSubnet (10.2.1.0/24)
βββ AppSubnet (10.2.2.0/24)
βββ DBSubnet (10.2.3.0/24)
Spoke-Test (10.3.0.0/16) - Testing
βββ WebSubnet (10.3.1.0/24)
βββ AppSubnet (10.3.2.0/24)
βββ DBSubnet (10.3.3.0/24)
Step 1: Setup Hub
1. Create Hub VNet (10.0.0.0/16)
2. Create 4 subnets (Gateway, Firewall,
SharedServices, Management)
3. Deploy VPN Gateway in GatewaySubnet
ββ Configure for on-premises connection
4. Deploy Azure Firewall in
AzureFirewallSubnet
ββ Assign static public IP
5. Create DNS Resolver in
SharedServicesSubnet
ββ For hybrid DNS resolution
Step 2: Setup Spokes
1. Create 3 spoke VNets:
ββ Prod (10.1.0.0/16)
ββ Dev (10.2.0.0/16)
ββ Test (10.3.0.0/16)
2. In each spoke, create 3 subnets:
ββ Web (Web servers / load balancer)
ββ App (Application servers)
ββ DB (Databases)
3. Verify: No overlapping address
spaces β
Step 3: Create Peerings
Peering: Hub β Prod
ββ Hub setting: "Allow gateway transit" = YES
ββ Prod setting: "Use remote gateway" = YES
ββ Traffic forwarding: ENABLED
ββ Status: Connected β
Peering: Hub β Dev
ββ Hub setting: "Allow gateway transit" = YES
ββ Dev setting: "Use remote gateway" = YES
ββ Traffic forwarding: ENABLED
ββ Status: Connected β
Peering: Hub β Test
ββ Hub setting: "Allow gateway transit" = YES
ββ Test setting: "Use remote gateway" = YES
ββ Traffic forwarding: ENABLED
ββ Status: Connected β
NOT Created: Prod β Dev, Prod β Test, Dev β Test
ββ Keeps environments isolated β
Step 4: Configure Routing in Hub
| Destination | Next Hop | Purpose |
| 0.0.0.0/0 | Firewall (10.0.2.4) | Internet traffic |
| 192.168.0.0/16 | VPN Gateway | On-premises |
Apply to all hub subnets.
Step 5: Configure Routing in Spokes
| Destination | Next Hop | Purpose |
| 10.0.0.0/16 | Hub (peering) | Hub access (peering, not UDR needed) |
| 10.2.0.0/16 | Firewall (10.0.2.4) | Dev traffic via firewall |
| 10.3.0.0/16 | Firewall (10.0.2.4) | Test traffic via firewall |
| 192.168.0.0/16 | VPN Gateway (via hub) | On-premises via hub |
| 0.0.0.0/0 | Firewall (10.0.2.4) | Internet via firewall |
Apply to all prod subnets. Dev and Test get similar routes (swap Prod with Dev/Test as destination).
Step 6: Configure NSGs
Prod WebSubnet NSG
βββ Allow inbound on 80, 443
β from 0.0.0.0/0 (internet)
βββ Allow inbound on port 8080
β from App subnet (10.1.2.0/24)
βββ Deny all other inbound
Prod AppSubnet NSG
βββ Allow inbound from Web subnet
β (10.1.1.0/24)
βββ Allow inbound from Hub Firewall
β (10.0.2.4/32)
βββ Allow outbound to DB subnet
β (10.1.3.0/24)
βββ Allow outbound to Firewall
β (10.0.2.4/32)
βββ Deny all other inbound
Prod DBSubnet NSG
βββ Allow inbound port 1433
β from App subnet (10.1.2.0/24)
βββ Deny all inbound from other
β spokes (firewall inspects,
β can't bypass)
βββ Deny internet access
(Dev and Test get similar NSGs)
Hub Firewall Subnet NSG
βββ Allow inbound from all spokes (10.1.0.0/16, 10.2.0.0/16, 10.3.0.0/16)
βββ Allow inbound from on-prem (192.168.0.0/16)
βββ Allow outbound to internet
βββ Allow outbound to all subnets
Step 7: Test Traffic Flows
Scenario 1: Prod VM to Internet
ββ ProdVM (10.1.2.10) β Destination 8.8.8.8
ββ Routing: 0.0.0.0/0 β Firewall (10.0.2.4)
ββ Path: Prod App β Hub Firewall β Internet
ββ Firewall: Inspect traffic β
ββ Result: Allowed (if rule permits) β
Scenario 2: Prod VM to On-Premises
ββ ProdVM (10.1.2.10) β Server (192.168.1.50)
ββ Routing: 192.168.0.0/16 β VPN Gateway (via hub peering)
ββ Path: Prod App β Hub VPN Gateway β VPN Tunnel β On-prem
ββ Gateway: Encrypt/decrypt β
ββ Result: Connected β
Scenario 3: Prod VM to Dev VM
ββ ProdVM (10.1.2.10) β DevVM (10.2.2.10)
ββ Routing: 10.2.0.0/16 β Firewall (10.0.2.4)
ββ Path: Prod App β Hub Firewall β Dev App
ββ Firewall: Can block cross-environment traffic β
ββ NSG (Dev App): Allows or blocks from firewall
ββ Result: Controlled by firewall rules β
Scenario 4: Admin Troubleshooting
ββ Admin in Hub Management subnet (10.0.4.10)
ββ Needs to check Prod DB (10.1.3.20)
ββ Routing: 10.1.0.0/16 β Peered (direct)
ββ NSG: Prod DB may or may not allow management IPs
ββ Result: Depends on NSG policy β
Common Mistakes (What NOT to Do)
β Mistake 1: Peering All Spokes to Each Other
Wrong
Create peerings:
ββ Hub β Prod
ββ Hub β Dev
ββ Prod β Dev (DIRECT PEERING!)
ββ Prod β Test
ββ Dev β Test
ββ Too many connections to manage β
Problems:
ββ Lost central inspection (ProdβDev bypasses firewall)
ββ Hard to scale (add 4th spoke = 3 new peerings)
ββ Security risk (no firewall filter)
ββ Maintenance nightmare β
Fix
Only peer spokes to hub:
ββ Hub β Prod β
ββ Hub β Dev β
ββ Hub β Test β
ββ Spokes don't talk directly
All spoke-to-spoke traffic routes
through firewall β
Why it fails: Defeats the purpose of hub-and-spoke architecture.
β Mistake 2: Forgetting Gateway Transit Settings
Wrong
Peering created: Hub β Prod
ββ "Allow gateway transit": NOT enabled on hub
ββ "Use remote gateway": Enabled on prod
ββ Prod VM tries to reach on-premises
ββ Traffic routes to hub, but hub can't
β forward to VPN
ββ Result: Connection fails β
Fix
Peering: Hub β Prod
ββ Hub side: "Allow gateway transit" = YES
ββ Prod side: "Use remote gateway" = YES
ββ Both must be set correctly
ββ Now prod can use hub's VPN β
Why it fails: Both sides of the peering need compatible settings.
β Mistake 3: Non-Transitive Routing
Wrong
Assumption: "If Hub β Prod and Hub β Dev
are peered, Prod and Dev can talk"
Reality:
ββ Peering is non-transitive
ββ A β B and B β C doesn't mean
β A β C automatically β
ββ Prod can reach Hub
ββ Dev can reach Hub
ββ But ProdβDev traffic doesn't
β automatically work
ββ Need explicit UDR routing
through firewall β
Fix
Configure UDRs in spokes:
ββ Prod Route Table: 10.2.0.0/16 β Firewall
ββ Dev Route Table: 10.1.0.0/16 β Firewall
ββ Now traffic goes: Prod β Firewall β Dev
ββ Firewall can inspect and allow/block
ββ Transitive connectivity achieved β
Why it fails: Peering doesn't transitively connect spokes.
β Mistake 4: Overlapping Address Spaces
Wrong
Hub: 10.0.0.0/16
Prod: 10.0.0.0/16 (SAME!)
Dev: 10.2.0.0/16
Try to peer:
ββ Hub β Prod: FAILS (overlapping) β
ββ Hub β Dev: OK
ββ Cannot achieve full hub-spoke β
Fix
Plan CIDR ranges upfront:
ββ Hub: 10.0.0.0/16
ββ Prod: 10.1.0.0/16 β
ββ Dev: 10.2.0.0/16 β
ββ Test: 10.3.0.0/16 β
ββ On-prem: 192.168.0.0/16
ββ All peering works β
Why it fails: Overlapping addresses cause routing ambiguity.
Hub-Spoke Checklist
Planning
β‘ Identify hub location (central region,
on-premises connection point)
β‘ Plan CIDR ranges (hub + all spokes,
no overlaps)
β‘ Decide on shared services (VPN,
firewall, DNS)
β‘ Document traffic flow policies
(who talks to whom)
Hub Setup
β‘ Create Hub VNet with planned CIDR
β‘ Create GatewaySubnet (for VPN/ExpressRoute)
β‘ Create AzureFirewallSubnet (if using firewall)
β‘ Create SharedServicesSubnet (DNS, shared resources)
β‘ Deploy VPN/ExpressRoute Gateway (if hybrid needed)
β‘ Deploy Azure Firewall (if centralized inspection needed)
β‘ Create Hub Route Table (internet β firewall,
on-prem β gateway)
Spoke Setup
β‘ Create Spoke VNets (non-overlapping CIDR)
β‘ Create subnets (Web, App, DB or similar tiers)
β‘ Create Spoke Route Tables (internet/other-spokes/
on-prem β firewall)
Peering
β‘ Peer Hub β Spoke-1
ββ Hub: "Allow gateway transit" = YES
ββ Spoke-1: "Use remote gateway" = YES
β‘ Peer Hub β Spoke-2
ββ Hub: "Allow gateway transit" = YES
ββ Spoke-2: "Use remote gateway" = YES
β‘ Peer Hub β Spoke-3 (repeat pattern)
β‘ Verify: Peering status = Connected
NSG Rules & Testing
β‘ Hub: Allow traffic from all spokes and on-prem
β‘ Spokes: Allow traffic from hub firewall only
β‘ Spokes: Allow internal subnet traffic (WebβAppβDB)
β‘ Spokes: Block direct spoke-to-spoke (force through hub)
β‘ Test spoke β hub connectivity (peering works)
β‘ Test spoke β internet (routes through firewall)
β‘ Test spoke β on-prem (uses hub gateway)
β‘ Test spoke β other-spoke (routes through firewall)
β‘ Test firewall rules (inspect and allow/block)
How This Connects to Other Topics
Related to Module 01 (Identity & Governance)
- RBAC: Only network admins can create peerings, modify hub routes
- Policy: Enforce hub-and-spoke topology for all VNets
Related to Module 02 (Storage)
- Storage Access: Spokes access storage through hub firewall
Related to Module 03 (Compute)
- VM Communication: VMs in different spokes communicate via hub
Related to Module 05 (Monitor)
- Monitor Hub: Track traffic through firewall and gateways
- Network Watcher: Diagnose spoke-to-spoke connectivity issues
See It In Action
Associated labs:
Suggested learning sequence:
- β
Read VNets & Subnets
- β
Read NSGs
- β
Read Routing Fundamentals
- β
Read VNet Peering
- β
Read VPN & ExpressRoute
- β
Read this doc (Hub-Spoke Topology)
- β
Work through Labs 12-15 (implement hub-spoke)
Key Takeaways
π‘ Summary
- Hub-Spoke = scalable network architecture (one hub, many spokes)
- Hub contains shared services (VPN, firewall, DNS, shared resources)
- Spokes don't peer directly (all traffic through hub for inspection)
- Gateway transit = spokes use hub's VPN/ExpressRoute
- Routing is key = UDRs direct spoke-to-spoke through firewall
- Non-transitive peering = AβB and BβC doesn't mean AβC
- Plan CIDR upfront = No overlapping address spaces
- NSGs enforce policy = Control which traffic is allowed
Next Steps
- Learn: Read this doc (you're here)
- Design: Draw your hub-spoke topology (CIDR, subnets, peerings)
- Implement: Work through Labs 12-15 (hands-on setup)
- Monitor: Track traffic flows through hub firewall
- Scale: Add spokes as new business units need Azure environments