You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: In this tutorial, learn how to route network traffic with a route table.
5
5
author: asudbring
6
6
ms.service: azure-virtual-network
7
-
ms.date: 10/31/2024
7
+
ms.date: 07/11/2025
8
8
ms.author: allensu
9
9
ms.topic: tutorial
10
10
ms.custom:
@@ -19,7 +19,7 @@ ai-usage: ai-assisted
19
19
20
20
# Tutorial: Route network traffic with a route table
21
21
22
-
Azure routes traffic between all subnets within a virtual network, by default. You can create your own routes to override Azure's default routing. Custom routes are helpful when, for example, you want to route traffic between subnets through a network virtual appliance (NVA).
22
+
Azure routes traffic between all subnets within a virtual network by default. You can create your own routes to override Azure's default routing. Custom routes are helpful when, for example, you want to route traffic between subnets through a network virtual appliance (NVA).
23
23
24
24
:::image type="content" source="./media/tutorial-create-route-table-portal/resources-diagram.png" alt-text="Diagram of Azure resources created in tutorial." lightbox="./media/tutorial-create-route-table-portal/resources-diagram.png":::
25
25
@@ -60,7 +60,7 @@ If you choose to install and use PowerShell locally, this article requires the A
60
60
61
61
## Create subnets
62
62
63
-
A **DMZ** and **Private** subnet are needed for this tutorial. The **DMZ** subnet is where you deploy the NVA, and the **Private** subnet is where you deploy the virtual machines that you want to route traffic to. The **subnet-1** is the subnet created in the previous steps. Use **subnet-1** for the public virtual machine.
63
+
A **DMZ** and **Private** subnet are needed for this tutorial. The **DMZ** subnet is where you deploy the NVA and the **Private** subnet is where you deploy the private virtual machines you want to route traffic to. In the diagram, **subnet-1** is the **Public** subnet used for the public virtual machine.
64
64
65
65
### [Portal](#tab/portal)
66
66
@@ -321,13 +321,13 @@ Network virtual appliances (NVAs) are virtual machines that help with network fu
321
321
322
322
### [PowerShell](#tab/powershell)
323
323
324
-
Create the VM with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named *vm-nva*.
324
+
Create the virtual machine with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a virtual machine named *vm-nva*.
325
325
326
326
```azurepowershell-interactive
327
327
# Create a credential object
328
328
$cred = Get-Credential
329
329
330
-
# Define the VM parameters
330
+
# Define the virtual machine parameters
331
331
$vmParams = @{
332
332
ResourceGroupName = "test-rg"
333
333
Location = "EastUS2"
@@ -340,13 +340,13 @@ $vmParams = @{
340
340
PublicIpAddressName = $null # No public IP address
341
341
}
342
342
343
-
# Create the VM
343
+
# Create the virtual machine
344
344
New-AzVM @vmParams
345
345
```
346
346
347
347
### [CLI](#tab/cli)
348
348
349
-
Create a VM to be used as the NVA in the *subnet-dmz* subnet with [az vm create](/cli/azure/vm).
349
+
Create a virtual machine to be used as the NVA in the *subnet-dmz* subnet with [az vm create](/cli/azure/vm).
350
350
351
351
```azurecli-interactive
352
352
az vm create \
@@ -360,17 +360,17 @@ az vm create \
360
360
--authentication-type password
361
361
```
362
362
363
-
The VM takes a few minutes to create. Don't continue to the next step until Azure finishes creating the VM and returns output about the VM.
363
+
The virtual machine takes a few minutes to create. Don't continue to the next step until Azure finishes creating the virtual machine and returns output for the virtual machine.
364
364
365
365
---
366
366
367
367
## Create public and private virtual machines
368
368
369
-
Create two virtual machines in the **vnet-1** virtual network. One virtual machine is in the **subnet-1** subnet, and the other virtual machine is in the **subnet-private** subnet. Use the same virtual machine image for both virtual machines.
369
+
Create two virtual machines in the **vnet-1** virtual network. One virtual machine is in the **subnet-1** subnet and the other virtual machine is in the **subnet-private** subnet. Use the same virtual machine image for both virtual machines.
370
370
371
371
### Create public virtual machine
372
372
373
-
The public virtual machine is used to simulate a machine in the public internet. The public and private virtual machine are used to test the routing of network traffic through the NVA virtual machine.
373
+
The public virtual machine is used to simulate a machine in the public internet. The public and private virtual machines are used to test the routing of network traffic through the NVA virtual machine.
374
374
375
375
### [Portal](#tab/portal)
376
376
@@ -464,13 +464,13 @@ The public virtual machine is used to simulate a machine in the public internet.
464
464
465
465
### [PowerShell](#tab/powershell)
466
466
467
-
Create a VM in the *subnet-1* subnet with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named *vm-public* in the *subnet-public* subnet of the *vnet-1* virtual network.
467
+
Create a virtual machine in the *subnet-1* subnet with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a virtual machine named *vm-public* in the *subnet-public* subnet of the *vnet-1* virtual network.
468
468
469
469
```azurepowershell-interactive
470
470
# Create a credential object
471
471
$cred = Get-Credential
472
472
473
-
# Define the VM parameters
473
+
# Define the virtual machine parameters
474
474
$vmParams = @{
475
475
ResourceGroupName = "test-rg"
476
476
Location = "EastUS2"
@@ -483,17 +483,17 @@ $vmParams = @{
483
483
PublicIpAddressName = $null # No public IP address
484
484
}
485
485
486
-
# Create the VM
486
+
# Create the virtual machine
487
487
New-AzVM @vmParams
488
488
```
489
489
490
-
Create a VM in the *subnet-private* subnet.
490
+
Create a virtual machine in the *subnet-private* subnet.
491
491
492
492
```azurepowershell-interactive
493
493
# Create a credential object
494
494
$cred = Get-Credential
495
495
496
-
# Define the VM parameters
496
+
# Define the virtual machine parameters
497
497
$vmParams = @{
498
498
ResourceGroupName = "test-rg"
499
499
Location = "EastUS2"
@@ -506,15 +506,15 @@ $vmParams = @{
506
506
PublicIpAddressName = $null # No public IP address
507
507
}
508
508
509
-
# Create the VM
509
+
# Create the virtual machine
510
510
New-AzVM @vmParams
511
511
```
512
512
513
-
The VM takes a few minutes to create. Don't continue with the next step until the VM is created and Azure returns output to PowerShell.
513
+
The virtual machine takes a few minutes to create. Don't continue with the next step until the virtual machine is created and Azure returns the output to PowerShell.
514
514
515
515
### [CLI](#tab/cli)
516
516
517
-
Create a VM in the *subnet-1* subnet with [az vm create](/cli/azure/vm). The `--no-wait` parameter enables Azure to execute the command in the background so you can continue to the next command.
517
+
Create a virtual machine in the *subnet-1* subnet with [az vm create](/cli/azure/vm). The `--no-wait` parameter enables Azure to execute the command in the background so you can continue to the next command.
518
518
519
519
```azurecli-interactive
520
520
az vm create \
@@ -529,7 +529,7 @@ az vm create \
529
529
--no-wait
530
530
```
531
531
532
-
Create a VM in the *subnet-private* subnet.
532
+
Create a virtual machine in the *subnet-private* subnet.
533
533
534
534
```azurecli-interactive
535
535
az vm create \
@@ -546,7 +546,7 @@ az vm create \
546
546
547
547
## Enable IP forwarding
548
548
549
-
To route traffic through the NVA, turn on IP forwarding in Azure and in the operating system of **vm-nva**. When IP forwarding is enabled, any traffic received by **vm-nva**that's destined for a different IP address, isn't dropped and is forwarded to the correct destination.
549
+
To route traffic through the NVA, turn on IP forwarding in Azure and in the operating system of **vm-nva**. When IP forwarding is enabled, any traffic received by **vm-nva** destined for a different IP address isn't dropped and is forwarded to the correct destination.
550
550
551
551
### Enable IP forwarding in Azure
552
552
@@ -820,7 +820,7 @@ Test routing of network traffic from **vm-public** to **vm-private**. Test routi
820
820
Resume: pmtu 1500 hops 2 back 1
821
821
```
822
822
823
-
You can see that there are two hops inthe above response for**`tracepath`** ICMP traffic from **vm-public** to **vm-private**. The first hop is **vm-nva**. The second hop is the destination **vm-private**.
823
+
You can see that there are two hops inthis response for**`tracepath`** ICMP traffic from **vm-public** to **vm-private**. The first hop is **vm-nva**. The second hop is the destination **vm-private**.
824
824
825
825
Azure sent the traffic from **subnet-1** through the NVA and not directly to **subnet-private** because you previously added the **to-private-subnet** route to **route-table-public** and associated it to **subnet-1**.
826
826
@@ -854,7 +854,7 @@ Test routing of network traffic from **vm-public** to **vm-private**. Test routi
854
854
Resume: pmtu 1500 hops 1 back 2
855
855
```
856
856
857
-
You can see that there's one hop in the above response, which is the destination **vm-public**.
857
+
You can see there's one hop in this response, which is the destination **vm-public**.
858
858
859
859
Azure sent the traffic directly from **subnet-private** to **subnet-1**. By default, Azure routes traffic directly between subnets.
860
860
@@ -899,7 +899,7 @@ In this tutorial, you:
899
899
900
900
You can deploy different preconfigured NVAs from the [Azure Marketplace](https://azuremarketplace.microsoft.com/marketplace/apps/category/networking), which provide many useful network functions.
901
901
902
-
To learn more about routing, see [Routing overview](virtual-networks-udr-overview.md) and [Manage a route table](manage-route-table.yml).
902
+
To learn more about routing, see [Routing overview](virtual-networks-udr-overview.md) and [Manage a route table](manage-route-table.yml). Routing can also be automatically configured at scale with [Azure Virtual Network Manager's user-defined route (UDR) management](../virtual-network-manager/concept-user-defined-route.md) feature.
903
903
904
904
To learn how to restrict network access to PaaS resources with virtual network service endpoints, advance to the next tutorial.
0 commit comments