Controlling Traffic Paths with User-Defined Routes
This lesson explains system routes, route tables, next hop types and how to route traffic through a network virtual appliance.
Learning outcomes
After completing this lesson, you will be able to:
- Describe system routes and how route selection works.
- Identify the next hop types and their uses.
- Explain the configuration needed to route traffic through an NVA.
System routes
Every subnet has system routes created by Azure: the VNet's address space with next hop Virtual network, 0.0.0.0/0 with next hop Internet, and routes to private and reserved ranges with next hop None. Peering adds routes to peered VNets (VNet peering), a VPN or ExpressRoute gateway adds on-premises routes learned through BGP (Virtual network gateway), and enabling service endpoints adds routes for the service's public prefixes.
Where routes come from
Route tables and next hop types
A route table is a resource containing user-defined routes (UDRs). Each route has an address prefix (or a service tag) and a next hop type. The route table is associated with one or more subnets in the same region and subscription and affects traffic leaving resources in those subnets; a subnet can have only one route table.
| Next hop type | Sends traffic to | Example |
|---|---|---|
| Virtual appliance | A private IP address of an NVA, firewall or internal load balancer | 0.0.0.0/0 to Azure Firewall at 10.0.1.4 |
| Virtual network gateway | The VNet's VPN gateway | Force traffic to on-premises over VPN |
| Virtual network | The default routing within the VNet | Override a broader route for a subnet range |
| Internet | The internet directly | Send a specific prefix out directly |
| None | Nowhere; the traffic is dropped | Block a destination range |
When several routes match a destination, Azure uses the longest prefix match. If prefixes are equal, a UDR takes precedence over a BGP route, which takes precedence over a system route. A route table's Propagate gateway routes setting, when disabled, stops BGP routes from the VNet gateway being added to the associated subnets, which is used when all traffic must pass through a firewall.
Which route wins?
Routing through a network virtual appliance
Sending traffic through an NVA needs more than a route. The steps below summarize a forced-inspection design.
-
Deploy the appliance
Deploy the NVA or Azure Firewall in its own subnet, usually in the hub.
-
Enable IP forwarding
On the NVA's network interface, enable IP forwarding so Azure delivers packets addressed to other destinations; enable forwarding in the NVA's operating system too. Azure Firewall needs no such step.
-
Create routes
Create a route table with 0.0.0.0/0 (and other ranges) to next hop Virtual appliance and the NVA's private IP.
-
Associate
Associate the route table with the workload subnets, not with the NVA's own subnet.
-
Allow forwarded traffic
On peerings, allow forwarded traffic so traffic from the NVA is accepted.
The following diagram shows the routes that send spoke-to-spoke traffic through Azure Firewall in the hub.

Forcing traffic through an NVA
Inspecting spoke-to-spoke traffic
Spoke1 (10.2.0.0/16) and Spoke2 (10.3.0.0/16) are each peered with a hub that contains Azure Firewall at 10.1.1.4. VMs in Spoke1 must reach Spoke2, and all traffic between the spokes must be inspected by the firewall. What should you configure?
Create a route table for Spoke1's subnets with a route for 10.3.0.0/16 to next hop Virtual appliance 10.1.1.4, and a route table for Spoke2's subnets with 10.2.0.0/16 to the same firewall. Enable allow forwarded traffic on the peerings and add firewall network rules allowing the traffic. Peering the spokes directly would bypass the firewall.
A UDR and a system route both match 10.0.0.0/16. Which one is used?
Show answer
The UDR, because for equal prefixes a user-defined route takes precedence over BGP and system routes.
Exam Tips
Remember for the exam
- Route tables apply to subnets; one route table per subnet.
- Longest prefix wins; for equal prefixes, UDR beats BGP beats system.
- NVAs need IP forwarding enabled on their NIC.
- Next hop None drops traffic.