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
1. Sign in to the [Azure portal](https://portal.azure.com).
70
+
71
+
1. In the search box at the top of the portal, enter **Resource group**. Select **Resource groups** in the search results.
72
+
73
+
1. Select **+ Create**.
74
+
75
+
1. In the **Basics** tab of **Create a resource group**, enter or select the following information:
76
+
77
+
| Setting | Value |
78
+
| ------- | ----- |
79
+
| Subscription | Select your subscription. |
80
+
| Resource group | Enter **test-rg**. |
81
+
| Region | Select **East US 2**. |
82
+
83
+
1. Select **Review + create**.
84
+
85
+
1. Select **Create**.
86
+
87
+
## Create a virtual network
68
88
69
89
1. In the search box at the top of the portal, enter **Virtual network**. Select **Virtual networks** in the search results.
70
90
71
-
1.In**Virtual networks**, select **vnet-1**.
91
+
1.Select**+ Create**.
72
92
73
-
1.In **vnet-1**, select **Subnets** from the **Settings** section.
93
+
1.On the **Basics** tab of **Create virtual network**, enter or select the following information:
74
94
75
-
1. In the virtual network's subnet list, select **+ Subnet**.
95
+
| Setting | Value |
96
+
|---|---|
97
+
|**Project details**||
98
+
| Subscription | Select your subscription. |
99
+
| Resource group | Select **test-rg**. |
100
+
|**Instance details**||
101
+
| Name | Enter **vnet-1**. |
102
+
| Region | Select **East US 2**. |
103
+
104
+
1. Select **Next** to proceed to the **Security** tab.
76
105
77
-
1. In **Add subnet**, enter or select the following information:
106
+
1. Select **Next** to proceed to the **IP Addresses** tab.
107
+
108
+
1. In the address space box in **Subnets**, select the **default** subnet.
109
+
110
+
1. In **Edit subnet**, enter or select the following information:
111
+
112
+
| Setting | Value |
113
+
|---|---|
114
+
|**Subnet details**||
115
+
| Subnet template | Leave the default **Default**. |
116
+
| Name | Enter **subnet-1**. |
117
+
| Starting address | Leave the default of **10.0.0.0**. |
118
+
| Subnet size | Leave the default of **/24 (256 addresses)**. |
119
+
120
+
1. Select **Save**.
121
+
122
+
1. Select **+ Add a subnet**.
123
+
124
+
1. In **Add a subnet**, enter or select the following information:
78
125
79
126
| Setting | Value |
80
127
| ------- | ----- |
81
-
| Subnet purpose | Leave the default of **Default**. |
128
+
|**Subnet details**||
129
+
| Subnet template | Leave the default **Default**. |
82
130
| Name | Enter **subnet-private**. |
83
-
|**IPv4**|
84
-
| IPv4 address range | Leave the default of **10.0.0.0/16**. |
85
131
| Starting address | Enter **10.0.2.0**. |
86
-
|Size| Leave the default of **/24 (256 addresses)**. |
132
+
|Subnet size| Leave the default of **/24 (256 addresses)**. |
87
133
88
134
1. Select **Add**.
89
135
90
-
1. Select **+ Subnet**.
136
+
1. Select **+ Add a subnet**.
91
137
92
-
1. In **Add subnet**, enter or select the following information:
138
+
1. In **Add a subnet**, enter or select the following information:
93
139
94
140
| Setting | Value |
95
141
| ------- | ----- |
96
-
| Subnet purpose | Leave the default of **Default**. |
142
+
|**Subnet details**||
143
+
| Subnet template | Leave the default **Default**. |
97
144
| Name | Enter **subnet-dmz**. |
98
-
|**IPv4**|
99
-
| IPv4 address range | Leave the default of **10.0.0.0/16**. |
100
145
| Starting address | Enter **10.0.3.0**. |
101
-
|Size| Leave the default of **/24 (256 addresses)**. |
146
+
|Subnet size| Leave the default of **/24 (256 addresses)**. |
102
147
103
148
1. Select **Add**.
104
149
150
+
1. Select **Review + create** at the bottom of the screen, and when validation passes, select **Create**.
151
+
152
+
## Deploy Azure Bastion
153
+
154
+
Azure Bastion uses your browser to connect to VMs in your virtual network over secure shell (SSH) or remote desktop protocol (RDP) by using their private IP addresses. The VMs don't need public IP addresses, client software, or special configuration. For more information about Azure Bastion, see [Azure Bastion](/azure/bastion/bastion-overview).
1. In the search box at the top of the portal, enter **Bastion**. Select **Bastions** in the search results.
160
+
161
+
1. Select **+ Create**.
162
+
163
+
1. In the **Basics** tab of **Create a Bastion**, enter or select the following information:
164
+
165
+
| Setting | Value |
166
+
|---|---|
167
+
|**Project details**||
168
+
| Subscription | Select your subscription. |
169
+
| Resource group | Select **test-rg**. |
170
+
|**Instance details**||
171
+
| Name | Enter **bastion**. |
172
+
| Region | Select **East US 2**. |
173
+
| Tier | Select **Developer**. |
174
+
|**Configure virtual networks**||
175
+
| Virtual network | Select **vnet-1**. |
176
+
| Subnet | The **AzureBastionSubnet** is created automatically with an address space of **/26** or larger. |
177
+
178
+
1. Select **Review + create**.
179
+
180
+
1. Select **Create**.
181
+
105
182
### [PowerShell](#tab/powershell)
106
183
107
184
Create a resource group with [New-AzResourceGroup](/powershell/module/az.resources/new-azresourcegroup). The following example creates a resource group named *test-rg* for all resources created in this article.
@@ -191,6 +268,7 @@ $bastionParams = @{
191
268
PublicIpAddressName = "public-ip-bastion"
192
269
PublicIpAddressRgName = "test-rg"
193
270
VirtualNetworkRgName = "test-rg"
271
+
Sku = "Basic"
194
272
}
195
273
New-AzBastion @bastionParams -AsJob
196
274
```
@@ -263,7 +341,8 @@ az network bastion create \
263
341
--name bastion \
264
342
--vnet-name vnet-1 \
265
343
--public-ip-address public-ip-bastion \
266
-
--location eastus2
344
+
--location eastus2 \
345
+
--sku Basic \
267
346
--no-wait
268
347
```
269
348
@@ -295,10 +374,10 @@ Network virtual appliances (NVAs) are virtual machines that help with network fu
295
374
| VM architecture | Leave the default of **x64**. |
296
375
| Size | Select a size. |
297
376
|**Administrator account**||
298
-
| Authentication type | Select **Password**. |
377
+
| Authentication type | Select **SSH public key**. |
299
378
| Username | Enter a username. |
300
-
|Password | Enter a password. |
301
-
|Confirm password | Reenter password. |
379
+
|SSH public key source | Select **Generate new key pair**. |
380
+
|Key pair name | Enter **vm-nva-key**. |
302
381
|**Inbound port rules**||
303
382
| Public inbound ports | Select **None**. |
304
383
@@ -324,8 +403,13 @@ Network virtual appliances (NVAs) are virtual machines that help with network fu
324
403
Create the virtual machine with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a virtual machine named *vm-nva*.
PublicIpAddressName = $null # No public IP address
424
+
SshKeyName = "vm-nva-ssh-key"
341
425
}
342
426
343
427
# Create the virtual machine
@@ -394,10 +478,10 @@ The public virtual machine is used to simulate a machine in the public internet.
394
478
| VM architecture | Leave the default of **x64**. |
395
479
| Size | Select a size. |
396
480
|**Administrator account**||
397
-
| Authentication type | Select **Password**. |
481
+
| Authentication type | Select **SSH public key**. |
398
482
| Username | Enter a username. |
399
-
|Password | Enter a password. |
400
-
|Confirm password | Reenter password. |
483
+
|SSH public key source | Select **Generate new key pair**. |
484
+
|Key pair name | Enter **vm-public-key**. |
401
485
|**Inbound port rules**||
402
486
| Public inbound ports | Select **None**. |
403
487
@@ -439,10 +523,10 @@ The public virtual machine is used to simulate a machine in the public internet.
439
523
| VM architecture | Leave the default of **x64**. |
440
524
| Size | Select a size. |
441
525
|**Administrator account**||
442
-
| Authentication type | Select **Password**. |
526
+
| Authentication type | Select **SSH public key**. |
443
527
| Username | Enter a username. |
444
-
|Password | Enter a password. |
445
-
|Confirm password | Reenter password. |
528
+
|SSH public key source | Select **Generate new key pair**. |
529
+
|Key pair name | Enter **vm-private-key**. |
446
530
|**Inbound port rules**||
447
531
| Public inbound ports | Select **None**. |
448
532
@@ -467,8 +551,13 @@ The public virtual machine is used to simulate a machine in the public internet.
467
551
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
600
+
SshKeyName = "vm-private-ssh-key"
507
601
}
508
602
509
603
# Create the virtual machine
@@ -603,40 +697,28 @@ az network nic update \
603
697
604
698
## Enable IP forwarding in the operating system
605
699
606
-
In this section, turn on IP forwarding for the operating system of the **vm-nva** virtual machine to forward network traffic. Use the Azure Bastion service to connect to the **vm-nva** virtual machine.
700
+
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.
607
701
608
702
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
609
703
610
704
1. In **Virtual machines**, select **vm-nva**.
611
705
612
-
1.Select**Connect**, then **Connect via Bastion** in the **Overview** section.
706
+
1.Expand**Operations** then select **Run command**.
613
707
614
-
1.Enter the username and password you entered when the virtual machine was created.
708
+
1.Select **RunShellScript**.
615
709
616
-
1. Select **Connect**.
617
-
618
-
1. Enter the following information at the prompt of the virtual machine to enable IP forwarding:
710
+
1. Enter the following script in the **Run Command Script** window:
619
711
620
712
```bash
621
-
sudo vim /etc/sysctl.conf
622
-
```
623
-
624
-
1. In the Vim editor, remove the **`#`** from the line **`net.ipv4.ip_forward=1`**:
625
-
626
-
Press the **Insert** key.
627
-
628
-
```bash
629
-
# Uncomment the next line to enable packet forwarding for IPv4
630
-
net.ipv4.ip_forward=1
713
+
sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
714
+
sudo sysctl -p
631
715
```
632
716
633
-
Press the **Esc** key.
634
-
635
-
Enter **`:wq`** and press **Enter**.
717
+
1. Select **Run**.
636
718
637
-
1. Close the Bastion session.
719
+
1. Wait forthe script to complete. The output shows the IP forwarding setting has been enabled.
638
720
639
-
1. Restart the virtual machine.
721
+
1. Return to the **Overview** page of **vm-nva** and select**Restart** to restart the virtual machine.
0 commit comments