Hybrid networking and hub-and-spoke on Azure
Compare VPN Gateway and ExpressRoute, place Azure Firewall in a hub, and prove routing with Network Watcher.
By Invicly Tech, , in Microsoft Azure Cloud Engineering. About 13 minutes to read.
In short
Hybrid networking joins your on-premises sites to Azure. VPN Gateway sends encrypted IPsec tunnels over the internet, while ExpressRoute is a private circuit through a connectivity provider. Most organisations then use a hub-and-spoke design: shared gateways and Azure Firewall live in a hub VNet, and workloads live in spoke VNets peered to it.
Think of it like this: The hub is a central train station with one security check; spokes are suburban lines, and every journey between suburbs changes trains at the station.
Explained simply
Most companies do not move everything to the cloud at once. Their offices and data centres need to reach Azure, and Azure workloads need to reach systems still on-premises. Hybrid networking is how you join those two worlds with private IP addresses.
There are two main ways. VPN Gateway builds an encrypted tunnel across the normal internet; it is quick to set up and costs less. ExpressRoute is a private line from a connectivity provider straight into Microsoft's network; it takes weeks to order but gives steadier speed and latency.
As more workloads arrive, teams usually adopt hub and spoke. The hub is one central VNet that holds shared things: the gateway to on-premises, Azure Firewall and DNS. Each workload gets its own spoke VNet, peered to the hub. Spokes send their traffic through the hub, so security rules live in one place.
Hybrid networks fail in confusing ways, so you need evidence instead of guesses. Azure Network Watcher has tools that show which route a packet takes, which security rule allowed or blocked it, and whether a connection really succeeds.
Press Play on a diagram to walk through it one step at a time.
- 1On-premises
Data centre or office network, 192.168.0.0/16
- 2Gateway
VPN Gateway or ExpressRoute gateway in GatewaySubnet
- 3Hub VNet
Azure Firewall, Bastion, DNS resolver
- 4Peering
Hub to each spoke, with gateway transit
- 5Spoke VNets
Workloads; route 0.0.0.0/0 to the firewall
- IPsec over the public internet
- Encrypted by default
- Set up in under an hour
- Throughput limited by SKU
- Lower cost
- Private circuit via a provider
- Not encrypted by default
- Weeks to order a circuit
- Predictable latency, higher bandwidth
- Higher cost
- Office PC 192.168.1.20 to VPN Gateway: Packet through the IPsec tunnel1Packet through the IPsec tunnel
- VPN Gateway to Azure Firewall: GatewaySubnet UDR sends 10.1.0.0/16 to the firewall2GatewaySubnet UDR sends 10.1.0.0/16 to the firewall
- Azure Firewall to Spoke VM 10.1.2.4: Network rule allows TCP 443, forward over peering3Network rule allows TCP 443, forward over peering
- Spoke VM 10.1.2.4 to Azure Firewall: Reply: spoke UDR sends 192.168.0.0/16 to the firewall4Reply: spoke UDR sends 192.168.0.0/16 to the firewall
- Azure Firewall to VPN Gateway: Return traffic on the same stateful flow5Return traffic on the same stateful flow
- VPN Gateway to Office PC 192.168.1.20: Reply through the tunnel6Reply through the tunnel
In depth
VPN Gateway in detail
A VPN gateway is a pair of managed instances in a subnet that must be named GatewaySubnet; /27 or larger is recommended. Site-to-site (S2S) connects an on-premises VPN device using IPsec and IKE; a local network gateway object describes that device's public IP and address ranges. Point-to-site (P2S) lets single laptops connect, and can authenticate users with Microsoft Entra ID.
The SKU sets throughput and tunnel count, so check the current table before choosing. Use zone-redundant SKUs in regions with availability zones, and consider active-active mode so both instances carry tunnels. BGP lets the gateway learn on-premises routes dynamically instead of listing them by hand. A gateway takes 30 to 45 minutes to create and bills by the hour whether used or not.
- Subnet must be named GatewaySubnet; nothing else goes in it
- Local network gateway = your on-premises device and ranges
- Active-active and zone-redundant for resilience
- Enable BGP for dynamic routes
ExpressRoute in detail
ExpressRoute is a circuit you order through a connectivity provider, or directly from Microsoft with ExpressRoute Direct. Your traffic travels over the provider's private network, not the internet. Private peering carries traffic to your VNets; Microsoft peering reaches Microsoft public services such as Microsoft 365, where approved.
A circuit links to an ExpressRoute virtual network gateway in your hub's GatewaySubnet. Each circuit has two connections for redundancy, but both may share a location, so critical sites add a second circuit in another peering location. Traffic is not encrypted by default: use MACsec on ExpressRoute Direct or run IPsec VPN over the circuit when encryption in transit is required. Many teams keep a site-to-site VPN as a cheaper backup path.
- Ordered through a provider; plan weeks, not hours
- Private peering for VNets; Microsoft peering for public Microsoft services
- Not encrypted by default
- Site-to-site VPN as backup is common
Designing hub and spoke
The hub holds shared, centrally run services: the gateway, Azure Firewall, Azure Bastion and the DNS Private Resolver. Each spoke holds one workload or environment and is owned by its team. Peering connects each spoke to the hub. On the hub side of each peering, turn on allow gateway transit; on the spoke side, turn on use remote gateways. The spoke then learns on-premises routes through the hub's gateway.
Spokes do not talk to each other directly, because peering is not transitive. To allow spoke-to-spoke traffic, send it through the hub firewall with user-defined routes, which also lets you log and filter it. Azure Virtual WAN is a managed alternative where Microsoft runs the hub routing for you; it suits many branches and regions, but gives less hands-on control.
- 1VM in spoke 1
Sends to 10.2.1.4
- 2Spoke 1 route table
10.2.0.0/16 next hop 10.0.1.4
- 3Azure Firewall
Network rule allows TCP 443
- 4Hub to spoke 2 peering
System route to the peered VNet
- 5VM in spoke 2
Replies along the same path
Placing and routing through Azure Firewall
Azure Firewall sits in the hub in a subnet named AzureFirewallSubnet, at least /26. It comes in Basic, Standard and Premium SKUs; Premium adds TLS inspection and signature-based intrusion detection. Rules live in a firewall policy: DNAT rules publish inbound ports, network rules filter by IP, port and protocol, and application rules filter outbound HTTP and HTTPS by domain name.
Traffic only reaches the firewall if routes send it there. In each spoke subnet, add a route for 0.0.0.0/0 and for the other spokes' ranges with next hop VirtualAppliance and the firewall's private IP. For traffic from on-premises to spokes, add a route table on GatewaySubnet pointing spoke ranges at the firewall. Routes must be symmetric: if traffic goes out through the firewall but returns a different way, the stateful firewall drops it.
- AzureFirewallSubnet, at least /26
- DNAT, network and application rules in a firewall policy
- Spoke UDR: 0.0.0.0/0 to the firewall private IP
- GatewaySubnet UDR: spoke ranges to the firewall
- Keep paths symmetric
Gathering Network Watcher evidence
Network Watcher is enabled per region automatically. Its tools answer specific questions. Next hop tells you, for a VM and a destination IP, the next hop type and address and which route table chose it. IP flow verify tells you whether an NSG allows a five-tuple flow and names the rule. Connection troubleshoot tries a real TCP connection and shows each hop and where it failed. Packet capture records traffic on a VM for deeper study.
For ongoing evidence, enable virtual network flow logs, the successor to NSG flow logs (new NSG flow logs can no longer be created, and they retire on 30 September 2027), and send them to a storage account and Traffic Analytics in Log Analytics. Keep the outputs: a ticket that says next hop VirtualAppliance 10.0.1.4 and IP flow verify Allow by rule allow-443 is far stronger than it should work.
- Next hop: where does this packet go?
- IP flow verify: which NSG rule decides?
- Connection troubleshoot: does a real connection succeed?
- VNet flow logs: what flowed over time?
- Packet capture: what is on the wire?
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Compare VPN Gateway and ExpressRoute~35m
- 2Design hub and spoke~35m
- 3Place Azure Firewall~35m
- 4Route spoke traffic through the hub~35m
- 5Gather Network Watcher evidence~35m
Key points
- Gateways need a subnet named GatewaySubnet; Azure Firewall needs AzureFirewallSubnet (at least /26).
- Spokes use the hub's gateway through peering options: allow gateway transit on the hub, use remote gateways on the spoke.
- A user-defined route sends spoke traffic to the firewall's private IP with next hop type VirtualAppliance.
- Spoke-to-spoke traffic only works through the hub if routes and firewall rules allow it.
- Network Watcher tools such as next hop and IP flow verify prove where a packet goes and why.
Key terms
Tap a card to flip it. 0/6 known
Examples
az network route-table create -g rg-spoke1 -n rt-spoke1
az network route-table route create -g rg-spoke1 --route-table-name rt-spoke1 \
-n default-to-fw --address-prefix 0.0.0.0/0 \
--next-hop-type VirtualAppliance --next-hop-ip-address 10.0.1.4
az network vnet subnet update -g rg-spoke1 --vnet-name vnet-spoke1 -n snet-app \
--route-table rt-spoke1Send all spoke traffic to the hub firewall at 10.0.1.4.
Proving that spoke traffic uses the firewall
Security asks for evidence that vm-spoke1 reaches the internet only through Azure Firewall. Step 1: run next hop from the VM's IP to a public address; expect VirtualAppliance with the firewall's private IP 10.0.1.4. Step 2: show the VM's effective routes and find 0.0.0.0/0 with source User. Step 3: check the firewall logs in Log Analytics for the VM's source IP. Save all three outputs in the ticket. If next hop shows Internet, the route table is not attached to the VM's subnet.
az network watcher show-next-hop -g rg-spoke1 --vm vm-spoke1 \
--source-ip 10.1.2.4 --dest-ip 203.0.113.10
# Expect: nextHopType VirtualAppliance, nextHopIpAddress 10.0.1.4
az network nic show-effective-route-table -g rg-spoke1 -n vm-spoke1VMNic -o table
az network watcher test-connectivity -g rg-spoke1 --source-resource vm-spoke1 \
--dest-address www.example.com --dest-port 443Choosing VPN or ExpressRoute for Fabrikam
Fabrikam has one head office and moves an ERP system to Azure. Users need steady response times, nightly batch jobs move 2 TB, and the network team wants a private path. Step 1: list needs: predictable latency, high nightly volume, private connectivity. Step 2: ExpressRoute fits these better than an internet VPN. Step 3: the circuit takes weeks to order, so start with a site-to-site VPN to unblock migration testing. Step 4: once ExpressRoute is live, keep the VPN as a failover path. Step 5: add IPsec over ExpressRoute if policy demands encryption in transit.
Quick reference
- GatewaySubnet for VPN and ExpressRoute gateways, /27 or larger recommended
- AzureFirewallSubnet for Azure Firewall, at least /26
- Hub peering: allow gateway transit; spoke peering: use remote gateways
- Spoke UDR: 0.0.0.0/0 next hop VirtualAppliance at the firewall private IP
- ExpressRoute is private but not encrypted by default; add MACsec or IPsec
- az network watcher show-next-hop proves which route a packet takes
- az network watcher test-ip-flow names the NSG rule that allows or denies a flow
- Use VNet flow logs (successor to NSG flow logs) for traffic history
Common mistakes
- Assuming ExpressRoute traffic is encrypted; add MACsec or IPsec if you need encryption in transit.
- Adding a 0.0.0.0/0 route to the firewall but forgetting the firewall rules, so all traffic is dropped.
- Overlapping spoke address ranges with on-premises, which breaks routing over the gateway.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Design-only: draw an address plan for a hub, two spokes and an office on 192.168.0.0/16, including GatewaySubnet, AzureFirewallSubnet and AzureBastionSubnet.
- Exercise 2medium
Write the CLI to peer spoke1 with the hub so it can use the hub gateway, and a route table that sends spoke1 internet traffic to the firewall at 10.0.1.4.
- Exercise 3hard
Build a small hub with Azure Firewall Basic and one spoke VM, route the spoke through the firewall, and collect next hop and connectivity evidence. Cost: the firewall and VM bill hourly; finish in one sitting and delete everything. Without a budget, write the expected outputs instead.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is ExpressRoute always better than VPN?
- No. ExpressRoute gives steadier performance and higher bandwidth but costs more and takes weeks to set up. Many small and medium sites run well on site-to-site VPN, and larger ones keep VPN as a backup.
- Should I use Azure Virtual WAN instead of building my own hub?
- Virtual WAN suits organisations with many branches or regions that want Microsoft to manage hub routing. A self-built hub gives more control and is easier to learn on. Both follow the same hub-and-spoke idea.
- How do I practise hybrid networking without an on-premises office?
- Use a second VNet as a fake on-premises site and connect two VPN gateways with a VNet-to-VNet connection, or do the design-only exercises. Gateways bill hourly, so delete them as soon as you finish.
- Why do I need a firewall if I already have NSGs?
- NSGs filter by IP and port at each subnet. Azure Firewall adds central logging, filtering by domain name, threat intelligence and, in Premium, TLS inspection, all managed in one place for every spoke.