Azure Networking

Azure Route Tables

This article explains how to create and manage route tables in Azure. Route tables allow you to define custom routes to direct network traffic in your Azure virtual network.

What are Route Tables?

A route table contains a collection of rules, called routes, that determine where network traffic is directed. Azure uses route tables to override the system's default routes. You can associate a route table with one or more subnets in a virtual network. When you associate a route table with a subnet, all network traffic originating from that subnet uses the routes defined in the route table.

Key Concepts

Creating a Route Table

You can create a route table using the Azure portal, Azure CLI, or Azure PowerShell.

Using Azure Portal:

  1. Navigate to the Azure portal.
  2. Search for "Route Tables" and select it.
  3. Click "+ Create" to start the creation process.
  4. Fill in the required details: Subscription, Resource group, Name, Region.
  5. Select "Propagate gateway routes" if you want to propagate routes from VPN or ExpressRoute gateways.
  6. Click "Review + create" and then "Create".

Adding Routes to a Route Table

Once a route table is created, you can add custom routes:

  1. Go to the route table resource in the Azure portal.
  2. Under "Settings", select "Routes".
  3. Click "+ Add".
  4. Provide a "Route name", "Address prefix" (e.g., 10.1.0.0/16), and select the "Next hop type" and "Next hop address" (if applicable).
  5. Click "Add".

Associating a Route Table with a Subnet

To apply the custom routes, associate the route table with a subnet:

  1. Navigate to the route table resource.
  2. Under "Settings", select "Subnets".
  3. Click "+ Associate".
  4. Select the Virtual Network and the Subnet you want to associate.
  5. Click "OK".

Example: Routing traffic through a Network Virtual Appliance (NVA)

To force traffic through a firewall or other NVA, you would create a route for your desired traffic destination and set the "Next hop type" to Virtual Appliance, providing the private IP address of the NVA as the "Next hop address".


// Example Azure CLI command to create a route
az network route-table route create \
  --resource-group MyResourceGroup \
  --route-table-name MyRouteTable \
  --name RouteToNVA \
  --address-prefix 0.0.0.0/0 \
  --next-hop-type VirtualAppliance \
  --next-hop-ip-address 10.0.1.4
            

API Reference

For programmatic management of route tables, refer to the Azure REST API documentation.

Resource Description
Route Tables Create, update, delete, and manage route tables.
Routes Add, update, and delete routes within a route table.
Subnet Associations Associate or disassociate route tables with subnets.