在 Azure 中部署使用 IPv6 的虚拟机规模集Deploy virtual machine scale sets with IPv6 in Azure

本文介绍如何在 Azure 虚拟网络中部署使用双堆栈外部负载均衡器的双堆栈 (IPv4 + IPv6) 虚拟机规模集。This article shows you how to deploy a dual stack (IPv4 + IPv6) Virtual Machine Scale Set with a dual stack external load balancer in an Azure virtual network. 创建支持 IPv6 的虚拟机规模集的过程,与此处所述的创建单个 VM 的过程基本相同。The process to create an IPv6-capable virtual machine scale set is nearly identical to the process for creating individual VMs described here. 首先执行类似于创建单个 VM 的步骤:You'll start with the steps that are similar to ones described for individual VMs:

  1. 创建 IPv4 和 IPv6 公共 IP。Create IPv4 and IPv6 Public IPs.
  2. 创建双堆栈负载均衡器。Create a dual stack load balancer.
  3. 创建网络安全组 (NSG) 规则。Create network security group (NSG) rules.

只有一个步骤与创建单个 VM 不同,那就是创建使用虚拟机规模集资源的网络接口 (NIC) 配置:networkProfile/networkInterfaceConfigurations。The only step that is different from individual VMs is creating the network interface (NIC) configuration that uses the virtual machine scale set resource: networkProfile/networkInterfaceConfigurations. JSON 结构类似于单个 VM 使用的 Microsoft.Network/networkInterfaces 对象,不过,其中添加了使用 "primary": true 属性将 NIC 和 IPv4 IpConfiguration 设置为主接口的代码,如以下示例中所示:The JSON structure is similar to that of the Microsoft.Network/networkInterfaces object used for individual VMs with the addition of setting the NIC and the IPv4 IpConfiguration as the primary interface using the "primary": true attribute as seen in the following example:

"networkProfile": {
    "networkInterfaceConfigurations": [
        {
            "name": "[variables('nicName')]",
            "properties": {
                "primary": true,
                "networkSecurityGroup": {
                    "id": "[resourceId('Microsoft.Network/networkSecurityGroups','VmssNsg')]"
                },                  
                "ipConfigurations": [
                    {
                      "name": "[variables('ipConfigName')]",
                      "properties": {
                            "primary": true,
                            "subnet": {
                                "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'MyvirtualNetwork','Mysubnet')]"
                            },
                            "privateIPAddressVersion":"IPv4",                       
                            "publicipaddressconfiguration": {
                              "name": "pub1",
                              "properties": {
                                "idleTimeoutInMinutes": 15
                              }
                            },
                            "loadBalancerBackendAddressPools": [
                              {
                                "id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'loadBalancer', 'bePool'))]"
                              }
                            ],
                            "loadBalancerInboundNatPools": [
                              {
                                "id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', 'loadBalancer', 'natPool')]"
                              }
                            ]
                        }
                    },
                    {
                      "name": "[variables('ipConfigNameV6')]",
                      "properties": {
                            "subnet": {
                              "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets','MyvirtualNetwork','Mysubnet')]"
                            },
                            "privateIPAddressVersion":"IPv6",
                            "loadBalancerBackendAddressPools": [
                                  {
                                    "id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'loadBalancer','bePoolv6')]"
                                  }
                            ],                        
                        }
                    }
                ]
            }
        }
    ]
}

示例虚拟机规模集模板 JSONSample virtual machine scale set template JSON

若要部署使用双堆栈外部负载均衡器和虚拟网络的双堆栈 (IPv4 + IPv6) 虚拟机规模集,请查看此处的示例模板。To deploy a dual stack (IPv4 + IPv6) Virtual Machine Scale Set with dual stack external Load Balancer and virtual network view sample template here.

后续步骤Next steps

若要详细了解 Azure 虚拟网络中的 IPv6 支持,请参阅 Azure 虚拟网络 IPv6 是什么?To learn more about IPv6 support in Azure virtual networks, see What is IPv6 for Azure Virtual Network?.