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
Copy file name to clipboardExpand all lines: articles/virtual-network/tutorial-create-route-table-portal.md
+164Lines changed: 164 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,6 +210,66 @@ az group create \
210
210
--location eastus2
211
211
```
212
212
213
+
Create a virtual network with one subnet with [az network vnet create](/cli/azure/network/vnet).
214
+
215
+
```azurecli-interactive
216
+
az network vnet create \
217
+
--name vnet-1 \
218
+
--resource-group test-rg \
219
+
--address-prefix 10.0.0.0/16 \
220
+
--subnet-name subnet-1 \
221
+
--subnet-prefix 10.0.0.0/24
222
+
```
223
+
224
+
Create two more subnets with [az network vnet subnet create](/cli/azure/network/vnet/subnet).
225
+
226
+
```azurecli-interactive
227
+
# Create a bastion subnet.
228
+
az network vnet subnet create \
229
+
--vnet-name vnet-1 \
230
+
--resource-group test-rg \
231
+
--name AzureBastionSubnet \
232
+
--address-prefix 10.0.1.0/24
233
+
234
+
# Create a private subnet.
235
+
az network vnet subnet create \
236
+
--vnet-name vnet-1 \
237
+
--resource-group test-rg \
238
+
--name subnet-private \
239
+
--address-prefix 10.0.2.0/24
240
+
241
+
# Create a DMZ subnet.
242
+
az network vnet subnet create \
243
+
--vnet-name vnet-1 \
244
+
--resource-group test-rg \
245
+
--name subnet-dmz \
246
+
--address-prefix 10.0.3.0/24
247
+
```
248
+
249
+
### Create Azure Bastion
250
+
251
+
Create a public IP address for the Azure Bastion host with [az network public-ip create](/cli/azure/network/public-ip). The following example creates a public IP address named *public-ip-bastion* in the *vnet-1* virtual network.
252
+
253
+
```azurecli-interactive
254
+
az network public-ip create \
255
+
--resource-group test-rg \
256
+
--name public-ip-bastion \
257
+
--location eastus2 \
258
+
--allocation-method Static \
259
+
--sku Standard
260
+
```
261
+
262
+
Create an Azure Bastion host with [az network bastion create](/cli/azure/network/bastion). The following example creates an Azure Bastion host named *bastion* in the *AzureBastionSubnet* subnet of the *vnet-1* virtual network. Azure Bastion is used to securely connect Azure virtual machines without exposing them to the public internet.
263
+
264
+
```azurecli-interactive
265
+
az network bastion create \
266
+
--resource-group test-rg \
267
+
--name bastion \
268
+
--vnet-name vnet-1 \
269
+
--public-ip-address public-ip-bastion \
270
+
--location eastus2
271
+
```
272
+
213
273
---
214
274
215
275
## Create an NVA virtual machine
@@ -291,6 +351,35 @@ New-AzVM @vmParams
291
351
292
352
### [CLI](#tab/cli)
293
353
354
+
Create a VM to be used as the NVA in the *subnet-dmz* subnet with [az vm create](/cli/azure/vm). When you create a VM, Azure creates and assigns a network interface *vm-nvaVMNic* and a subnet-public IP address to the VM, by default. The `--public-ip-address ""` parameter instructs Azure not to create and assign a subnet-public IP address to the VM, since the VM doesn't need to be connected to from the internet.
355
+
356
+
```azurecli-interactive
357
+
az vm create \
358
+
--resource-group test-rg \
359
+
--name vm-nva \
360
+
--image Ubuntu2204 \
361
+
--public-ip-address "" \
362
+
--subnet subnet-dmz \
363
+
--vnet-name vnet-1 \
364
+
--admin-username azureuser \
365
+
--authentication-type password
366
+
```
367
+
368
+
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.
369
+
370
+
Within the VM, the operating system, or an application running within the VM, must also be able to forward network traffic. We use the `sysctl` command to enable the Linux kernel to forward packets. To run this command without logging onto the VM, we use the [Custom Script extension](/azure/virtual-machines/extensions/custom-script-linux)[az vm extension set](/cli/azure/vm/extension):
The command might take up to a minute to execute. This change won't persist after a VM reboot, so if the NVA VM is rebooted for any reason, the script will need to be repeated.
382
+
294
383
---
295
384
296
385
## Create public and private virtual machines
@@ -443,6 +532,32 @@ The VM takes a few minutes to create. Don't continue with the next step until th
443
532
444
533
### [CLI](#tab/cli)
445
534
535
+
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.
Enable IP forwarding for the network interface of the **vm-nva** virtual machine with [az network nic update](/cli/azure/network/nic). The following example enables IP forwarding for the network interface named *vm-nvaVMNic*.
Create a route table with [az network route-table create](/cli/azure/network/route-table#az-network-route-table-create). The following example creates a route table named *route-table-public*.
775
+
776
+
```azurecli-interactive
777
+
# Create a route table
778
+
az network route-table create \
779
+
--resource-group test-rg \
780
+
--name route-table-public
781
+
```
782
+
783
+
Create a route in the route table with [az network route-table route create](/cli/azure/network/route-table/route#az-network-route-table-route-create).
784
+
785
+
```azurecli-interactive
786
+
az network route-table route create \
787
+
--name to-private-subnet \
788
+
--resource-group test-rg \
789
+
--route-table-name route-table-public \
790
+
--address-prefix 10.0.2.0/24 \
791
+
--next-hop-type VirtualAppliance \
792
+
--next-hop-ip-address 10.0.3.4
793
+
```
794
+
795
+
Associate the *route-table-subnet-public* route table to the *subnet-1* subnet with [az network vnet subnet update](/cli/azure/network/vnet/subnet).
0 commit comments