Lesson 2 of 5 Azure Virtual Networks and Routing

Connecting Virtual Networks with Peering

This lesson explains regional and global peering, peering settings and why peering is not transitive.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how peering links and statuses work.
  • Explain the peering settings, including gateway transit.
  • Explain how to connect spokes that are not peered with each other.

Regional and global peering

Regional peering connects VNets in the same region; global peering connects VNets in different regions. Both use the Microsoft backbone with no gateways, encryption devices or public internet in the path, and both are billed for inbound and outbound data transfer (global peering at a higher rate). VNets can be peered across subscriptions and Microsoft Entra tenants when the administrator has the Network Contributor role (or equivalent permissions) on both.

A peering consists of two links, one on each VNet. The portal creates both when the administrator has access to both VNets; otherwise each side is created separately. The peering status is Initiated after the first link and Connected when both exist. If one link is deleted, the other shows Disconnected and must be recreated. Address spaces must not overlap, and after an address space change the peering must be synced.

True or false

How peering connects VNets

Exam skills 4.1.2

Check the facts about regional and global peering.

Log in to try this activity Interactive activities are free with an account.

Peering settings

Each link has settings that control what traffic flows. The following table describes them.

SettingEffectTypical use
Allow access to the remote VNetAllows traffic between the VNets (default on)Disable to block traffic without deleting the peering
Allow forwarded traffic from the remote VNetAccepts traffic that did not originate in the peered VNetHub NVAs or firewalls forwarding spoke traffic
Allow gateway or route server in this VNet to forward trafficGateway transit: the peered VNet can use this VNet's gatewaySet on the hub
Use the remote VNet's gateway or route serverUses the peered VNet's gateway for on-premises routesSet on the spoke; the spoke must not have its own gateway
Sort into groups

Which side, which setting?

Exam skills 4.1.2

Spokes use the hub's VPN gateway and a firewall in the hub. Choose the setting for each requirement.

Log in to try this activity Interactive activities are free with an account.

Peering is not transitive

Peering connects exactly two VNets. In a hub-and-spoke design where Spoke1 and Spoke2 are both peered with Hub, Spoke1 cannot reach Spoke2 through the hub by default. Options are: peer the spokes directly; deploy an Azure Firewall or NVA in the hub and add UDRs in each spoke that send traffic for the other spoke to it (with forwarded traffic allowed); use a VPN gateway in the hub for spoke-to-spoke routing; or use Azure Virtual Network Manager connectivity configurations or Virtual WAN, which manage the topology for you. Gateway transit, by contrast, does let spokes reach on-premises through the hub's gateway.

The following diagram shows the peering settings on each side that let a spoke use the hub's VPN gateway.

Letting a peered spoke use the hub's VPN gateway. Gateway transit is enabled on the hub's peering link and use remote gateways on VNet-App's link, so VNet-App learns the on-premises routes from the hub gateway; on-premises must also include VNet-App's address space. Allow forwarded traffic is for NVAs, not for this.
The scenario is illustrative.
Select all that apply

Connecting two spokes

Exam skills 4.1.2

Spoke1 and Spoke2 are both peered with Hub. Select every option that lets Spoke1 reach Spoke2.

Log in to try this activity Interactive activities are free with an account.
Worked example

Sharing a VPN gateway

VNet-Hub has a VPN gateway connected to on-premises. VNet-App is peered with VNet-Hub and has no gateway. VMs in VNet-App cannot reach on-premises servers, although they reach VMs in VNet-Hub. What should you change?

Enable gateway transit on the hub's peering link (allow the gateway in this VNet to forward traffic) and use remote gateways on VNet-App's link. VNet-App then learns the on-premises routes from the hub gateway, and the on-premises side must also advertise or include VNet-App's address space. Allowing forwarded traffic is for NVAs, and a second gateway in VNet-App would be unnecessary cost and would prevent using the remote gateway.

Check yourself

A peering shows the status Initiated. What does it mean?

Show answer

Only one of the two peering links exists; the link on the other VNet must be created.

Exam Tips

Remember for the exam

  • Peering is not transitive; spokes need direct peering or routing through a hub NVA or firewall.
  • Gateway transit on the hub plus use remote gateways on the spoke shares a VPN gateway.
  • Both links must exist for the status to be Connected.
  • Address spaces must not overlap; sync the peering after changing them.