Lesson 4 of 5 Azure Virtual Networks and Routing

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.

Match the pairs

Where routes come from

Exam skills 4.1.4

Match each route with the next hop type Azure shows for it.

Log in to try this activity Interactive activities are free with an account.

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 typeSends traffic toExample
Virtual applianceA private IP address of an NVA, firewall or internal load balancer0.0.0.0/0 to Azure Firewall at 10.0.1.4
Virtual network gatewayThe VNet's VPN gatewayForce traffic to on-premises over VPN
Virtual networkThe default routing within the VNetOverride a broader route for a subnet range
InternetThe internet directlySend a specific prefix out directly
NoneNowhere; the traffic is droppedBlock 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.

Scenario questions

Which route wins?

Exam skills 4.1.4

Apply longest prefix match and route table rules.

Log in to try this activity Interactive activities are free with an account.

Routing through a network virtual appliance

Sending traffic through an NVA needs more than a route. The steps below summarize a forced-inspection design.

  1. Deploy the appliance

    Deploy the NVA or Azure Firewall in its own subnet, usually in the hub.

  2. 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.

  3. 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.

  4. Associate

    Associate the route table with the workload subnets, not with the NVA's own subnet.

  5. 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 spoke-to-spoke traffic through Azure Firewall. Spoke1's route table sends 10.3.0.0/16 to the virtual appliance 10.1.1.4, and Spoke2's sends 10.2.0.0/16 to the same firewall; the peerings allow forwarded traffic and firewall network rules permit the flows. Direct spoke peering would bypass inspection.
The scenario is illustrative.
Put in order

Forcing traffic through an NVA

Exam skills 4.1.4

Arrange the steps that send spoke traffic through a third-party NVA in the hub.

Log in to try this activity Interactive activities are free with an account.
Worked example

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.

Check yourself

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.