Peering and routing

AZ-104 Azure AdministratorNetworkingAbout 25 minutesBy Cloud Hands On

Connect VNets with peering, design hub and spoke, steer traffic with user-defined routes, and troubleshoot where packets go.

In this lesson you'll learn

1. VNet peering

New to peering? Start here

By default, two VNets are isolated, like two separate buildings. Peering builds a private corridor between them. Traffic stays on the Microsoft backbone, never touches the internet, and VMs talk using private IPs as if they were on one network.

  • Regional peering connects VNets in the same region. Global peering connects VNets in different regions.
  • Peering is created as a pair of links, one from each side. Both must show Connected.
  • Address spaces must not overlap. See the subnetting lesson.
  • Peerings work across subscriptions and even across Entra tenants.

2. Peering is not transitive

VNet A peers with B, and B peers with C, but A cannot reach C VNet A VNet B VNet C No connection: A cannot reach C through B peeredpeered Fix: peer A and C directly, or route through a firewall or NVA in B with UDRs
This is one of the most tested networking facts on AZ-104.

3. Hub and spoke with gateway transit

Large organisations put shared services (VPN gateway, firewall, Bastion) in a central hub VNet. Workload VNets, the spokes, peer only with the hub.

Hub VNet with a VPN gateway connected to on-premises, and two spokes using the hub gateway Hub VNetVPN gatewayAzure FirewallAllow gateway transit Spoke: webUse remote gateways Spoke: dataUse remote gateways Head officeon-premises VPN
Spokes reach on-premises through the hub's single gateway.
Peering settingSet onMeaning
Allow gateway transitHub sideLets peers use this VNet's VPN or ExpressRoute gateway
Use remote gatewaysSpoke sideSends this VNet's on-premises traffic through the peer's gateway. The spoke must not have its own gateway.
Allow forwarded trafficSide receiving forwarded packetsAccepts traffic that did not originate in the peer, for example traffic passing through an NVA

Exam focus

Remember the pairing: the hub allows transit and the spoke uses remote gateways. If a question swaps them, it is wrong. After changing peering topology, point-to-site VPN clients must download and reinstall the client package to learn the new routes.

Hybrid connections at a glance

Site-to-site VPN connects an office network to Azure over an encrypted tunnel on the internet. Point-to-site VPN connects individual laptops. ExpressRoute is a private circuit through a provider that never touches the internet. Gateways always live in a subnet named GatewaySubnet.

4. How Azure routes traffic

Every subnet gets system routes automatically: traffic within the VNet stays local, peered VNet ranges go over the peering, and 0.0.0.0/0 goes to the internet. You override them with a route table of user-defined routes (UDRs) associated with a subnet.

Next hop typeSends traffic to
Virtual applianceAn NVA or Azure Firewall private IP (needs IP forwarding on the NVA's NIC)
Virtual network gatewayA VPN gateway
Virtual networkStays inside the VNet
InternetOut to the internet
NoneDrops the traffic
Traffic from the app subnet follows a UDR 0.0.0.0/0 to the firewall, then out to the internet app subnetroute table attached Azure Firewall10.0.1.4 Internet UDR 0.0.0.0/0next hop 10.0.1.4
Forced inspection: every outbound packet passes the firewall first.
Which route wins? The longest prefix match. If routes exist for 10.0.0.0/16 and 10.0.5.0/24, traffic to 10.0.5.9 uses the /24 because it is more specific. If prefixes tie, a UDR beats BGP, and BGP beats system routes.

Example

SS Kaiser's auditors require every outbound connection to be logged. The team deploys Azure Firewall in the hub. They add a UDR for 0.0.0.0/0 with next hop "Virtual appliance" pointing at the firewall's private IP, and associate that route table with every spoke subnet.

5. Troubleshooting routing

  1. Network Watcher Next hop: enter a source VM and destination IP to see the next hop type and which route table was used.
  2. Effective routes on a NIC: shows every route applied, from all sources, after combining them.
  3. Check the peering status on both sides. It must be Connected, not Initiated.
  4. If traffic goes through an NVA, confirm IP forwarding is enabled on its NIC.

Exam traps to remember

  • Peering is non-transitive, whether regional or global.
  • Overlapping address spaces block peering completely.
  • A route table is associated with subnets, not with VMs or NICs.
  • A UDR to an NVA fails silently if IP forwarding is not enabled on the NVA's NIC.

Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-104 Azure Administrator app.

Practise in the app

Keep going