|
| 1 | +--- |
| 2 | +title: Add a dual-stack network to an existing virtual machine - Azure CLI |
| 3 | +titleSuffix: Azure Virtual Network |
| 4 | +description: Learn how to add a dual-stack network to an existing virtual machine using the Azure CLI. |
| 5 | +author: asudbring |
| 6 | +ms.author: allensu |
| 7 | +ms.service: virtual-network |
| 8 | +ms.subservice: ip-services |
| 9 | +ms.topic: how-to |
| 10 | +ms.date: 08/24/2022 |
| 11 | +ms.custom: template-how-to, devx-track-azurecli |
| 12 | +ms.devlang: azurecli |
| 13 | +--- |
| 14 | + |
| 15 | +# Add a dual-stack network to an existing virtual machine using the Azure CLI |
| 16 | + |
| 17 | +In this article, you'll add IPv6 support to an existing virtual network. You'll configure an existing virtual machine with both IPv4 and IPv6 addresses. When completed, the existing virtual network will support private IPv6 addresses. The existing virtual machine network configuration will contain a public and private IPv4 and IPv6 address. |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio). |
| 22 | + |
| 23 | +[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](../../../includes/azure-cli-prepare-your-environment-no-header.md)] |
| 24 | + |
| 25 | +- This tutorial requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed. |
| 26 | + |
| 27 | +- An existing virtual network, public IP address and virtual machine in your subscription that is configured for IPv4 support only. For more information about creating a virtual network, public IP address and a virtual machine, see [Quickstart: Create a Linux virtual machine with the Azure CLI](/azure/virtual-machines/linux/quick-create-cli). |
| 28 | + |
| 29 | + - The example virtual network used in this article is named **myVNet**. Replace this value with the name of your virtual network. |
| 30 | + |
| 31 | + - The example virtual machine used in this article is named **myVM**. Replace this value with the name of your virtual machine. |
| 32 | + |
| 33 | + - The example public IP address used in this article is named **myPublicIP**. Replace this value with the name of your public IP address. |
| 34 | + |
| 35 | +## Add IPv6 to virtual network |
| 36 | + |
| 37 | +In this section, you'll add an IPv6 address space and subnet to your existing virtual network. |
| 38 | + |
| 39 | +Use [az network vnet update](/cli/azure/network/vnet#az-network-vnet-update) to update the virtual network. |
| 40 | + |
| 41 | +```azurecli-interactive |
| 42 | +az network vnet update \ |
| 43 | + --address-prefixes 10.0.0.0/16 2404:f800:8000:122::/63 \ |
| 44 | + --resource-group myResourceGroup \ |
| 45 | + --name myVNet |
| 46 | +``` |
| 47 | + |
| 48 | +Use [az network vnet subnet update](/cli/azure/network/vnet/subnet#az-network-vnet-subnet-update) to create the subnet. |
| 49 | + |
| 50 | +```azurecli-interactive |
| 51 | +az network vnet subnet update \ |
| 52 | + --address-prefixes 10.0.0.0/24 2404:f800:8000:122::/64 \ |
| 53 | + --name myBackendSubnet \ |
| 54 | + --resource-group myResourceGroup \ |
| 55 | + --vnet-name myVNet |
| 56 | +``` |
| 57 | + |
| 58 | +## Create IPv6 public IP address |
| 59 | + |
| 60 | +In this section, you'll create a IPv6 public IP address for the virtual machine. |
| 61 | + |
| 62 | +Use [az network public-ip create](/cli/azure/network/public-ip#az-network-public-ip-create) to create the public IP address. |
| 63 | + |
| 64 | +```azurecli-interactive |
| 65 | + az network public-ip create \ |
| 66 | + --resource-group myResourceGroup \ |
| 67 | + --name myPublicIP-Ipv6 \ |
| 68 | + --sku Standard \ |
| 69 | + --version IPv6 \ |
| 70 | + --zone 1 2 3 |
| 71 | +``` |
| 72 | +## Add IPv6 configuration to virtual machine |
| 73 | + |
| 74 | +Use [az network nic ip-config create](/cli/azure/network/nic/ip-config#az-network-nic-ip-config-create) to create the IPv6 configuration for the NIC. The **`--nic-name`** used in the example is **myvm569**. Replace this value with the name of the network interface in your virtual machine. |
| 75 | + |
| 76 | +```azurecli-interactive |
| 77 | + az network nic ip-config create \ |
| 78 | + --resource-group myResourceGroup \ |
| 79 | + --name Ipv6config \ |
| 80 | + --nic-name myvm569 \ |
| 81 | + --private-ip-address-version IPv6 \ |
| 82 | + --vnet-name myVNet \ |
| 83 | + --subnet myBackendSubnet \ |
| 84 | + --public-ip-address myPublicIP-IPv6 |
| 85 | +``` |
| 86 | + |
| 87 | +## Next steps |
| 88 | + |
| 89 | +In this article, you learned how to create an Azure Virtual machine with a dual-stack network. |
| 90 | + |
| 91 | +For more information about IPv6 and IP addresses in Azure, see: |
| 92 | + |
| 93 | +- [Overview of IPv6 for Azure Virtual Network.](ipv6-overview.md) |
| 94 | + |
| 95 | +- [What is Azure Virtual Network IP Services?](ip-services-overview.md) |
| 96 | + |
| 97 | + |
0 commit comments