Skip to content

Commit 72c8ac5

Browse files
authored
Merge pull request #191034 from asudbring/lb-portfoward-edit
Freshness update of inbound nat rules tutorial for load balancer
2 parents eb0efc3 + f6c1cc4 commit 72c8ac5

File tree

5 files changed

+82
-81
lines changed

5 files changed

+82
-81
lines changed

articles/load-balancer/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
href: tutorial-load-balancer-standard-public-zonal-portal.md
3232
- name: Load balance VMs with multiple availability sets
3333
href: tutorial-multi-availability-sets-portal.md
34-
- name: Configure port forwarding in Load Balancer
34+
- name: Create a single instance inbound NAT rule
3535
href: tutorial-load-balancer-port-forwarding-portal.md
3636
- name: Load balance multiple IP configurations
3737
href: load-balancer-multiple-ip.md
-405 Bytes
Loading
-103 KB
Loading
1.9 KB
Loading

articles/load-balancer/tutorial-load-balancer-port-forwarding-portal.md

Lines changed: 81 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
---
2-
title: "Tutorial: Configure port forwarding - Azure portal"
2+
title: "Tutorial: Create a single instance inbound NAT rule - Azure portal"
33
titleSuffix: Azure Load Balancer
4-
description: This tutorial shows how to configure port forwarding using Azure Load Balancer to create connections to VMs in an Azure virtual network.
4+
description: This tutorial shows how to configure port forwarding using Azure Load Balancer to create a connection to a single virtual machine in an Azure virtual network.
55
author: asudbring
66
ms.author: allensu
77
ms.service: load-balancer
88
ms.topic: tutorial
9-
ms.date: 12/06/2021
9+
ms.date: 03/08/2022
1010
ms.custom: template-tutorial
1111
---
1212

13+
# Tutorial: Create a single instance inbound NAT rule using the Azure portal
1314

14-
15-
# Tutorial: Configure port forwarding in Azure Load Balancer using the Azure portal
16-
17-
Port forwarding lets you connect to virtual machines (VMs) in an Azure virtual network by using an Azure Load Balancer public IP address and port number.
15+
Inbound NAT rules allow you to connect to virtual machines (VMs) in an Azure virtual network by using an Azure Load Balancer public IP address and port number.
1816

1917
For more information about Azure Load Balancer rules, see [Manage rules for Azure Load Balancer using the Azure portal](manage-rules-how-to.md).
2018

2119
In this tutorial, you learn how to:
2220

2321
> [!div class="checklist"]
24-
> * Create a virtual network and virtual machines.
25-
> * Create a NAT gateway for outbound internet access for the backend pool.
26-
> * Create a standard SKU public load balancer with frontend IP, health probe, backend configuration, load-balancing rule, and inbound NAT rules.
27-
> * Install and configure a web server on the VMs to demonstrate the port forwarding and load-balancing rules.
22+
> * Create a virtual network and virtual machines
23+
> * Create a standard SKU public load balancer with frontend IP, health probe, backend configuration, load-balancing rule, and inbound NAT rules
24+
> * Create a NAT gateway for outbound internet access for the backend pool
25+
> * Install and configure a web server on the VMs to demonstrate the port forwarding and load-balancing rules
2826
2927
## Prerequisites
3028

@@ -38,9 +36,9 @@ A virtual network and subnet is required for the resources in the tutorial. In t
3836

3937
2. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
4038

41-
3. In **Virtual machines**, select **+ Create** > **Virtual machine**.
39+
3. In **Virtual machines**, select **+ Create** > **+ Virtual machine**.
4240

43-
4. In **Create a virtual machine**, type or select the values in the **Basics** tab:
41+
4. In **Create a virtual machine**, enter or select the following values in the **Basics** tab:
4442

