VNet Connectivity & Routing
Peering · gateway transit · service chaining · Virtual Network Manager · UDRs · forced tunneling · Route Server · NAT Gateway
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
VNet peering
| Type | Connects |
|---|---|
| Virtual network peering | Virtual networks in the same Azure region |
| Global virtual network peering | Virtual networks across Azure regions |
| Peering setting | Default | Effect |
|---|---|---|
| Allow the peered VNet to access this VNet | Selected | Allows traffic between the two networks. Clear it to block traffic instead of deleting the peering. |
| Allow forwarded traffic | Not selected | Lets this VNet receive traffic that was forwarded from other networks, for example by an NVA. It doesn't create any UDRs or NVAs. |
| Allow gateway or route server to forward traffic | Not selected | Lets the peered VNet receive traffic from this VNet's gateway or route server. |
| Use the remote gateway or route server | Not selected | Spoke uses the hub's gateway. Needs a remote gateway or route server, and the hub must allow its gateway to forward traffic. Set it in only one of the two peerings. Not possible if the VNet already has its own gateway. |
- Both directions are needed. When you peer two Resource Manager VNets, a peering must be configured in each one. The first peering shows Initiated; the peering is established only when both show Connected.
- Address spaces must not overlap.
- Peering isn't transitive. If VNet1 is peered with VNet2 and VNet2 with VNet3, VNet1 and VNet3 can't talk. Create an explicit peering between them, or go through an NVA in the hub.
- Traffic stays on the Microsoft backbone. No public internet, gateways or encryption are required. Same-region latency matches a single VNet, and the peering adds no bandwidth restriction.
- No downtime when you create a peering or after it exists. Peering works across subscriptions, Microsoft Entra tenants and deployment models, and with the Resource Manager and classic models. It doesn't work across different clouds.
- Default Azure name resolution doesn't work across peered VNets. Use Azure Private DNS or a custom DNS server.
- If VNets are connected both by peering and by a gateway, traffic between them flows through the peering.
- Resize an address space without downtime, then sync the peers. Sync after each resize, not after several. Not supported when the VNet is peered with a classic VNet.
- You can't move a peered VNet. Delete the peering, move the VNet, then recreate the peering.
- Global peering: resources can't reach the front-end IP of a Basic load balancer in the other VNet. Standard load balancer works in both local and global peering.
- You can't create peerings as part of the
PUTvirtual network operation. - Subnet peering peers only the subnets you choose. Regular peering peers the entire address space and all subnets.
- Ingress and egress traffic over a peering has a nominal charge.
- Roles: Network Contributor, or custom actions on
Microsoft.Network/virtualNetworks/virtualNetworkPeerings(write, read, delete). Deleting a peering from one VNet also deletes the remote peering.
Service chaining and gateway transit
Service chaining directs traffic from one VNet to a virtual appliance or gateway in a peered VNet through UDRs.
- Configure UDRs whose next hop IP address is a VM in the peered VNet. UDRs can also point to virtual network gateways.
- A UDR can't use an ExpressRoute gateway as the next hop to route between VNets.
- Hub-and-spoke: the hub hosts an NVA or VPN gateway and every spoke peers with the hub. Traffic flows through the hub's NVA or gateway.
- Peering alone creates no UDR and no NVA. They are created separately.
Gateway transit
- Gateway transit is a peering property: one VNet uses the VPN or ExpressRoute gateway in the peered VNet. It works for cross-premises and VNet-to-VNet connectivity, and in both local and global peering.
- For VPN gateway transit, all VPN Gateway SKUs work except Basic. S2S, P2S and VNet-to-VNet connections on the hub gateway apply to the spokes.
- The VNet that uses a remote gateway can't have its own gateway. A VNet can have only one gateway.
- Gateway transit between VNets in different deployment models works if the gateway is in the Resource Manager VNet.
- Gateway-learned routes propagate to the peered VNets. To stop that for a subnet, create a route table with Disable BGP route propagation and associate it with the subnet.
- Download the P2S VPN client package again after peering changes, so the clients get the new routes. For a site-to-site VPN device, the peered VNet ranges must be part of the traffic selectors (interesting traffic).
- Traffic to the gateway in the peered VNet incurs peering charges on the spoke VNet.
- To cut the number of prefixes the hub gateway advertises to on-premises, set
summarizedGatewayPrefixeson the gateway VNet.
- Hub peering: allow the hub's gateway to forward traffic to the peered VNet (and allow forwarded traffic).
- Spoke peering: enable use of the hub's remote gateway.
- Check that the peering shows Connected on both VNets.
Azure Virtual Network Manager (AVNM)
AVNM groups, configures, deploys and manages VNets across subscriptions and tenants. Configurations take effect only when you deploy them to the regions that hold the target VNets.
| Building block | What it is |
|---|---|
| Scope | Management groups and/or subscriptions the network manager can see and manage. Can be updated later. A management group scope includes all child subscriptions. You can't create two managers with an overlapping scope and the same features. |
| Network group | Global container of VNets from any region. Many-to-many with VNets. Static membership: you pick VNets. Dynamic membership: Azure Policy conditions. |
| Connectivity configuration | Builds a mesh or hub-and-spoke topology from network groups. |
| Security admin configuration | Security admin rules, evaluated before NSG rules. |
| Routing configuration | User-defined routes at scale. |
| Topology | How connectivity is built | Notes |
|---|---|---|
| Mesh | Connected group | Every VNet in the group reaches every other. Regional by default; enable global mesh for cross-region. Effective routes show next hop ConnectedGroup. |
| Hub-and-spoke, hub VNet | VNet peerings between hub and each spoke | Hub-to-spoke shows VNetPeering or GlobalVNetPeering. Optional direct connectivity adds a connected group among spokes of one spoke group. |
| Hub-and-spoke, Virtual WAN hub | Virtual WAN VNet connections | Preview. |
- Use hub as a gateway is on by default in the portal. If the hub has no gateway, creating the spoke-to-hub peering fails.
- Delete existing peerings removes peerings that don't match the configuration, even ones you created manually after deployment.
- Overlapping address spaces are allowed in a mesh by default, but traffic between overlapping subnets is dropped. Set
ConnectedGroupAddressOverlaptoDisallowedto block overlaps (default is Allowed). - Peering enforcement (
peeringEnforcement=Enforced) stops you deleting or changing the peerings outside AVNM. - A VNet can be in up to two connected groups. A connected group can hold up to 3,000 VNets with the high-scale feature (preview feature registration and approval).
- AVNM doesn't replace UDRs for sending spoke traffic through a hub firewall or NVA. Use a routing configuration to apply those routes at scale.
- Hub-and-spoke and mesh can coexist.
- Billing is per VNet that has an active configuration. Subscription-based pricing for older instances retires fully on February 6, 2028.
- To remove all applied configurations, deploy a None configuration to every region where you applied one.
Routes, UDRs and forced tunneling
Azure creates a route table for each subnet with system routes. You can't create or remove system routes, but you can override some with custom routes (UDRs or BGP).
| Default system route | Next hop type |
|---|---|
| VNet address space prefixes | Virtual network |
| 0.0.0.0/0 | Internet (Azure service public IPs stay on the Azure backbone) |
| 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10 | None (dropped) until you use the range in a VNet address space, then Virtual network |
| Added when you peer VNets | Virtual network peering |
| Added by a VNet gateway (BGP or local network gateway prefixes) | Virtual network gateway |
| Added for a service endpoint, only on that subnet | VirtualNetworkServiceEndpoint |
| UDR next hop type | Use |
|---|---|
| Virtual appliance | VM running a network application. Give its private IP, or an internal load balancer IP. Enable IP forwarding on the NIC and, if needed, in the OS. |
| Virtual network gateway | Send traffic to the VNet's gateway. Only for a VPN gateway, not ExpressRoute, Route Server or Virtual WAN hub router. |
| None | Drop the traffic. |
| Virtual network | Override default routing inside a VNet. |
| Internet | Route to the internet explicitly. |
- Route selection: longest prefix match first. For the same prefix: UDR, then BGP, then system route.
- System routes for the VNet, VNet peering and service endpoints are preferred even when BGP routes are more specific. A service endpoint route can't be overridden, even with a route table.
- You can't set Virtual network peering or
VirtualNetworkServiceEndpointas a UDR next hop. - A route table holds up to 400 UDRs by default (1,000 with an AVNM routing configuration), and up to 25 routes with service tags. An exact prefix match prefers the explicit prefix over a service tag.
- A route table can be associated with zero or more subnets, and each subnet has zero or one route table. You associate it with subnets, not VNets, and only in the same location and subscription as the route table.
- Dissociating a route table returns the subnet to default routes. You can't delete a route table that's still associated with a subnet.
- Put a virtual appliance in a different subnet from the resources routed through it, or you can get routing loops. A next hop IP needs direct connectivity without passing through an ExpressRoute gateway or Virtual WAN.
- Route table setting Propagate gateway routes (set to Disabled) stops ExpressRoute and VPN gateway routes reaching the subnet. Don't disable it on
GatewaySubnet, and don't associate a route table containing 0.0.0.0/0 with the gateway subnet. - A UDR for 0.0.0.0/0 sends all traffic, including traffic to Azure service public IPs, to its next hop, and you can no longer reach resources in the subnet directly from the internet. A service endpoint keeps its own longer prefixes, so that traffic bypasses the 0.0.0.0/0 route.
Forced tunneling (site-to-site VPN)
- By default, internet-bound traffic goes directly to the internet. Forced tunneling sends it back on-premises over the S2S tunnel for inspection and auditing.
- Method 1, BGP: advertise
0.0.0.0/0from on-premises over BGP. - Method 2, Default Site: set a Default Site on a route-based VPN gateway with PowerShell. The on-premises device must use
0.0.0.0/0as traffic selectors. - To let only some subnets go straight to the internet, combine forced tunneling with custom UDRs.
- RDP or SSH from the internet to a VM may fail under a 0.0.0.0/0 route, depending on how the next hop handles the traffic.
Diagnose routing issues
- View the effective routes of the VM's network interface (VM must be running). Each NIC can be in a different subnet, so check each one.
- Check the route table is associated with the right subnet, and the custom routes are the ones you expect.
- For a virtual appliance next hop, check that IP forwarding is enabled, or packets are dropped.
- For peering, a system route with next hop VNet Peering must exist for the peered prefix. A new peering can take a short time to propagate. If it's missing and the link is Connected, check the NSG rules too.
- Use Network Watcher Next hop for a quick test, Connection troubleshoot for routing, filtering and in-OS causes, and VPN diagnostics for a gateway.
Only the primary NIC gets the default route (0.0.0.0/0) inside the VM's OS. A secondary NIC needs its own default route.
Azure Route Server
A fully managed service that exchanges routes by BGP between NVAs and the VNet, so you don't maintain route tables by hand. It acts as a BGP route reflector and doesn't carry data traffic: traffic goes directly between the NVA and the VM.
| Limit | Value |
|---|---|
| BGP peers | 16 |
| Routes each peer can advertise | 4,000 (more drops the BGP session) |
| VMs supported (incl. peered VNets) | 50,000 |
| VNets supported | 500 |
| On-premises and VNet prefixes | 10,000 |
- Deployment: dedicated subnet named
RouteServerSubnet, at least /26, and a Standard public IP. Deployment time: Microsoft's pages differ. The portal quickstart says it can take up to 30 minutes; the Route Server FAQ says 30-60 minutes. - Peer each NVA with both Route Server instances and advertise the same routes to both. Microsoft recommends peering at least two NVA instances.
- The NVA must support multi-hop eBGP and use an ASN different from Route Server's (65515). Use 16-bit ASNs only. Reserved: public 8074, 8075, 12076; private 65515, 65517-65520.
- Timers: keepalive 60 seconds, hold 180 seconds. AS path and communities are preserved.
NO_ADVERTISEcommunity keeps a route from other peers. - Branch-to-branch must be enabled before Route Server exchanges routes between NVAs and VPN or ExpressRoute gateways. It gives transit between ExpressRoute and S2S VPN only, not P2S.
- With a VPN gateway: active-active mode and ASN 65515. BGP on the VPN gateway isn't required.
- Equal AS path length from several NVAs gives ECMP. A shorter AS path wins alone. By default, ExpressRoute-learned routes beat VPN or SD-WAN routes.
- Creating or deleting a Route Server in a VNet with a VPN or ExpressRoute gateway causes about 10 minutes of downtime.
- Peering: with Use the remote virtual network's gateway or Route Server on the spoke, Route Server learns the spoke's address space and programs NVA routes into the spoke's VMs.
- Route Server can't redirect traffic between subnets of the same VNet. System routes win there, so keep using UDRs.
- No IPv6: adding Route Server to a VNet with an IPv6 address space breaks IPv6 connectivity. A VNet connected to a Virtual WAN hub can't have a Route Server.
- Default capacity is two routing infrastructure units, supporting 4,000 VMs. Add units in steps of 1,000 VMs.
Azure NAT Gateway
Outbound-only NAT at subnet level. Instances stay private. No unsolicited inbound connections, only responses to outbound flows. No route table change is needed: it becomes the subnet's next hop for internet-bound traffic.
| Standard | StandardV2 | |
|---|---|---|
| Zones | Zonal (one zone) or No zone; zone can't be changed after deployment | Zone redundant |
| Public IPs | Up to 16 IPv4 Standard IPs or prefixes | Up to 16 IPv4 and 16 IPv6; needs StandardV2 public IPs |
| Throughput | 50 Gbps (25 out, 25 in) | 100 Gbps |
| Packets per second | 5 million | 10 million |
| Extras | - | IPv6, flow logs, NAT64 (needs a DNS64 solution) |
| Upgrade | Can't upgrade to StandardV2; create a new one | - |
- Use it as the recommended explicit outbound method, for a predictable outbound IP list (public IP prefix), for backend VMs of a Standard internal load balancer, and for App Service VNet integration. New VNets default to private subnets from March 31, 2026, so there is no default outbound access.
- Precedence: a 0.0.0.0/0 UDR to an NVA or gateway beats the NAT gateway. After that: NAT gateway, instance-level public IP, load balancer outbound rules, default system route. New connections move to the NAT gateway; existing ones continue.
- One subnet can't have more than one NAT gateway. A NAT gateway can't span VNets and can't be used in a gateway subnet or a subnet with SQL managed instances. Many subnets in a VNet can share one.
- Incompatible: Basic SKU public IPs and Basic load balancers, public IPs with DDoS protection enabled, and public IPs with routing configuration type Internet. No IP fragmentation. Not compatible with active FTP.
- Each public IP provides 64,512 SNAT ports. SNAT ports are shared across all subnets using the NAT gateway. Up to 50,000 concurrent connections per public IP to the same destination, and 2 million active connections in total.
- TCP idle timeout 4 to 120 minutes (default 4). Longer timeouts raise the risk of SNAT port exhaustion. UDP idle timeout is fixed at 4 minutes. After a TCP FIN, a SNAT port is held for 65 seconds.
- NAT gateway can't be moved across subscriptions, regions or resource groups, and can't be used across subscriptions. Metrics can't be exported with diagnostic settings; use VNet flow logs for logs.
- Same-region traffic to a storage account doesn't use the NAT gateway public IP.
- Hub-and-spoke: attach a NAT gateway to the Azure Firewall subnet in the hub to give peered spokes outbound connectivity.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Create a VNet peering | az network vnet peering create --name vnet-1-to-vnet-2 --vnet-name vnet-1 --remote-vnet vnet-2 --resource-group test-rg --allow-vnet-access --allow-forwarded-traffic | Add-AzVirtualNetworkPeering -Name SpokeRMtoHubRM -VirtualNetwork $spokermvnet -RemoteVirtualNetworkId $hubrmvnet.Id -UseRemoteGateways |
| Enable gateway transit on the hub side | - | Add-AzVirtualNetworkPeering -Name HubRMToSpokeRM -VirtualNetwork $hubrmvnet -RemoteVirtualNetworkId $spokermvnet.Id -AllowGatewayTransit |
| List peerings of a VNet | az network vnet peering list --resource-group test-rg --vnet-name vnet-1 --out table | Get-AzVirtualNetworkPeering @peer |
| Create a route table | az network route-table create --resource-group test-rg --name route-table-public | New-AzRouteTable @routeTableParams |
| Add a UDR to a virtual appliance | az network route-table route create --name to-private-subnet --resource-group test-rg --route-table-name route-table-public --address-prefix 10.0.2.0/24 --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.3.4 | Add-AzRouteConfig |
| UDR that uses a service tag as the prefix | az network route-table route create --resource-group MyResourceGroup --route-table-name MyRouteTable --name StorageRoute --address-prefix Storage --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.100.4 | New-AzRouteConfig @param |
| Associate a route table with a subnet | az network vnet subnet update --vnet-name vnet-1 --name subnet-1 --resource-group test-rg --route-table route-table-public | Set-AzVirtualNetworkSubnetConfig |
| Show effective routes of a NIC | az network nic show-effective-route-table --name vm-1445 --resource-group test-rg | Get-AzEffectiveRouteTable @Params | Format-Table |
| Create a Route Server | az network routeserver create --name 'myRouteServer' --resource-group 'myResourceGroup' --hosted-subnet $subnetId --public-ip-address 'RouteServerIP' | New-AzRouteServer -RouteServerName 'myRouteServer' -ResourceGroupName 'myResourceGroup' -Location 'EastUS' -HostedSubnet $subnetId -PublicIP $publicIp -VirtualRouterAutoScaleConfiguration $autoscale |
| Add a BGP peer (NVA) to Route Server | az network routeserver peering create --name 'myNVA' --peer-ip '10.0.0.4' --peer-asn '65001' --routeserver 'myRouteServer' --resource-group 'myResourceGroup' | Add-AzRouteServerPeer -ResourceGroupName 'myResourceGroup' -RouteServerName 'myRouteServer' -PeerName 'myNVA' -PeerAsn '65001' -PeerIp '10.0.0.4' |
| Get Route Server IPs and ASN | az network routeserver show --resource-group 'myResourceGroup' --name 'myRouteServer' | Get-AzRouteServer -ResourceGroupName 'myResourceGroup' -RouteServerName 'myRouteServer' |
| Create a NAT gateway | az network nat gateway create --resource-group test-rg --name nat-gateway --public-ip-addresses public-ip-nat --idle-timeout 10 | $natGateway = New-AzNatGateway @nat |
| Associate a NAT gateway with a subnet | az network vnet subnet update --resource-group test-rg --vnet-name vnet-1 --name subnet-1 --nat-gateway nat-gateway | Set-AzVirtualNetworkSubnetConfig @subnet |
Exam Tips
Tick each tip once you can answer it without looking.
“Spoke VNets must use the hub's VPN gateway to reach on-premises” → Hub peering: allow gateway or route server to forward traffic. Spoke peering: use the remote gateway. Basic SKU VPN gateways don't support transit.. Trap: The spoke can't use a remote gateway if it already has its own gateway, and a VNet can have only one gateway.
“VNet1 peers with VNet2, VNet2 peers with VNet3; VNet1 must reach VNet3” → Peering isn't transitive: create a VNet1-VNet3 peering, or route through an NVA in the hub. Trap: Enabling forwarded traffic on the peerings doesn't create the UDRs or the NVA.
“A peering shows Initiated” → The peering exists on one side only. Create the peering in the other VNet so both show Connected.. Trap: Traffic doesn't flow until both peerings are Connected.
“Two VNets with overlapping address spaces need to talk” → Peering requires nonoverlapping address spaces. A mesh in AVNM allows overlap, but traffic between the overlapping subnets is dropped.. Trap: Set ConnectedGroupAddressOverlap to Disallowed to block overlapping VNets from joining a mesh.
“Add an address range to a peered VNet without downtime” → Resize the address space, then sync the peering (after each resize). Trap: Not supported when the VNet is peered with a classic VNet.
“Move a peered VNet to another resource group” → Delete the peering, move the VNet, recreate the peering. Trap: A VNet can't be moved while it's part of a peering.
“Send spoke traffic through an NVA in the hub (service chaining)” → UDR with next hop type Virtual appliance and the NVA's private IP (or an internal load balancer IP). Enable IP forwarding on the NIC and, if needed, in the OS.. Trap: With IP forwarding off, packets are dropped. Put the NVA in a different subnet from the routed resources to avoid routing loops.
“Replace a system peering route for one prefix” → Create a UDR for the same prefix. For equal prefixes: UDR, then BGP, then system. Longest prefix match is applied first.. Trap: A system route for VNet, peering or service endpoints stays preferred even over a more specific BGP route.
“Create a UDR with next hop Virtual network peering or service endpoint” → You can't. Azure creates those routes only when you configure the peering or service endpoint.. Trap: Next hop types available in a UDR: virtual appliance, virtual network gateway, none, virtual network, internet.
“Associate one route table with subnets in another region or subscription” → Not allowed: the route table and the subnet's VNet must be in the same location and subscription. Trap: You associate route tables with subnets, not with VNets. Each subnet has at most one route table.
“Send all internet traffic back on-premises over a S2S VPN” → Forced tunneling: advertise 0.0.0.0/0 over BGP, or set a Default Site on a route-based gateway. Trap: Default Site needs 0.0.0.0/0 traffic selectors on the on-premises device. Use UDRs to let chosen subnets exit directly.
“A VM can't be reached; check which routes apply” → Effective routes of its NIC (VM running), or Network Watcher Next hop for a destination IP. Trap: Next hop shows System Route when no UDR matches. IP flow verify checks security rules, not routing.
“NVAs must learn and advertise routes dynamically, with no manual route tables” → Azure Route Server (BGP). Subnet RouteServerSubnet, /26 or larger, Standard public IP.. Trap: Route Server doesn't carry data traffic and can't redirect traffic between subnets of the same VNet.
“Route Server must exchange routes between an NVA and a VPN or ExpressRoute gateway” → Enable branch-to-branch. VPN gateway must be active-active with ASN 65515.. Trap: Off by default. Transit is ExpressRoute to S2S VPN only, not P2S.
“VMs in a private subnet need outbound internet access with fixed outbound IPs” → NAT Gateway with a public IP or public IP prefix. Associate it with the subnet; no route table change needed.. Trap: A 0.0.0.0/0 UDR to an NVA or gateway bypasses the NAT gateway.
“Need outbound zone redundancy, IPv6 or 100 Gbps” → StandardV2 NAT gateway, with StandardV2 public IPs. Trap: You can't upgrade Standard to StandardV2. Create a new one and attach it to the subnet.
“Internet clients must start connections to VMs in a subnet that uses a NAT gateway” → A NAT gateway doesn't permit unsolicited inbound connections. Only return packets of an outbound connection pass.. Trap: Assigning a NAT gateway to the subnet doesn't make the VMs reachable from the internet.
“Spokes must talk to each other directly without going through the hub” → AVNM hub-and-spoke with direct connectivity (connected group), or a mesh. Deploy the configuration to the regions.. Trap: A configuration has no effect until it's deployed.
Sources
- Azure Virtual Network peering
- Create, change, or delete a virtual network peering
- Configure VPN gateway transit for virtual network peering
- What is Azure Virtual Network Manager?
- Connectivity configurations in Azure Virtual Network Manager
- Network groups in Azure Virtual Network Manager
- Azure Virtual Network Manager scopes
- Azure Virtual Network Manager FAQ
- Azure virtual network traffic routing
- Create, change, or delete a route table
- Tutorial: Route network traffic with a route table
- Diagnose a virtual machine routing problem
- About forced tunneling for site-to-site
- What is Azure Route Server?
- Azure Route Server FAQ
- Quickstart: Create a Route Server (portal)
- Quickstart: Create a Route Server (CLI)
- Quickstart: Create a Route Server (PowerShell)
- What is Azure NAT Gateway?
- NAT gateway resource
- Azure NAT Gateway FAQ
- Quickstart: Create a NAT gateway
- Next hop overview
- IP flow verify overview
Checked against Microsoft Learn on November 13, 2026.