Question

Difficulty: EasyVirtual Network Connectivity and Routing

You are designing a routing solution for an Azure environment to meet corporate security compliance. The environment contains a virtual network named `vnet-prod-spoke` with an address space of 10.10.0.0/1610.10.0.0/16.

To ensure security inspection, all outbound traffic destined for the internet must be redirected to an on-premises VPN gateway, while virtual machines within `vnet-prod-spoke` must be able to communicate directly with one another.

You create a custom route table and associate it with the subnets in `vnet-prod-spoke`.

Which route configuration should you add to the route table to meet these requirements?

  1. A route for 0.0.0.0/00.0.0.0/0 with a next hop type of Virtual Network Gateway.Answer
  2. B
    A route for 0.0.0.0/00.0.0.0/0 with a next hop type of Virtual Network Gateway, and a route for 10.10.0.0/1610.10.0.0/16 with a next hop type of Virtual Network Gateway.
  3. C
    A route for 10.10.0.0/1610.10.0.0/16 with a next hop type of Virtual Network Gateway, leaving internet-bound traffic to default system routing.
  4. D
    A route for 0.0.0.0/00.0.0.0/0 with a next hop type of Virtual Network Gateway, and a route for 10.10.0.0/1610.10.0.0/16 with a next hop type of Internet.

Answer

A route for 0.0.0.0/00.0.0.0/0 with a next hop type of Virtual Network Gateway.
The correct configuration is a route for 0.0.0.0/00.0.0.0/0 with a next hop type of Virtual Network Gateway. Under Azure's routing rules, the longest prefix match determines which route is selected. Since the virtual network's default system route of 10.10.0.0/1610.10.0.0/16 is more specific than the default route 0.0.0.0/00.0.0.0/0, traffic destined for resources inside the virtual network will be routed locally, while all other traffic (internet-bound) will be forwarded to the Virtual Network Gateway.

Step-by-Step Solution

1
Identify the target prefix for all internet-bound traffic.
The target prefix representing all destinations outside the virtual network (the default route) is 0.0.0.0/00.0.0.0/0.
Redirection of all internet traffic requires a default route that matches any destination not covered by more specific routes.
2
Determine the next hop type to direct traffic to the on-premises network.
The next hop type must be set to Virtual Network Gateway.
A VPN gateway or ExpressRoute gateway is represented in Azure routing tables by the Virtual Network Gateway next hop type.
3
Analyze the impact on local traffic routing.
Local traffic within `vnet-prod-spoke` matches the system-defined local route (10.10.0.0/1610.10.0.0/16 -> Local). Since 10.10.0.0/1610.10.0.0/16 is a longer (more specific) prefix than 0.0.0.0/00.0.0.0/0, Azure will prioritize the local route for internal communication.
Azure routing logic always uses the longest prefix match (LPM) to select the route, so no additional route is needed for local traffic.

Key Concept

Azure uses the longest prefix match (LPM) algorithm to select routes. A user-defined route (UDR) for a broad prefix like 0.0.0.0/00.0.0.0/0 does not override more specific system routes, such as the local virtual network route.
Rate this question