4543
| Setting | Value |
4644
| ------- | ----- |
@@ -52,6 +50,7 @@ A virtual network and subnet is required for the resources in the tutorial. In t
5250
| Region | Enter **(US) West US 2**. |
5351
| Availability options | Select **Availability zone**. |
5452
| Availability zone | Enter **1**. |
53+
| Security type | Select **Standard**. |
5554
| Image | Select **Ubuntu Server 20.04 LTS - Gen2**. |
5655
| Azure Spot instance | Leave the default of unchecked. |
5756
| Size | Select a VM size. |
@@ -96,52 +95,14 @@ A virtual network and subnet is required for the resources in the tutorial. In t
9695
| Authentication type | **SSH public key** |
9796
| SSH public key source | Select **Use existing key stored in Azure**. |
9897
| Stored Keys | Select **myKey**. |
98+
| **Inbound port rules** | |
99+
| Public inbound ports | Select **None**. |
99100
| **Networking** | |
100101
| **Network interface** | |
101102
| Public IP | Select **None**. |
102103
| NIC network security group | Select **Advanced**. |
103104
| Configure network security group | Select the existing **myNSG** |
104105

105-
## Create NAT gateway
106-
107-
In this section, you'll create a NAT gateway for outbound internet access for resources in the virtual network.
108-
109-
For more information about outbound connections and Azure Virtual Network NAT, see [Using Source Network Address Translation (SNAT) for outbound connections](load-balancer-outbound-connections.md) and [What is Virtual Network NAT?](../virtual-network/nat-gateway/nat-overview.md).
110-
111-
1. In the search box at the top of the portal, enter **NAT gateway**. Select **NAT gateways** in the search results.
112-
113-
2. In **NAT gateways**, select **+ Create**.
114-
115-
3. In **Create network address translation (NAT) gateway**, enter or select the following information:
116-
117-
| Setting | Value |
118-
| ------- | ----- |
119-
| **Project details** | |
120-
| Subscription | Select your subscription. |
121-
| Resource group | Select **TutorialLBPF-rg**. |
122-
| **Instance details** | |
123-
| NAT gateway name | Enter **myNATgateway**. |
124-
| Availability zone | Select **None**. |
125-
| Idle timeout (minutes) | Enter **15**. |
126-
127-
4. Select the **Outbound IP** tab or select the **Next: Outbound IP** button at the bottom of the page.
128-
129-
5. In **Outbound IP**, select **Create a new public IP address** next to **Public IP addresses**.
130-
131-
6. Enter **myNATGatewayIP** in **Name** in **Add a public IP address**.
132-
133-
7. Select **OK**.
134-
135-
8. Select the **Subnet** tab or select the **Next: Subnet** button at the bottom of the page.
136-
137-
9. In **Virtual network** in the **Subnet** tab, select **myVNet**.
138-
139-
10. Select **myBackendSubnet** under **Subnet name**.
140-
141-
11. Select the blue **Review + create** button at the bottom of the page, or select the **Review + create** tab.
142-
143-
12. Select **Create**.
144-
145106
## Create load balancer
146107

147108
You'll create a load balancer in this section. The frontend IP, backend pool, load-balancing, and inbound NAT rules are configured as part of the creation.
@@ -159,17 +120,16 @@ You'll create a load balancer in this section. The frontend IP, backend pool, lo
159120
| Resource group | Select **TutorialLBPF-rg**. |
160121
| **Instance details** | |
161122
| Name | Enter **myLoadBalancer** |
162-
| Region | Select **(US) West US 2**. |
163-
| Type | Select **Public**. |
123+
| Region | Select **West US 2**. |
164124
| SKU | Leave the default **Standard**. |
125+
| Type | Select **Public**. |
165126
| Tier | Leave the default **Regional**. |
166127

167-
168128
4. Select **Next: Frontend IP configuration** at the bottom of the page.
169129

170130
5. In **Frontend IP configuration**, select **+ Add a frontend IP**.
171131

172-
6. Enter **LoadBalancerFrontend** in **Name**.
132+
6. Enter **myFrontend** in **Name**.
173133

174134
7. Select **IPv4** or **IPv6** for the **IP version**.
175135

@@ -227,12 +187,12 @@ You'll create a load balancer in this section. The frontend IP, backend pool, lo
227187
| ------- | ----- |
228188
| Name | Enter **myHTTPRule** |
229189
| IP Version | Select **IPv4** or **IPv6** depending on your requirements. |
230-
| Frontend IP address | Select **LoadBalancerFrontend**. |
190+
| Frontend IP address | Select **myFrontend**. |
191+
| Backend pool | Select **myBackendPool**. |
231192
| Protocol | Select **TCP**. |
232193
| Port | Enter **80**. |
233194
| Backend port | Enter **80**. |
234-
| Backend pool | Select **myBackendPool**. |
235-
| Health probe | Select **Create new**. </br> In **Name**, enter **myHealthProbe**. </br> Select **HTTP** in **Protocol**. </br> Leave the rest of the defaults, and select **OK**. |
195+
| Health probe | Select **Create new**. </br> In **Name**, enter **myHealthProbe**. </br> Select **TCP** in **Protocol**. </br> Leave the rest of the defaults, and select **OK**. |
236196
| Session persistence | Select **None**. |
237197
| Idle timeout (minutes) | Enter or select **15**. |
238198
| TCP reset | Select **Enabled**. |
@@ -250,17 +210,16 @@ You'll create a load balancer in this section. The frontend IP, backend pool, lo
250210
| Setting | Value |
251211
| ------- | ----- |
252212
| Name | Enter **myNATRuleVM1-221**. |
253-
| Frontend IP address | Select **LoadBalancerFrontend**. |
254-
| Service | Select **Custom**. |
255-
| Protocol | Leave the default of **TCP**. |
256-
| Idle timeout (minutes) | Enter or select **15**. |
257-
| TCP Reset | Select **Enabled**. |
258-
| Port | Enter **221**. |
259213
| Target virtual machine | Select **myVM1**. |
260214
| Network IP configuration | Select **ipconfig1 (10.1.0.4)**. |
261-
| Port mapping | Select **Custom**. |
215+
| Frontend IP address | Select **myFrontend**. |
216+
| Frontend Port | Enter **221**. |
217+
| Service Tag | Select **Custom**. |
218+
| Backend port | Enter **22**. |
219+
| Protocol | Leave the default of **TCP**. |
220+
| TCP Reset | Leave the default of unchecked. |
221+
| Idle timeout (minutes) | Leave the default **4**. |
262222
| Floating IP | Leave the default of **Disabled**. |
263-
| Target port | Enter **22**. |
264223

265224
28. Select **Add**.
266225

@@ -271,24 +230,64 @@ You'll create a load balancer in this section. The frontend IP, backend pool, lo
271230
| Setting | Value |
272231
| ------- | ----- |
273232
| Name | Enter **myNATRuleVM2-222**. |
274-
| Frontend IP address | Select **LoadBalancerFrontend**. |
275-
| Service | Select **Custom**. |
276-
| Protocol | Leave the default of **TCP**. |
277-
| Idle timeout (minutes) | Enter or select **15**. |
278-
| TCP Reset | Select **Enabled**. |
279-
| Port | Enter **222**. |
280233
| Target virtual machine | Select **myVM2**. |
281234
| Network IP configuration | Select **ipconfig1 (10.1.0.5)**. |
282-
| Port mapping | Select **Custom**. |
235+
| Frontend IP address | Select **myFrontend**. |
236+
| Frontend Port | Enter **222**. |
237+
| Service Tag | Select **Custom**. |
238+
| Backend port | Enter **22**. |
239+
| Protocol | Leave the default of **TCP**. |
240+
| TCP Reset | Leave the default of unchecked. |
241+
| Idle timeout (minutes) | Leave the default **4**. |
283242
| Floating IP | Leave the default of **Disabled**. |
284-
| Target port | Enter **22**. |
285243

286244
31. Select **Add**.
287245

288246
32. Select the blue **Review + create** button at the bottom of the page.
289247

290248
33. Select **Create**.
291249

