Skip to content

Commit 7f3e546

Browse files
author
Michael Bender
committed
1 parent f5e4f7d commit 7f3e546

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

articles/load-balancer/load-balancer-nat-pool-migration.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Migrate from Inbound NAT rules version 1 to version 2
3-
description: Learn how to migrate from Inbound NAT rules version 1 to version 2 in Azure Load Balancer.
3+
description: Learn how to migrate Azure Load balancer from inbound NAT rules version 1 to version 2.
44
services: load-balancer
55
author: mbender-ms
66
ms.service: azure-load-balancer
@@ -13,12 +13,11 @@ ms.author: mbender
1313

1414
An [inbound NAT rule](inbound-nat-rules.md) is used to forward traffic from a load balancer’s frontend to one or more instances in the backend pool. These rules provide a 1:1 mapping between the load balancer’s frontend IP address and backend instances. There are currently two versions of Inbound NAT rules, version 1 and version 2.
1515

16-
:::image type="content" source="media/load-balancer-nat-pool-migration/load-balancer-inbound-nat-rule-flow.png" alt-text="Diagram of load balancer inbound nat rules":::
17-
## Version 1
16+
## NAT rule version 1
1817

19-
[Version 1](inbound-nat-rules.md) is the legacy approach for assigning an Azure Load Balancer’s frontend port to each backend instance. Rules are applied to the backend instance’s network interface card (NIC). For Virtual Machine Scale Sets (VMSS) instances, inbound NAT rules are automatically created/deleted as new instances are scaled up/down.
18+
[Version 1](inbound-nat-rules.md) is the legacy approach for assigning an Azure Load Balancer’s frontend port to each backend instance. Rules are applied to the backend instance’s network interface card (NIC). For Azure Virtual Machine Scale Sets instances, inbound NAT rules are automatically created/deleted as new instances are scaled up/down.
2019

21-
## Version 2
20+
## NAT rule version 2
2221

2322
[Version 2](inbound-nat-rules.md) of Inbound NAT rules provide the same feature set as version 1, with extra benefits.
2423

@@ -48,19 +47,21 @@ The following three steps need to be performed to migrate to version 2 of inboun
4847
1. Delete the version 1 of inbound NAT rules on the load balancer’s configuration.
4948
2. Remove the reference to the NAT rule on the virtual machine or virtual machine scale set configuration.
5049
1. All virtual machine scale set instances need to be updated.
51-
3. Deploy version 2 of Inbound NAT rules
50+
3. Deploy version 2 of Inbound NAT rules.
5251

5352
### Virtual Machine
5453

54+
The following steps are used to migrate from version 1 to version 2 of Inbound NAT rules for a virtual machine.
55+
5556
# [Azure CLI](#tab/azure-cli)
5657

5758
```azurecli
5859
59-
az network lb inbound-nat-rule delete -g MyResourceGroup --lb-name MyLoadBalancer --name NATRule
60+
az network lb inbound-nat-rule delete -g MyResourceGroup --lb-name MyLoadBalancer --name NATruleV1
6061
61-
az network nic ip-config inbound-nat-rule remove -g MyResourceGroup --nic-name MyNic -n MyIpConfig --inbound-nat-rule MyNatRul
62+
az network nic ip-config inbound-nat-rule remove -g MyResourceGroup --nic-name MyNic -n MyIpConfig --inbound-nat-rule MyNatRule
6263
63-
az network lb inbound-nat-rule create -g MyResourceGroup --lb-name MyLoadBalancer -n MyNatRule --protocol Tcp --frontend-port-range-start 201 --frontend-port-range-end 500 --backend-port 80
64+
az network lb inbound-nat-rule create -g MyResourceGroup --lb-name MyLoadBalancer -n MyNatRule --protocol Tcp --frontend-port-range-start 201 --frontend-port-range-end 500 --backend-port 22
6465
6566
```
6667

@@ -80,12 +81,20 @@ $nic.IpConfigurations[0].LoadBalancerInboundNatRule  = $null
8081
8182
Set-AzNetworkInterface -NetworkInterface $nic
8283
84+
$slb | Add-AzLoadBalancerInboundNatRuleConfig -Name "NewNatRuleV2" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -FrontendPortRangeStart 201-FrontendPortRangeEnd 500 -BackendAddressPool $slb.BackendAddressPools[0] -BackendPort 22
85+
$slb | Set-AzLoadBalancer
86+
87+
8388
```
8489
---
8590

8691

8792
### Virtual Machine Scale Set
8893

94+
The following steps are used to migrate from version 1 to version 2 of Inbound NAT rules for a virtual machine scale set. It assumes the virtual machine scale set's upgrade mode is set to Manual. For more information, see [Orchestration modes for Virtual Machine Scale Sets in Azure](/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-orchestration-modes)
95+
96+
97+
8998
# [Azure CLI](#tab/azure-cli)
9099

91100
```azurecli
@@ -96,7 +105,7 @@ az vmss update -g MyResourceGroup -n MyVMScaleSet --remove virtualMachineProfile
96105
97106
az vmss update-instances --instance-ids '*' --resource-group MyResourceGroup --name MyVMScaleSet
98107
99-
az network lb inbound-nat-rule create -g MyResourceGroup --lb-name MyLoadBalancer -n MyNatRule --protocol Tcp --frontend-port-range-start 201 --frontend-port-range-end 500 --backend-port 80
108+
az network lb inbound-nat-rule create -g MyResourceGroup --lb-name MyLoadBalancer -n MyNatRule --protocol Tcp --frontend-port-range-start 201 --frontend-port-range-end 500 --backend-port 22
100109
101110
```
102111

@@ -122,13 +131,16 @@ Update-AzVmss -ResourceGroupName $resourceGroupName -Name $vmssName -VirtualMach
122131
123132
# Upgrade all instances in the VMSS
124133
125-
Update-AzVmssInstance -ResourceGroupName $resourceGroupName -VMScaleSetName $vmssName -InstanceId "*"
134+
Update-AzVmssInstance -ResourceGroupName $resourceGroupName -VMScaleSetName $vmssName -InstanceId "*"
135+
136+
$slb | Add-AzLoadBalancerInboundNatRuleConfig -Name "NewNatRuleV2" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -FrontendPortRangeStart 201-FrontendPortRangeEnd 500 -BackendAddressPool $slb.BackendAddressPools[0] -BackendPort 22
137+
$slb | Set-AzLoadBalancer
138+
126139
```
127140
---
128141

129142
## Migration with automation script for Virtual Machine Scale Set
130143

131-
> [!NOTE] This script is designed to work if there is only one VMSS instance attached to your load balancer.
132144

133145
### Prerequisites
134146

0 commit comments

Comments
 (0)