Skip to content

Commit e5c9cc1

Browse files
authored
Merge pull request #187815 from asudbring/ob-ilip-nat
Article for migrating instance level virtual machine public IP to NAT gateway
2 parents 26f9140 + f974ae2 commit e5c9cc1

File tree

6 files changed

+139
-0
lines changed

6 files changed

+139
-0
lines changed
170 KB
Loading
155 KB
Loading
97.5 KB
Loading
130 KB
Loading

articles/virtual-network/nat-gateway/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ items:
2222
href: tutorial-nat-gateway-load-balancer-internal-portal.md
2323
- name: Migrate outbound access
2424
href: tutorial-migrate-outbound-nat.md
25+
- name: Migrate a virtual machine public IP address
26+
href: tutorial-migrate-ilip-nat.md
2527
expanded: true
2628
- name: Concepts
2729
items:
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
title: 'Tutorial: Migrate a virtual machine public IP address to NAT gateway'
3+
titleSuffix: Azure Virtual Network NAT
4+
description: Learn how to migrate your virtual machine public IP to a Virtual Network NAT gateway.
5+
author: asudbring
6+
ms.author: allensu
7+
ms.service: virtual-network
8+
ms.subservice: nat
9+
ms.topic: tutorial
10+
ms.date: 2/07/2022
11+
ms.custom: template-tutorial
12+
---
13+
14+
# Tutorial: Migrate a virtual machine public IP address to Azure Virtual Network NAT
15+
16+
In this article, you'll learn how to migrate your virtual machine's public IP address to a NAT gateway. You'll learn how to remove the IP address from the virtual machine. You'll reuse the IP address from the virtual machine for the NAT gateway.
17+
18+
Azure Virtual Network NAT is the recommended method for outbound connectivity. A NAT gateway is a fully managed and highly resilient Network Address Translation (NAT) service. A NAT gateway doesn't have the same limitations of SNAT port exhaustion as default outbound access. A NAT gateway replaces the need for a virtual machine to have a public IP address to have outbound connectivity.
19+
20+
For more information about Azure Virtual Network NAT, see [What is Azure Virtual Network NAT](nat-overview.md)
21+
22+
In this tutorial, you learn how to:
23+
24+
> [!div class="checklist"]
25+
> * Remove the public IP address from the virtual machine.
26+
> * Associate the public IP address from the virtual machine with a NAT gateway.
27+
28+
## Prerequisites
29+
30+
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
31+
32+
* An Azure Virtual Machine with a public IP address assigned to its network interface. For more information on creating a virtual machine with a public IP, see [Quickstart: Create a Windows virtual machine in the Azure portal](../../virtual-machines/windows/quick-create-portal.md).
33+
34+
* For the purposes of this article, the example virtual machine is named **myVM**. The example public IP address is named **myPublicIP**.
35+
36+
> [!NOTE]
37+
> Removal of the public IP address prevents direct connections to the virtual machine from the internet. RDP or SSH access won't function to the virtual machine after you complete this migration. To securely manage virtual machines in your subscription, use Azure Bastion. For more information on Azure Bastion, see [What is Azure Bastion?](../../bastion/bastion-overview.md).
38+
39+
## Remove public IP from virtual machine
40+
41+
In this section, you'll learn how to remove the public IP address from the virtual machine.
42+
43+
1. Sign in to the [Azure portal](https://portal.azure.com).
44+
45+
2. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines**.
46+
47+
3. In **Virtual machines**, select **myVM** or your virtual machine.
48+
49+
4. In the **Overview** of **myVM**, select **Public IP address**.
50+
51+
:::image type="content" source="./media/tutorial-migrate-ilip-nat/select-public-ip.png" alt-text="Screenshot of virtual machines public IP address.":::
52+
53+
5. In **myPublicIP**, select the **Overview** page in the left-hand column.
54+
55+
6. In **Overview**, select **Dissociate**.
56+
57+
:::image type="content" source="./media/tutorial-migrate-ilip-nat/remove-public-ip.png" alt-text="Screenshot of virtual machines public IP address overview and removal of IP address.":::
58+
59+
7. Select **Yes** in **Dissociate public IP address**.
60+
61+
### (Optional) Upgrade IP address
62+
63+
The NAT gateway resource in Azure Virtual Network NAT requires a standard SKU public IP address. In this section, you'll upgrade the IP you removed from the virtual machine in the previous section. If the IP address you removed is already a standard SKU public IP, you can proceed to the next section.
64+
65+
1. In the search box at the top of the portal, enter **Public IP**. Select **Public IP addresses**.
66+
67+
2. In **Public IP addresses**, select **myPublicIP** or your basic SKU IP address.
68+
69+
3. In the **Overview** of **myPublicIP**, select the IP address upgrade banner.
70+
71+
:::image type="content" source="./media/tutorial-migrate-ilip-nat/select-upgrade-banner.png" alt-text="Screenshot of public IP address upgrade banner.":::
72+
73+
4. In **Upgrade to Standard SKU**, select the box next to **I acknowledge**. Select the **Upgrade** button.
74+
75+
:::image type="content" source="./media/tutorial-migrate-ilip-nat/upgrade-public-ip.png" alt-text="Screenshot of upgrade public IP address selection.":::
76+
77+
5. When the upgrade is complete, proceed to the next section.
78+
## Create NAT gateway
79+
80+
In this section, you’ll create a NAT gateway with the IP address you previously removed from the virtual machine. You'll assign the NAT gateway to your pre-created subnet within your virtual network. The subnet name for this example is **default**.
81+
82+
1. In the search box at the top of the portal, enter **NAT gateway**. Select **NAT gateways**.
83+
84+
2. In **NAT gateways**, select **+ Create**.
85+
86+
3. In **Create network address translation (NAT) gateway**, enter or select the following information.
87+
88+
| Setting | Value |
89+
| ------- | ----- |
90+
| **Project details** | |
91+
| Subscription | Select your subscription. |
92+
| Resource group | Select **Create new**. </br> Enter **myResourceGroup**. </br> Select **OK**. |
93+
| **Instance details** | |
94+
| NAT gateway name | Enter **myNATgateway**. |
95+
| Region | Select the region of your virtual network. In this example, it's **West US 2**. |
96+
| Availability zone | Leave the default of **None**. |
97+
| Idle timeout (minutes) | Enter **10**. |
98+
99+
4. Select the **Outbound IP** tab, or select **Next: Outbound IP** at the bottom of the page.
100+
101+
5. In **Public IP addresses** in the **Outbound IP** tab, select the IP address from the previous section in **Public IP addresses**. In this example, it's **myPublicIP**.
102+
103+
6. Select the **Subnet** tab, or select **Next: Subnet** at the bottom of the page.
104+
105+
7. In the pull-down box for **Virtual network**, select your virtual network.
106+
107+
8. In **Subnet name**, select the checkbox for your subnet. In this example, it's **default**.
108+
109+
9. Select the **Review + create** tab, or select **Review + create** at the bottom of the page.
110+
111+
10. Select **Create**.
112+
113+
## Clean up resources
114+
115+
If you're not going to continue to use this application, delete the NAT gateway with the following steps:
116+
117+
1. From the left-hand menu, select **Resource groups**.
118+
119+
2. Select the **myResourceGroup** resource group.
120+
121+
3. Select **Delete resource group**.
122+
123+
4. Enter **myResourceGroup** and select **Delete**.
124+
125+
## Next steps
126+
127+
In this article, you learned how to:
128+
129+
* Remove a public IP address from a virtual machine.
130+
131+
* Create a NAT gateway and use the public IP address from the virtual machine for the NAT gateway resource.
132+
133+
Any virtual machine created within this subnet won't require a public IP address and will automatically have outbound connectivity. For more information about NAT gateway and the connectivity benefits it provides, see [Design virtual networks with NAT gateway](nat-gateway-resource.md).
134+
135+
Advance to the next article to learn how to migrate default outbound access to Azure Virtual Network NAT:
136+
> [!div class="nextstepaction"]
137+
> [Migrate outbound access to NAT gateway](tutorial-migrate-outbound-nat.md)

0 commit comments

Comments
 (0)