IPv6 virtual networks on Azure(2 min read)

IPv6 support for Azure VNets is currently available in preview (https://azure.microsoft.com/en-us/updates/microsoft-adds-new-features-to-ipv6-support-for-azure-vnets/).

Most of it is available via the Azure Portal, but I found allocating an IP config to a network card had to be done via the shell.

Here are the steps I did to test:

1. Create a new virtual machine, e.g. Ubuntu 18.04, in a test resource group, with new network, storage, etc.

2. Enable feature the feature and register the provider (in shell):

Register-AzProviderFeature -FeatureName AllowIPv6VirtualNetwork -ProviderNamespace Microsoft.Network
Register-AzProviderFeature -FeatureName AllowIPv6CAOnStandardLB -ProviderNamespace Microsoft.Network
Register-AzResourceProvider -ProviderNamespace Microsoft.Network

3. Select the created virtual network, and on the Address space tab add a /56 subnet from a randomly generated /48 Unique Local Address space, e.g. fd12:3456:789a:bc00::/56

You can use an online generator to create your own ULA space, e.g. https://dnschecker.org/ipv6-address-generator.php

4. Modify the subnet to add an IPv6 range, e.g. fd12:3456:789a:bcde::/64 (IPv6 subnets are /64 ranges)

5. Create new standard (not basic) Public IP address, for both IPv4 and IPv6. i.e. version = both, SKU = standard, with names that should indicate the machine, e.g. -ipv4, and -ipv6

6. Stop (deallocate) the machine

7. Open the network interface for the machine, go to IP configurations tab, open the existing config, disable to basic Public IP v4 address and replace with the new standard one created above (-ipv4).

This is where trying to add a secondary IP configuration with the IPv6 address would fail, as you can't set the version.

8. Open a shell prompt to allocate the IPv6 configuration

$rg = Get-AzResourceGroup -ResourceGroupName ""
$vnet = Get-AzVirtualNetwork -Name ""
$publicIPv6 = Get-AzPublicIpAddress -Name "-ipv6"
$nic = Get-AzNetworkInterface -Name "" -ResourceGroupName $rg.ResourceGroupName
$nic | Add-AzNetworkInterfaceIpConfig -Name ipv6config1 -Subnet $vnet.Subnets[0] -PrivateIpAddressVersionĀ IPv6 -PublicIpAddress $publicIPv6
$nic | Set-AzNetworkInterface

9. You can then check assignments in Azure Portal for the network interface IP configurations tab, check the machine, and restart it. The ifconfig command (for Ubuntu) will show you the IPv6 address.

Note that ICMP is disabled, so ping and traceroute won't work, but you should be able to SSH to the IPv6 address (if you are running IPv6 on your client).

One thought on “IPv6 virtual networks on Azure(2 min read)

Leave a Reply

Your email address will not be published. Required fields are marked *