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
PublicIpAddressName = $null # No public IP address
419
+
PublicIpAddressName = "" # No public IP address
424
420
SshKeyName = "vm-nva-ssh-key"
421
+
GenerateSshKey = $true
425
422
}
426
423
427
424
# Create the virtual machine
@@ -551,25 +548,19 @@ The public virtual machine is used to simulate a machine in the public internet.
551
548
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.
PublicIpAddressName = $null # No public IP address
583
+
PublicIpAddressName = "" # No public IP address
600
584
SshKeyName = "vm-private-ssh-key"
585
+
GenerateSshKey = $true
601
586
}
602
587
603
588
# Create the virtual machine
@@ -699,6 +684,8 @@ az network nic update \
699
684
700
685
In this section, turn on IP forwarding for the operating system of the **vm-nva** virtual machine to forward network traffic. Use the Run Command feature to execute a script on the virtual machine.
701
686
687
+
### [Portal](#tab/portal)
688
+
702
689
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
703
690
704
691
1. In **Virtual machines**, select **vm-nva**.
@@ -720,6 +707,37 @@ In this section, turn on IP forwarding for the operating system of the **vm-nva*
720
707
721
708
1. Return to the **Overview** page of **vm-nva** and select**Restart** to restart the virtual machine.
722
709
710
+
### [PowerShell](#tab/powershell)
711
+
712
+
Enable IP forwarding in the operating system of the **vm-nva** virtual machine with [Invoke-AzVMRunCommand](/powershell/module/az.compute/invoke-azvmruncommand). The following example enables IP forwarding in the operating system.
713
+
714
+
```azurepowershell-interactive
715
+
$runCommandParams = @{
716
+
ResourceGroupName = "test-rg"
717
+
VMName = "vm-nva"
718
+
CommandId = "RunShellScript"
719
+
ScriptString = @"
720
+
sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
721
+
sudo sysctl -p
722
+
"@
723
+
}
724
+
Invoke-AzVMRunCommand @runCommandParams
725
+
```
726
+
727
+
### [CLI](#tab/cli)
728
+
729
+
Enable IP forwarding in the operating system of the **vm-nva** virtual machine with [az vm run-command invoke](/cli/azure/vm/run-command). The following example enables IP forwarding in the operating system.
730
+
731
+
```azurecli-interactive
732
+
az vm run-command invoke \
733
+
--resource-group test-rg \
734
+
--name vm-nva \
735
+
--command-id RunShellScript \
736
+
--scripts "sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf""sudo sysctl -p"
737
+
```
738
+
739
+
---
740
+
723
741
## Create a route table
724
742
725
743
In this section, create a route table to define the route of the traffic through the NVA virtual machine. The route table is associated to the **subnet-1** subnet where the **vm-public** virtual machine is deployed.
0 commit comments