Skip to content

Commit bc3e084

Browse files
authored
Merge pull request #190412 from asudbring/lb-nat-howto-portal
New how-to article for managing inbound NAT rules for Azure Load Balancer
2 parents 7b2a280 + 61b7423 commit bc3e084

File tree

8 files changed

+227
-0
lines changed

8 files changed

+227
-0
lines changed

articles/load-balancer/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
href: backend-pool-management.md
128128
- name: Migrate outbound access
129129
href: ../virtual-network/nat-gateway/tutorial-migrate-outbound-nat.md?toc=%2fazure%2fload-balancer%2ftoc.json
130+
- name: Manage inbound NAT rules
131+
href: manage-inbound-nat-rules.md
130132
- name: Manage health probes
131133
href: manage-probes-how-to.md
132134
- name: Manage load balancer rules
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
---
2+
title: Manage inbound NAT rules for Azure Load Balancer
3+
description: In this article, you'll learn how to add and remove and inbound NAT rule in the Azure portal.
4+
author: asudbring
5+
ms.author: allensu
6+
ms.service: load-balancer
7+
ms.topic: how-to
8+
ms.date: 03/10/2022
9+
ms.custom: template-how-to #Required; leave this attribute/value as-is.
10+
---
11+
# Manage inbound NAT rules for Azure Load Balancer using the Azure portal
12+
13+
An inbound NAT rule is used to forward traffic from a load balancer frontend to one or more instances in the backend pool.
14+
15+
There are two types of inbound NAT rule:
16+
17+
* Single instance - An inbound NAT rule that targets a single machine in the backend pool of the load balancer
18+
19+
* Multiple instance - An inbound NAT rule that targets multiple virtual machines in the backend pool of the load balancer
20+
21+
In this article, you'll learn how to add and remove an inbound NAT rule for both types. You'll learn how to change the frontend port allocation in a multiple instance inbound NAT rule.
22+
23+
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
24+
25+
[!INCLUDE [azure-cli-prepare-your-environment.md](../../includes/azure-cli-prepare-your-environment.md)]
26+
27+
- This quickstart requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
28+
29+
- A standard public load balancer in your subscription. For more information on creating an Azure Load Balancer, see [Quickstart: Create a public load balancer to load balance VMs using the Azure portal](quickstart-load-balancer-standard-public-portal.md). The load balancer name for the examples in this article is **myLoadBalancer**.
30+
31+
## Add a single instance inbound NAT rule
32+
33+
# [**Portal**](#tab/inbound-nat-rule-portal)
34+
35+
In this example, you'll create an inbound NAT rule to forward port 500 to backend port 443.
36+
37+
1. Sign in to the [Azure portal](https://portal.azure.com).
38+
39+
2. In the search box at the top of the portal, enter **Load balancer**. Select **Load balancers** in the search results.
40+
41+
3. Select **myLoadBalancer** or your load balancer.
42+
43+
4. In the load balancer page, select **Inbound NAT rules** in **Settings**.
44+
45+
5. Select **+ Add** in **Inbound NAT rules** to add the rule.
46+
47+
:::image type="content" source="./media/manage-inbound-nat-rules/add-rule.png" alt-text="Screenshot of the inbound NAT rules page for Azure Load Balancer":::
48+
49+
6. Enter or select the following information in **Add inbound NAT rule**.
50+
51+
| Setting | Value |
52+
| ------- | ----- |
53+
| Name | Enter **myInboundNATrule**. |
54+
| Type | Select **Azure Virtual Machine**. |
55+
| Target virtual machine | Select the virtual machine that you wish to forward the port to. In this example, it's **myVM1**. |
56+
| Network IP configuration | Select the IP configuration of the virtual machine. In this example, it's **ipconfig1(10.1.0.4)**. |
57+
| Frontend IP address | Select **myFrontend**. |
58+
| Frontend Port | Enter **500**. |
59+
| Service Tag | Leave the default of **Custom**. |
60+
| Backend port | Enter **443**. |
61+
| Protocol | Select **TCP**. |
62+
63+
7. Leave the rest of the settings at the defaults and select **Add**.
64+
65+
:::image type="content" source="./media/manage-inbound-nat-rules/add-single-instance-rule.png" alt-text="Screenshot of the create inbound NAT rule page":::
66+
67+
# [**CLI**](#tab/inbound-nat-rule-cli)
68+
69+
In this example, you'll create an inbound NAT rule to forward port 500 to backend port 443.
70+
71+
Use [az network lb inbound-nat-rule create](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-create) to create the NAT rule.
72+
73+
```azurecli
74+
az network lb inbound-nat-rule create \
75+
--backend-port 443 \
76+
--lb-name myLoadBalancer \
77+
--name myInboundNATrule \
78+
--protocol Tcp \
79+
--resource-group myResourceGroup \
80+
--backend-pool-name myBackendPool \
81+
--frontend-ip-name myFrontend \
82+
--frontend-port 500
83+
```
84+
---
85+
86+
## Add a multiple instance inbound NAT rule
87+
88+
# [**Portal**](#tab/inbound-nat-rule-portal)
89+
90+
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443.
91+
92+
1. Sign in to the [Azure portal](https://portal.azure.com).
93+
94+
2. In the search box at the top of the portal, enter **Load balancer**. Select **Load balancers** in the search results.
95+
96+
3. Select **myLoadBalancer** or your load balancer.
97+
98+
4. In the load balancer page, select **Inbound NAT rules** in **Settings**.
99+
100+
5. Select **+ Add** in **Inbound NAT rules** to add the rule.
101+
102+
:::image type="content" source="./media/manage-inbound-nat-rules/add-rule.png" alt-text="Screenshot of the inbound NAT rules page for Azure Load Balancer":::
103+
104+
6. Enter or select the following information in **Add inbound NAT rule**.
105+
106+
| Setting | Value |
107+
| ------- | ----- |
108+
| Name | Enter **myInboundNATrule**. |
109+
| Type | Select **Backend pool**. |
110+
| Target backend pool | Select your backend pool. In this example, it's **myBackendPool**. |
111+
| Frontend IP address | Select your frontend IP address. In this example, it's **myFrontend**. |
112+
| Frontend port range start | Enter **500**. |
113+
| Maximum number of machines in backend pool | Enter **1000**. |
114+
| Backend port | Enter **443**. |
115+
| Protocol | Select **TCP**. |
116+
117+
7. Leave the rest at the defaults and select **Add**.
118+
119+
:::image type="content" source="./media/manage-inbound-nat-rules/add-inbound-nat-rule.png" alt-text="Screenshot of the add inbound NAT rules page":::
120+
121+
# [**CLI**](#tab/inbound-nat-rule-cli)
122+
123+
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443.
124+
125+
Use [az network lb inbound-nat-rule create](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-create) to create the NAT rule.
126+
127+
```azurecli
128+
az network lb inbound-nat-rule create \
129+
--backend-port 443 \
130+
--lb-name myLoadBalancer \
131+
--name myInboundNATrule \
132+
--protocol Tcp \
133+
--resource-group myResourceGroup \
134+
--backend-pool-name myBackendPool \
135+
--frontend-ip-name myFrontend \
136+
--frontend-port-range-end 1000 \
137+
--frontend-port-range-start 500
138+
139+
```
140+
141+
---
142+
143+
## Change frontend port allocation
144+
145+
# [**Portal**](#tab/inbound-nat-rule-portal)
146+
147+
To accommodate more virtual machines in the backend pool in a multiple instance rule, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the frontend port allocation from 500 to 1000.
148+
149+
1. Sign in to the [Azure portal](https://portal.azure.com).
150+
151+
2. In the search box at the top of the portal, enter **Load balancer**. Select **Load balancers** in the search results.
152+
153+
3. Select **myLoadBalancer** or your load balancer.
154+
155+
4. In the load balancer page, select **Inbound NAT rules** in **Settings**.
156+
157+
5. Select the inbound NAT rule you wish to change. In this example, it's **myInboundNATrule**.
158+
159+
:::image type="content" source="./media/manage-inbound-nat-rules/select-inbound-nat-rule.png" alt-text="Screenshot of inbound NAT rule overview.":::
160+
161+
6. In the properties of the inbound NAT rule, change the value in **Frontend port range start** to **1000**.
162+
163+
7. Select **Save**.
164+
165+
:::image type="content" source="./media/manage-inbound-nat-rules/change-frontend-ports.png" alt-text="Screenshot of inbound NAT rule properties page.":::
166+
167+
# [**CLI**](#tab/inbound-nat-rule-cli)
168+
169+
To accommodate more virtual machines in the backend pool, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the frontend port allocation from 500 to 1000.
170+
171+
Use [az network lb inbound-nat-rule update](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-update) to change the frontend port allocation.
172+
173+
```azurecli
174+
az network lb inbound-nat-rule update \
175+
--frontend-port-range-start 1000 \
176+
--lb-name myLoadBalancer \
177+
--name myInboundNATrule \
178+
--resource-group myResourceGroup
179+
180+
```
181+
182+
---
183+
184+
## Remove an inbound NAT rule
185+
186+
# [**Portal**](#tab/inbound-nat-rule-portal)
187+
188+
In this example, you'll remove an inbound NAT rule.
189+
190+
1. Sign in to the [Azure portal](https://portal.azure.com).
191+
192+
2. In the search box at the top of the portal, enter **Load balancer**. Select **Load balancers** in the search results.
193+
194+
3. Select **myLoadBalancer** or your load balancer.
195+
196+
4. In the load balancer page in, select **Inbound NAT rules** in **Settings**.
197+
198+
5. Select the three dots next to the rule you want to remove.
199+
200+
6. Select **Delete**.
201+
202+
:::image type="content" source="./media/manage-inbound-nat-rules/remove-inbound-nat-rule.png" alt-text="Screenshot of inbound NAT rule removal.":::
203+
204+
# [**CLI**](#tab/inbound-nat-rule-cli)
205+
206+
In this example, you'll remove an inbound NAT rule.
207+
208+
Use [az network lb inbound-nat-rule delete](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-delete) to remove the NAT rule.
209+
210+
```azurecli
211+
az network lb inbound-nat-rule delete \
212+
--lb-name myLoadBalancer \
213+
--name myInboundNATrule \
214+
--resource-group myResourceGroup
215+
```
216+
217+
---
218+
219+
## Next steps
220+
221+
In this article, you learned how to manage inbound NAT rules for an Azure Load Balancer.
222+
223+
For more information about Azure Load Balancer, see:
224+
- [What is Azure Load Balancer?](load-balancer-overview.md)
225+
- [Frequently asked questions - Azure Load Balancer](load-balancer-faqs.yml)
95.6 KB
Loading
105 KB
Loading
110 KB
Loading
255 KB
Loading
111 KB
Loading
97.9 KB
Loading

0 commit comments

Comments
 (0)