In this article, you add IPv6 support to an existing virtual network. You configure an existing virtual machine with both IPv4 and IPv6 addresses. When completed, the existing virtual network supports private IPv6 addresses. The existing virtual machine network configuration contains a public and private IPv4 and IPv6 address. You choose from the Azure portal, Azure CLI, or Azure PowerShell to complete the steps in this article.
Prerequisites
An Azure account with an active subscription. Create an account for free.
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 in the Azure portal.
The example virtual network used in this article is named myVNet. Replace this value with the name of your virtual network.
The example virtual machine used in this article is named myVM. Replace this value with the name of your virtual machine.
The example public IP address used in this article is named myPublicIP. Replace this value with the name of your public IP address.
This tutorial requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
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.
The example virtual network used in this article is named myVNet. Replace this value with the name of your virtual network.
The example virtual machine used in this article is named myVM. Replace this value with the name of your virtual machine.
The example public IP address used in this article is named myPublicIP. Replace this value with the name of your public IP address.
If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run Get-Module -ListAvailable Az
to find the installed version. If you need to upgrade, see Install Azure PowerShell module. If you're running PowerShell locally, you also need to run Connect-AzAccount
to create a connection with Azure.
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 in Azure with PowerShell.
The example virtual network used in this article is named myVNet. Replace this value with the name of your virtual network.
The example virtual machine used in this article is named myVM. Replace this value with the name of your virtual machine.
The example public IP address used in this article is named myPublicIP. Replace this value with the name of your public IP address.
Add IPv6 to virtual network
In this section, you add an IPv6 address space and subnet to your existing virtual network.
Sign in to the Azure portal.
In the search box at the top of the portal, enter Virtual network. Select Virtual networks in the search results.
Select myVNet in Virtual networks.
Select Address space in Settings.
Select the box Add additional address range. Enter 2404:f800:8000:122::/63.
Select Save.
Select Subnets in Settings.
In Subnets, select your subnet name from the list. In this example, the subnet name is default.
In the subnet configuration, select the box Add IPv6 address space.
In IPv6 address space, enter 2404:f800:8000:122::/64.
Select Save.
In this section, you add an IPv6 address space and subnet to your existing virtual network.
Use az network vnet update to update the virtual network.
az network vnet update \
--address-prefixes 10.0.0.0/16 2404:f800:8000:122::/63 \
--resource-group myResourceGroup \
--name myVNet
Use az network vnet subnet update to create the subnet.
az network vnet subnet update \
--address-prefixes 10.0.0.0/24 2404:f800:8000:122::/64 \
--name myBackendSubnet \
--resource-group myResourceGroup \
--vnet-name myVNet
In this section, you add an IPv6 address space and subnet to your existing virtual network.
Use Set-AzVirtualNetwork to update the virtual network.
## Place your virtual network into a variable. ##
$net = @{
Name = 'myVNet'
ResourceGroupName = 'myResourceGroup'
}
$vnet = Get-AzVirtualNetwork @net
## Place address space into a variable. ##
$IPAddressRange = '2404:f800:8000:122::/63'
## Add the address space to the virtual network configuration. ##
$vnet.AddressSpace.AddressPrefixes.Add($IPAddressRange)
## Save the configuration to the virtual network. ##
Set-AzVirtualNetwork -VirtualNetwork $vnet
Use Set-AzVirtualNetworkSubnetConfig to add the new IPv6 subnet to the virtual network.
## Place your virtual network into a variable. ##
$net = @{
Name = 'myVNet'
ResourceGroupName = 'myResourceGroup'
}
$vnet = Get-AzVirtualNetwork @net
## Create the subnet configuration. ##
$sub = @{
Name = 'myBackendSubnet'
AddressPrefix = '10.0.0.0/24','2404:f800:8000:122::/64'
VirtualNetwork = $vnet
}
Set-AzVirtualNetworkSubnetConfig @sub
## Save the configuration to the virtual network. ##
Set-AzVirtualNetwork -VirtualNetwork $vnet
Create IPv6 public IP address
In this section, you create a IPv6 public IP address for the virtual machine.
In the search box at the top of the portal, enter Public IP address. Select Public IP addresses in the search results.
Select + Create.
Enter or select the following information in Create public IP address.
Setting |
Value |
IP version |
Select IPv6. |
SKU |
Select Standard. |
IPv6 IP Address Configuration |
|
Name |
Enter myPublicIP-IPv6. |
Idle timeout (minutes) |
Leave the default of 4. |
Subscription |
Select your subscription. |
Resource group |
Select your resource group. In this example, the resource group is named myResourceGroup. |
Location |
Select your location. In this example, the location is East US 2. |
Availability zone |
Select Zone-redundant. |
Select Create.
In this section, you create a IPv6 public IP address for the virtual machine.
Use az network public-ip create to create the public IP address.
az network public-ip create \
--resource-group myResourceGroup \
--name myPublicIP-Ipv6 \
--sku Standard \
--version IPv6 \
--zone 1 2 3
In this section, you create a IPv6 public IP address for the virtual machine.
Use New-AzPublicIpAddress to create the public IP address.
$ip6 = @{
Name = 'myPublicIP-IPv6'
ResourceGroupName = 'myResourceGroup'
Location = 'eastus2'
Sku = 'Standard'
AllocationMethod = 'Static'
IpAddressVersion = 'IPv6'
Zone = 1,2,3
}
New-AzPublicIpAddress @ip6
Add IPv6 configuration to virtual machine
In this section, you will configure your virtual machine’s network interface to include both a private and a public IPv6 address.
In the search box at the top of the portal, enter Virtual machine. Select Virtual machines in the search results.
Select myVM or your existing virtual machine name.
Select Networking in Settings.
Select your network interface name next to Network Interface:. In this example, the network interface is named myvm404.
Select IP configurations in Settings of the network interface.
In IP configurations, select + Add.
Enter or select the following information in Add IP configuration.
Setting |
Value |
Name |
Enter Ipv6config. |
IP version |
Select IPv6. |
Private IP address settings |
|
Allocation |
Leave the default of Dynamic. |
Public IP address |
Select Associate. |
Public IP address |
Select myPublic-IPv6. |
Select OK.
Use az network nic ip-config create to create the IPv6 configuration for the network interface. The --nic-name
used in the example is myvm569. Replace this value with the name of the network interface in your virtual machine.
az network nic ip-config create \
--resource-group myResourceGroup \
--name Ipv6config \
--nic-name myvm569 \
--private-ip-address-version IPv6 \
--vnet-name myVNet \
--subnet myBackendSubnet \
--public-ip-address myPublicIP-IPv6
Use New-AzNetworkInterfaceIpConfig to create the IPv6 configuration for the network interface. The -Name
used in the example is myvm569. Replace this value with the name of the network interface in your virtual machine.
## Place your virtual network into a variable. ##
$net = @{
Name = 'myVNet'
ResourceGroupName = 'myResourceGroup'
}
$vnet = Get-AzVirtualNetwork @net
## Place your virtual network subnet into a variable. ##
$sub = @{
Name = 'myBackendSubnet'
VirtualNetwork = $vnet
}
$subnet = Get-AzVirtualNetworkSubnetConfig @sub
## Place the IPv6 public IP address you created previously into a variable. ##
$pip = @{
Name = 'myPublicIP-IPv6'
ResourceGroupName = 'myResourceGroup'
}
$publicIP = Get-AzPublicIPAddress @pip
## Place the network interface into a variable. ##
$net = @{
Name = 'myvm569'
ResourceGroupName = 'myResourceGroup'
}
$nic = Get-AzNetworkInterface @net
## Create the configuration for the network interface. ##
$ipc = @{
Name = 'Ipv6config'
Subnet = $subnet
PublicIpAddress = $publicIP
PrivateIpAddressVersion = 'IPv6'
}
$ipconfig = New-AzNetworkInterfaceIpConfig @ipc
## Add the IP configuration to the network interface. ##
$nic.IpConfigurations.Add($ipconfig)
## Save the configuration to the network interface. ##
$nic | Set-AzNetworkInterface
Next steps
In this article, you learned how to add a dual stack IP configuration to an existing virtual network and virtual machine.
For more information about IPv6 and IP addresses in Azure, see: