How Azure picks a route for cross-VNet traffic
0.0.0.0/0 to the Internet. When you associate a route table with a subnet, its UDRs are added to that list.
When several routes match a destination, Azure first picks the most specific prefix (longest prefix match). Only when two routes have the same prefix does the source decide: a user-defined route beats a BGP route from a gateway, and a BGP route beats a system route.
This order explains a common confusion. A UDR for 0.0.0.0/0 pointing at a firewall does not, by itself, divert traffic to a peered VNet, because the peering route for something like 10.2.0.0/16 is more specific and still wins. Traffic gets pulled away from the peering when someone adds a UDR with the same prefix as the peered VNet, or a more specific one such as 10.2.1.0/24. If that UDR points at an appliance that is down, misconfigured, or not forwarding, the traffic disappears without any error message. A UDR with next hop type None drops matching traffic on purpose.
Customers often say they only added a default route. The effective routes show whether that is the whole story.
Read the effective routes on the source NIC
BASH
# Find the NIC(s) attached to the source VM
az vm show --resource-group rg-app --name vm-app-01 --query 'networkProfile.networkInterfaces[].id' --output tsv
# Show the merged route table Azure applies to that NIC
az network nic show-effective-route-table --resource-group rg-app --name vm-app-01-nic --output table10.1.0.0/16 and the peered VNet B is 10.2.0.0/16:
| Source | State | Address Prefix | Next Hop Type | Next Hop IP |
|---|---|---|---|---|
| Default | Active | 10.1.0.0/16 | VnetLocal | |
| Default | Invalid | 10.2.0.0/16 | VNetPeering | |
| User | Active | 10.2.0.0/16 | VirtualAppliance | 10.1.1.4 |
| Default | Active | 0.0.0.0/0 | Internet |
10.1.1.4. So the peering is still Connected, and Azure is no longer using it directly for this subnet.
While you are reading the list, also look for routes to the peered range that came from a gateway (source VirtualNetworkGateway). Prefixes advertised from on-premises over BGP that overlap or clash with a peered VNet can send traffic toward the gateway instead, which the same Microsoft article calls out as a cause of unpredictable routing.
Ask Azure for the next hop of one specific flow
BASH
# Which hop will a packet from 10.1.0.4 to 10.2.0.4 take, and which route table decided it?
az network watcher show-next-hop --resource-group rg-app --vm vm-app-01 --source-ip 10.1.0.4 --dest-ip 10.2.0.4
# List the routes in the route table returned in routeTableId
az network route-table route list --resource-group rg-network --route-table-name rt-app-subnet --output tablenextHopType, nextHopIpAddress, and routeTableId. When routeTableId is set, a UDR made the decision, and the ID points straight at the route table to inspect. That saves a lot of guessing in a subscription with dozens of route tables. When nextHopType is None, the traffic is dropped by design, and the fix is to change or remove that route rather than debug anything downstream.
When the UDR points at an appliance that does not forward
- Something must actually own the next hop IP. A typo or a rebuilt appliance with a new address leaves the route pointing at nothing.
- The appliance's Azure NIC must have IP forwarding enabled. Without it, Azure drops packets that arrive at the NIC addressed to another IP.
- The appliance's operating system must forward packets. On a Linux-based NVA that is the
net.ipv4.ip_forwardkernel setting. Vendor appliances expose this in their own configuration. - The appliance's firewall rules must allow the flow.
- If the appliance sits in a different VNet from the destination, the peering into the destination VNet must allow forwarded traffic. Otherwise packets that the NVA forwards over the peering are refused.
BASH
# 2. Is IP forwarding enabled on the NVA's Azure NIC? (property name can vary by CLI version)
az network nic show --resource-group rg-network --name nva-01-nic --query 'enableIPForwarding'
# 3. On a Linux NVA, is the kernel forwarding packets? 1 means yes
sysctl net.ipv4.ip_forward
# 5. Does the peering accept traffic forwarded from outside the remote VNet?
az network vnet peering show --resource-group rg-app-b --vnet-name vnet-b --name vnet-b-to-vnet-a --query 'allowForwardedTraffic'Check the return path, then re-run everything after the fix
show-effective-route-table on both NICs again and confirm the route you intended is now Active. Run show-next-hop in both directions and confirm the next hop and route table ID match your design. Then test a real connection from inside the VM, for example nc -vz 10.2.0.4 443 against a port you know is listening. Effective routes can take a short while to reflect a change, so a failed test right after saving is worth one more run before you dig further.
The practical rule: when cross-VNet traffic stops after a routing change, ignore the peering status and read the effective routes on the source NIC first, then on the destination NIC. Those two lists tell you which route won, where the packets went, and whether the replies come back the same way. Most of these cases are solved before you need to open the appliance at all.