Ever built a beautiful pair of Azure VNets, peered them, and then … nothing. One side can’t talk to the other. It’s like building two suburbs with no connecting roads nobody’s able to drop around for a brew.
This post is your roadmap for how routing works in VNet peering, both within a region and globally. We’ll look at how route propagation works (and where it doesn’t), plus those subtle peering settings that make the difference between smooth traffic and a silent timeout.
Whether you’re building a hub-and-spoke architecture or just linking services across VNets, this is the guide to help you avoid routing pitfalls and get your packets home safe.
What is VNet Peering?
VNet peering connects two Azure virtual networks, letting resources talk to each other over the Microsoft backbone network, fast and low-latency.
There are two flavours:
- Intra-region peering (within the same Azure region)
- Global VNet peering (across different regions)
Peering is non-transitive which means VNets don’t automatically route through each other so routing must be deliberate. It doesn’t involve public IP traffic, just private addressing and internal routing.
How Routing Works with VNet Peering
When VNets are peered, Azure automatically adds system routes so that each VNet can route traffic to the other’s address space.
But there’s nuance, especially when it comes to gateways, UDRs, and route propagation.
Peering Options That Matter:
-
Allow forwarded traffic
→ Required if traffic is coming from a third VNet, or through a NVA (like a firewall). -
Use remote gateway
→ Lets a spoke VNet use the hub’s VPN/ExpressRoute Gateway.
Routing Propagation:
- System routes between peered VNets are added automatically.
- UDRs (User Defined Routes) override system routes as expected.
- Propagation from a remote gateway works only if:
- The hub VNet has a gateway.
- The spoke peering has Use remote gateway: Enabled.
- The hub peering has Allow gateway transit: Enabled.
Real-World Use Case: Hub and Spoke Starter
You’ve got:
- Hub VNet with a VPN Gateway and an Azure Firewall
- Spoke VNet hosting workloads
- You want spoke traffic to route via the firewall for internet or VPN for on-prem traffic
Here’s where the peering/router settings get real handy.
Implementation: Peering & Routing via Bicep
Let’s walk through Bicep templates to:
- Deploy a Hub and Spoke VNet
- Peer them correctly
- Route spoke traffic through the firewall in the hub
Architecture Overview
1. Define VNets
|
|
2. Peer Hub ↔ Spoke
|
|
3. Add Route Table in Spoke
You’ll need to push a UDR to the AppSubnet so that traffic destined for 0.0.0.0/0 routes to the Azure Firewall Private IP (assume 10.0.0.4 here).
|
|
Gotchas & Edge Cases
- Black holes from partial peering config: If Use remote gateway is enabled on one side but Allow gateway transit is not enabled on the other, your routes won’t propagate, and the traffic goes nowhere.
- UDRs always win: If you set a UDR on a subnet, it overrides any propagated system or BGP routes—even if that UDR is broken.
- Global peering latency: Still fast, still private, but slightly higher latency than intra-region.
- No transitive peering: If VNet A peers with B, and B with C, A can’t reach C unless directly peered.
Best Practices
- Always validate both sides of a peering connection. Peering is a two-way street.
- Use Allow forwarded traffic when routing via network virtual appliances or needing spoke-to-spoke via hub routes.
- For hub-and-spoke with VPN/ER gateways, Enable one, Use on the other.
- Document peering topologies—spaghetti peerings are hard to unravel later.