Skip to main content
Gateway Transit is an Azure networking pattern that lets multiple peered virtual networks share a single virtual network gateway located in a central hub VNet. Instead of deploying a VPN gateway in every VNet, spokes can route traffic through the hub gateway using VNet peering and gateway transit. This article explains the concept, compares it to the traditional approach, and walks through a short point-to-site (P2S) demo that shows accessing a VM in a peered VNet via the hub gateway. Why use gateway transit?
  • Reduces the number of VPN gateways you must deploy and manage.
  • Centralizes connectivity and routing configuration in a hub.
  • Lowers operational complexity and costs.
  • Frees up resources in spoke VNets (no gateway required in each spoke).
  • Supports hybrid connectivity patterns such as site-to-site and point-to-site through the same hub gateway.

Traditional approach vs. gateway transit

Traditional (per-VNet gateways)
  • Requires a VPN gateway in each VNet for site-to-site connections.
  • Higher cost and more management overhead.
  • Greater risk of configuration drift and misconfiguration.
Gateway transit (hub-and-spoke)
  • One centralized gateway in a hub VNet.
  • Spokes use the hub gateway through VNet peering.
  • Simplified routing, centralized security controls, and cost savings.
A "Gateway Transit" network diagram showing three VNets (VNet-A, VNet-B, VNet-C) each containing multiple virtual machines and connected via site-to-site VPN links to an on‑premises network through a central transit gateway. Each VNet includes a padlock icon indicating secured connections.
This diagram shows the common pattern: VNet A, VNet B, and VNet C (spokes) peer with a hub VNet which hosts a single virtual network gateway. The on-premises site connects to the hub gateway with a site-to-site VPN (or ExpressRoute). Spokes send traffic to the hub gateway via peering. This pattern typically uses VNet peering with two key options:
  • Allow gateway transit: enabled on the hub peering to allow spokes to use the hub’s gateway.
  • Use remote gateways: enabled on the spoke peering so the spoke sends gateway-bound traffic to the hub.

Hub-spoke configuration and gateway transit

The hub-spoke architecture is widely recommended for scalable Azure network topologies and is commonly used in landing zones and enterprise designs:
  • Centralized routing, inspection, and connectivity.
  • Simplified hybrid connectivity (S2S and P2S).
  • Easier to apply consistent network security policies.
I’ll demonstrate gateway transit with a quick point-to-site (P2S) example. The scenario:
  • Hub VNet contains the virtual network gateway with a P2S configuration.
  • Spoke VNet (where a VM resides) is peered to the hub and configured to use the remote gateway.
  • A client (laptop) connects via the Azure VPN Client to the hub gateway and accesses a private IP in the spoke VNet.
First, I created a P2S configuration on the virtual network gateway and used Microsoft Entra ID (Azure AD) authentication for the VPN clients. You can configure the P2S settings in the Azure portal, including tunnel types, address pool, and authentication method.
A screenshot of the Microsoft Azure portal showing the "vpn-prod-demo | Point-to-site configuration" page for a virtual network gateway. It displays settings like address pool, tunnel type, authentication type, and Azure Active Directory tenant/audience fields.
Next, make sure the peering relationships between the hub and spoke are in place. I added a peering from the spoke VNet (vnet-eus) to the hub VNet that hosts the gateway.
Screenshot of the Microsoft Azure portal showing the "vnet-eus" virtual network Peerings page with two peerings listed (wus-eus-link and eus-hub), both connected; gateway transit is enabled for one.
Open the peering configuration to verify the required options are enabled. In my setup:
  • On the spoke-to-hub peering: “Use remote gateways” is enabled so the spoke knows to route gateway-bound traffic to the hub.
  • On the hub-to-spoke peering: “Allow gateway transit” is enabled to let the hub’s gateway be used by the spoke.
  • If you have network virtual appliances (NVAs) in-line, you may also need “Allow forwarded traffic.”
A screenshot of the Microsoft Azure portal showing the VNet peering settings for "eus-hub" with peering status "Fully Synchronized" and checkboxes enabled to allow access, forwarded traffic, and gateway use; the remote VNet ID and address space 10.0.0.0/16 are shown. Save and Cancel buttons are visible at the bottom.
Note: A virtual network cannot both host its own VPN gateway and be configured to “Use remote gateways.” If you enable “Use remote gateways” on a VNet, you cannot deploy a gateway in that same VNet until you disable that setting.
To enable gateway transit correctly:
  • On the spoke VNet peering to the hub, enable Use remote gateways.
  • On the hub VNet peering to the spoke, enable Allow gateway transit.
  • If you need traffic to flow through network virtual appliances, enable Allow forwarded traffic on the appropriate peerings.

Demo: P2S VPN client → access VM in peered spoke

  1. Configure P2S on the hub gateway with Azure AD authentication and an address pool.
  2. Install and configure the Azure VPN Client on your laptop and authenticate via Microsoft Entra ID.
  3. Connect the client; the client will receive routes for the hub and peered spoke VNets (for example, the spoke address space 192.168.0.0/24).
  4. From your laptop, SSH to the private IP of the VM in the spoke VNet. Traffic will traverse the P2S connection to the hub gateway, then follow the peering to the spoke.
Example SSH and connectivity verification from the client machine:
This confirms the client’s P2S connection to the hub gateway can reach a VM in a peered spoke VNet using the VM’s private IP — the spoke’s traffic transits the peering to the hub gateway and is routed appropriately.

When to use gateway transit

  • Use gateway transit when you have multiple VNets that must access the same on-premises network or shared services and you want to centralize connectivity.
  • Avoid placing gateways in every VNet when you want to reduce cost and simplify management.
  • If you need isolation (separate gateways per VNet for security or performance reasons), consider per-VNet gateways instead.

Watch Video