Edit

Share via


Manage a Standard V2 NAT gateway

Learn how to create and remove a NAT gateway resource from a virtual network subnet. A NAT gateway enables outbound connectivity for resources in an Azure Virtual Network. You can change the public IP addresses and public IP address prefixes associated with the NAT gateway changed after deployment.

Important

Standard V2 SKU Azure NAT Gateway is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

This article explains how to manage the following aspects of NAT gateway:

  • Create a NAT gateway and associate it with an existing subnet.

  • Create a NAT gateway and associate it with an existing virtual network.

  • Remove a NAT gateway from an existing subnet and delete the NAT gateway.

  • Remove a NAT gateway from an existing virtual network and delete the NAT gateway.

  • Add or remove a public IP address or public IP prefix.

Prerequisites

Create a NAT gateway and associate it with an existing subnet

You can create a NAT gateway resource and add it to an existing subnet by using the Azure portal or Azure PowerShell.

  1. Sign in to the Azure portal.

  2. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  3. Select Create.

  4. Enter or select the following information in the Basics tab of Create network address translation (NAT) gateway.

    Setting Value
    Project details
    Subscription Select your subscription.
    Resource group Select test-rg or your resource group.
    Instance details
    NAT gateway name Enter nat-gateway.
    Region Select your region. This example uses West US.
    SKU Select Standard V2.
    TCP idle timeout (minutes) Leave the default of 4.
  5. Select Next.

  6. In the Outbound IP tab, select + Add public IP addresses or prefixes.

  7. In Add public IP addresses or prefixes, select Public IP addresses. You can select an existing public IP address or create a new one.

    • To create a new public IP for the NAT gateway, select Create a new public IP address. Enter public-ip-nat in Name. Select OK.

    • To create a new public IP prefix for the NAT gateway, select Create a new public IP prefix. Enter public-ip-prefix-nat in Name. Select a Prefix size. Select OK.

  8. Select Save.

  9. Select the Networking tab, or select Next.

  10. Select your virtual network. In this example, select vnet-1 in the dropdown list.

  11. Leave the Default to all subnets unselected.

  12. Select subnet-1 from the dropdown list.

  13. Select Review + create.

  14. Select Create.

Create a NAT gateway and associate it with an existing virtual network.

Azure NAT Gateway V2 adds a feature that allows you to associate a NAT gateway with an entire virtual network instead of a specific subnet.

You can create a NAT gateway resource and add it to an existing virtual network by using the Azure portal or Azure PowerShell.

  1. Sign in to the Azure portal.

  2. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  3. Select Create.

  4. Enter or select the following information in the Basics tab of Create network address translation (NAT) gateway.

    Setting Value
    Project details
    Subscription Select your subscription.
    Resource group Select test-rg or your resource group.
    Instance details
    NAT gateway name Enter nat-gateway.
    Region Select your region. This example uses West US.
    SKU Select Standard V2.
    TCP idle timeout (minutes) Leave the default of 4.
  5. Select Next.

  6. In the Outbound IP tab, select + Add public IP addresses or prefixes.

  7. In Add public IP addresses or prefixes, select Public IP addresses. You can select an existing public IP address or create a new one.

    • To create a new public IP for the NAT gateway, select Create a new public IP address. Enter public-ip-nat in Name. Select OK.

    • To create a new public IP prefix for the NAT gateway, select Create a new public IP prefix. Enter public-ip-prefix-nat in Name. Select a Prefix size. Select OK.

  8. Select Save.

  9. Select the Networking tab, or select Next.

  10. Select your virtual network. In this example, select vnet-1 in the dropdown list.

  11. Select the checkbox Default to all subnets.

  12. Select Review + create.

  13. Select Create.

Remove a NAT gateway from an existing subnet and delete the resource

To remove a NAT gateway from an existing subnet, complete the following steps.

  1. Sign in to the Azure portal.

  2. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  3. Select nat-gateway.

  4. Select Networking.

  5. To remove NAT gateway from all subnets, select Disassociate.

  6. To remove NAT gateway from only one of multiple subnets, unselect the checkbox next to the subnet in the dropdown and select Save.

You can now associate the NAT gateway with a different subnet or virtual network in your subscription. To delete the NAT gateway resource, complete the following steps.

  1. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  2. Select nat-gateway.

  3. Select Delete.

  4. Select Yes.

Remove a NAT gateway from an existing virtual network and delete the NAT gateway

To remove a NAT gateway from an existing virtual network, complete the following steps.

  1. Sign in to the Azure portal.

  2. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  3. Select nat-gateway.

  4. Select Networking.

  5. To remove NAT gateway from the network, select X Disassociate.

You can now associate the NAT gateway with a different subnet or virtual network in your subscription. To delete the NAT gateway resource, complete the following steps.

  1. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  2. Select nat-gateway.

  3. Select Delete.

  4. Select Yes.

Note

When you delete a NAT gateway, the public IP address or prefix associated with it isn't deleted.

Add or remove a public IP address

Complete the following steps to add or remove a public IP address from a NAT gateway.

  1. Sign in to the Azure portal.

  2. In the search box at the top of the Azure portal, enter Public IP address. Select Public IP addresses in the search results.

  3. Select Create.

  4. Enter the following information in Create public IP address.

    Setting Value
    Subscription Select your subscription.
    Resource group Select your resource group. The example uses test-rg.
    Region Select a region. This example uses East US 2.
    Name Enter public-ip-nat2.
    IP version Select IPv4.
    SKU Select Standard V2.
    Availability zone Select the default of Zone-redundant.
    Tier Select Regional.
  5. Select Review + create and then select Create.

  6. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  7. Select nat-gateway.

  8. Under Settings, select Outbound IP.

  9. The IP addresses and prefixes associated with the NAT gateway are displayed. Select the IP address you want to remove and select Remove.

  10. To add a public IP address, select Edit.

  11. Select the public IP address that you created to add it to the NAT gateway.

  12. Select OK.

  13. Select Save.

Add or remove a public IP prefix

Complete the following steps to add or remove a public IP prefix from a NAT gateway.

  1. Sign in to the Azure portal.

  2. In the search box at the top of the Azure portal, enter Public IP prefix. Select Public IP Prefixes in the search results.

  3. Select Create.

  4. Enter the following information in the Basics tab of Create a public IP prefix.

    Setting Value
    Project details
    Subscription Select your subscription.
    Resource group Select your resource group. This example uses test-rg.
    Instance details
    Name Enter public-ip-prefix-nat.
    Region Select your region. This example uses East US 2.
    Sku Select Standard V2.
    IP version Select IPv4.
    Prefix ownership Select Microsoft owned.
    Prefix size Select a prefix size. This example uses /28 (16 addresses).
  5. Select Review + create, then select Create.

  6. In the search box at the top of the Azure portal, enter NAT gateway. Select NAT gateways in the search results.

  7. Select nat-gateway.

  8. Under Settings, select Outbound IP.

  9. The page displays the IP addresses and prefixes associated with the NAT gateway. Select the prefix you want to remove and select Remove.

  10. To add a public IP prefix, select Edit. Select the public IP prefix that you created to add it to the NAT gateway.

  11. Select OK.

  12. Select Save.

Next steps

To learn more about Azure NAT Gateway and its capabilities, see the following articles: