Configuring route tables
For traffic to pass through the router, the Azure route tables must be configured.
The following example shows a router with an IP address of 10.0.0.4 on its primary NIC. The route table is to be configured so that any traffic originating in the App-Subnet subnet (10.0.3.0/24) destined for the DB-Subnet subnet (10.0.2.0/24) passes through the router.
First, create a route table. This can be done by using the azure network route-table create <resource-group> <name> <location> command as follows:
$ azure network route-table create vRouter App-Route-Table westus info: Executing
command network route-table create
+ Looking up Route Table "App-Route-Table"
+ Creating Route Table "App-Route-Table" data: Id :
/subscriptions/00000000-0000-0000-0000-0000000000000/resourceGroups/vRoute r/providers/
Microsoft.Network/routeTables/App-Route-Table
data: Name : App-Route-Table
data: Type : Microsoft.Network/routeTables data: Location : westus
data: Provisioning state : Succeeded info: network route-table create command OK
Next, add a route to the route table; this route applies to any traffic destined for the 10.0.2.0/24 address range and sends the traffic to the specified virtual appliance. To create a route, use the azure network route-table route create <resource-group> <route-table-name> <name> command as follows:
$ azure network route-table route create --address-prefix 10.0.2.0/24
--next-hop-type VirtualAppliance --next-hop-ip-address 10.0.0.4 vRouter
App-Route-Table DB-Route
info: Executing command network route-table route create
+ Looking up Route Table "App-Route-Table"
+ Looking up route "DB-Route" in route table "App-Route-Table"
+ Creating route "DB-Route" in a route table "App-Route-Table" data: Id :
/subscriptions/00000000-0000-0000-0000-0000000000000/resourceGroups/vRoute r/providers/
Microsoft.Network/routeTables/App-Route-Table/routes/DB-Route data: Name : DB-Route
data: Provisioning state : Succeeded
data: Next hop type : VirtualAppliance data: Next hop IP address : 10.0.0.4
data: Address prefix : 10.0.2.0/24 info: network route-table route create command OK
Finally, associate the route table to a subnet. In this case, the App-Route-Table route table is to be associated with the App-Subnet subnet. This association is done using the --route-table-name option of the azure network vnet subnet set <resource-group> <vnet-name> <name> command as follows:
$ azure network vnet subnet set --route-table-name App-Route-Table vRouter
Net App-Subnet
info: Executing command network vnet subnet set
+ Looking up the virtual network "Net"
+ Looking up the subnet "App-Subnet"
+ Looking up Route Table "App-Route-Table"
+ Updating subnet "App-Subnet"
data: Id :
/subscriptions/00000000-0000-0000-0000-0000000000000/resourceGroups/vRoute r/providers/
Microsoft.Network/virtualNetworks/Net/subnets/App-Subnet
data: Name : App-Subnet data: Provisioning state : Succeeded data: Address
prefix : 10.0.3.0/24 data: Route Table id :
/subscriptions/00000000-0000-0000-0000-0000000000000/resourceGroups/vRoute r/providers/
Microsoft.Network/routeTables/App-Route-Table
info: network vnet subnet set command OK