Route tables in Azure Virtual Networks (VNets) are a fundamental component for controlling traffic flow within your VNet and to and from external networks. They allow you to define custom routes to override Azure's default system routes. This enables scenarios such as enforcing traffic inspection through network virtual appliances (NVAs) or directing traffic to specific gateways.
Every subnet in an Azure VNet is automatically associated with a route table. Initially, this route table contains only the default system routes provided by Azure. These routes cover:
You can add custom routes to a route table to influence how traffic is directed. Each custom route consists of:
VirtualAppliance: Traffic is sent to a network virtual appliance (NVA) for processing.VirtualNetworkGateway: Traffic is sent to a virtual network gateway for VPN or ExpressRoute connectivity.Internet: Traffic is sent directly to the internet.None: Traffic is dropped (blackholed).Next Hop Type is VirtualAppliance, this is the private IP address of the VNet interface of the NVA.A route table can be associated with one or more subnets. Traffic originating from a subnet will use the routes defined in its associated route table.
You can create and manage route tables using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.
az network route-table create --resource-group myResourceGroup --name MyRouteTable
To add a custom route:
az network route-table route create --resource-group myResourceGroup --route-table-name MyRouteTable --name RouteToNVA --address-prefix 10.1.0.0/16 --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.0.4
To associate a route table with a subnet:
az network vnet subnet update --resource-group myResourceGroup --vnet-name MyVNet --name MySubnet --route-table MyRouteTable
Azure evaluates routes based on the following criteria, in order of priority:
If multiple routes have the same most specific prefix, the order of preference is UDR, then BGP, then system routes.
Use the Azure Network Watcher's IP Flow Verify and Next Hop features to diagnose connectivity issues and understand how traffic is being routed.
Understanding and effectively utilizing Azure Virtual Network route tables is crucial for designing secure, scalable, and well-managed cloud networks.