250+
## Create NAT gateway
251+
252+
In this section, you'll create a NAT gateway for outbound internet access for resources in the virtual network.
253+
254+
For more information about outbound connections and Azure Virtual Network NAT, see [Using Source Network Address Translation (SNAT) for outbound connections](load-balancer-outbound-connections.md) and [What is Virtual Network NAT?](../virtual-network/nat-gateway/nat-overview.md).
255+
256+
1. In the search box at the top of the portal, enter **NAT gateway**. Select **NAT gateways** in the search results.
257+
258+
2. In **NAT gateways**, select **+ Create**.
259+
260+
3. In **Create network address translation (NAT) gateway**, enter or select the following information:
261+
262+
| Setting | Value |
263+
| ------- | ----- |
264+
| **Project details** | |
265+
| Subscription | Select your subscription. |
266+
| Resource group | Select **TutorialLBPF-rg**. |
267+
| **Instance details** | |
268+
| NAT gateway name | Enter **myNATgateway**. |
269+
| Region | Select **West US 2**. |
270+
| Availability zone | Select **None**. |
271+
| Idle timeout (minutes) | Enter **15**. |
272+
273+
4. Select the **Outbound IP** tab or select the **Next: Outbound IP** button at the bottom of the page.
274+
275+
5. In **Outbound IP**, select **Create a new public IP address** next to **Public IP addresses**.
276+
277+
6. Enter **myNATGatewayIP** in **Name** in **Add a public IP address**.
278+
279+
7. Select **OK**.
280+
281+
8. Select the **Subnet** tab or select the **Next: Subnet** button at the bottom of the page.
282+
283+
9. In **Virtual network** in the **Subnet** tab, select **myVNet**.
284+
285+
10. Select **myBackendSubnet** under **Subnet name**.
286+
287+
11. Select the blue **Review + create** button at the bottom of the page, or select the **Review + create** tab.
288+
289+
12. Select **Create**.
290+
292291
## Install web server
293292

294293
In this section, you'll SSH to the virtual machines through the inbound NAT rules and install a web server.
@@ -297,7 +296,9 @@ In this section, you'll SSH to the virtual machines through the inbound NAT rule
297296

298297
2. Select **myLoadBalancer**.
299298

300-
3. In the **Overview** page of **myLoadBalancer**, make note of the **Public IP address**. In this example, it's **20.190.2.163**.
299+
3. Select **Fronted IP configuration** in **Settings**.
300+
301+
3. In the **Frontend IP configuration**, make note of the **IP address** for **myFrontend**. In this example, it's **20.99.165.176**.
301302

302303
:::image type="content" source="./media/tutorial-load-balancer-port-forwarding-portal/get-public-ip.png" alt-text="Screenshot of public IP in Azure portal.":::
303304

@@ -306,7 +307,7 @@ In this section, you'll SSH to the virtual machines through the inbound NAT rule
306307
5. At your prompt, open an SSH connection to **myVM1**. Replace the IP address with the address you retrieved in the previous step and port **221** you used for the myVM1 inbound NAT rule. Replace the path to the .pem with the path to where the key file was downloaded.
307308

308309
```console
309-
ssh -i .\Downloads\myKey.pem azureuser@20.190.2.163 -p 221
310+
ssh -i .\Downloads\myKey.pem azureuser@20.99.165.176 -p 221
310311
```
311312

312313
> [!TIP]
@@ -324,7 +325,7 @@ In this section, you'll SSH to the virtual machines through the inbound NAT rule
324325
8. At your prompt, open an SSH connection to **myVM2**. Replace the IP address with the address you retrieved in the previous step and port **222** you used for the myVM2 inbound NAT rule. Replace the path to the .pem with the path to where the key file was downloaded.
325326

326327
```console
327-
ssh -i .\Downloads\myKey.pem azureuser@20.190.2.163 -p 222
328+
ssh -i .\Downloads\myKey.pem azureuser@20.99.165.176 -p 222
328329
```
329330

330331
9. From your SSH session, update your package sources and then install the latest NGINX package.
@@ -342,7 +343,7 @@ You'll open your web browser in this section and enter the IP address for the lo
342343

343344
1. Open your web browser.
344345

345-
2. In the address bar, enter the IP address for the load balancer. In this example, it's **20.190.2.163**.
346+
2. In the address bar, enter the IP address for the load balancer. In this example, it's **20.99.165.176**.
346347

347348
3. The default NGINX website is displayed.
348349

0 commit comments

Comments
 (0)