Question

Difficulty: HardConfigure User-Defined Routes and Routing Tables

An administrator configures a route table named `RT-Prod` and associates it with `Subnet-1` (10.1.1.0/2410.1.1.0/24) in `VNet-1` (10.1.0.0/1610.1.0.0/16). `VNet-1` is peered with `VNet-2` (10.2.0.0/1610.2.0.0/16).

The route table `RT-Prod` contains the following two user-defined routes:
* Route1: Destination prefix 10.2.0.0/1610.2.0.0/16, Next hop type: Virtual appliance, Next hop IP address: 10.1.1.410.1.1.4
* Route2: Destination prefix 10.2.2.0/2410.2.2.0/24, Next hop type: Virtual Network Gateway

A virtual machine in `Subnet-1` sends a packet to a destination IP address of 10.2.2.5010.2.2.50 in `VNet-2`.

Which next hop will the traffic use to reach the destination?

  1. The virtual network gatewayAnswer
  2. B
    The virtual appliance at 10.1.1.4
  3. C
    The virtual network peering connection
  4. D
    The virtual network local routing

Answer

The traffic will use the virtual network gateway.
The correct answer is the virtual network gateway because Azure's routing engine uses the Longest Prefix Match (LPM) algorithm. The destination IP address 10.2.2.5010.2.2.50 matches Route2 (10.2.2.0/2410.2.2.0/24) with a 24-bit match, which is more specific than the 16-bit match of Route1 (10.2.0.0/1610.2.0.0/16) and the VNet Peering system route (10.2.0.0/1610.2.0.0/16). Therefore, Route2 is selected, and its next hop is the virtual network gateway.

Step-by-Step Solution

1
Identify all matching routes for the destination IP address 10.2.2.5010.2.2.50.
The matching routes are: the system peering route (10.2.0.0/1610.2.0.0/16), Route1 (10.2.0.0/1610.2.0.0/16 pointing to 10.1.1.410.1.1.4), and Route2 (10.2.2.0/2410.2.2.0/24 pointing to the Virtual Network Gateway).
Before choosing a route, Azure evaluates all candidate routes in the routing table (both system and user-defined) that match the destination IP address.
2
Apply the Longest Prefix Match (LPM) rule to select the most specific route prefix.
The prefix 10.2.2.0/2410.2.2.0/24 has a longer match (24 bits) than 10.2.0.0/1610.2.0.0/16 (16 bits).
Azure's routing decision engine always prioritizes the most specific route prefix (the one with the largest subnet mask length) regardless of whether it is a system route or a UDR.
3
Identify the next hop type associated with the winning route.
The winning route is Route2, which has a next hop type of Virtual Network Gateway.
Since Route2 has the longest prefix match, its defined next hop is used to route the traffic.

Key Concept

Azure routes traffic based on the Longest Prefix Match (LPM) algorithm across all system and user-defined routes. Only when prefixes are identical does the route source priority (UDR > BGP > System) resolve the conflict.
Rate this question