您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

关于 VPN 网关配置设置About VPN Gateway configuration settings

VPN 网关是一种虚拟网络网关,可跨公共连接在虚拟网络和本地位置发送加密的流量。A VPN gateway is a type of virtual network gateway that sends encrypted traffic between your virtual network and your on-premises location across a public connection. 还可使用 VPN 网关跨 Azure 主干网在虚拟网络间发送流量。You can also use a VPN gateway to send traffic between virtual networks across the Azure backbone.

VPN 网关连接依赖于多个资源配置,其中每个资源包含可配置的设置。A VPN gateway connection relies on the configuration of multiple resources, each of which contains configurable settings. 本文的各部分介绍了与在 Resource Manager 部署模型中创建的虚拟网络的 VPN 网关相关的资源和设置。The sections in this article discuss the resources and settings that relate to a VPN gateway for a virtual network created in Resource Manager deployment model. 可在 关于 VPN 网关一文中找到每种连接解决方案的介绍和拓扑图。You can find descriptions and topology diagrams for each connection solution in the About VPN Gateway article.

网关类型Gateway types

每个虚拟网络只能有一种类型的虚拟网络网关。Each virtual network can only have one virtual network gateway of each type. 创建虚拟网络网关时,必须确保用于配置的网关类型正确。When you are creating a virtual network gateway, you must make sure that the gateway type is correct for your configuration.

-GatewayType 的可用值为:The available values for -GatewayType are:

  • VpnVpn
  • ExpressRouteExpressRoute

VPN 网关需要 -GatewayType VpnA VPN gateway requires the -GatewayType Vpn.

示例:Example:

New-AzureRmVirtualNetworkGateway -Name vnetgw1 -ResourceGroupName testrg `
-Location 'West US' -IpConfigurations $gwipconfig -GatewayType Vpn `
-VpnType RouteBased

网关 SKUGateway SKUs

创建虚拟网络网关时,需要指定要使用的网关 SKU。When you create a virtual network gateway, you need to specify the gateway SKU that you want to use. 根据工作负荷、吞吐量、功能和、SLA 的类型,选择满足需求的 SKU。Select the SKUs that satisfy your requirements based on the types of workloads, throughputs, features, and SLAs.

备注

仅 Resource Manager 部署模型支持新的 VPN 网关 SKU(VpnGw1、VpnGw2 和 VpnGw3)。The new VPN gateway SKUs (VpnGw1, VpnGw2, and VpnGw3) are supported for the Resource Manager deployment model only. 经典虚拟网络应继续使用旧版 SKU。Classic virtual networks should continue to use the old SKUs. 有关旧版网关 SKU 的详细信息,请参阅使用虚拟网关 SKU(旧版)For more information about the old gateway SKUs, see Working with virtual network gateway SKUs (old).

Azure 提供以下 VPN 网关 SKU:Azure offers the following VPN gateway SKUs:

SKUSKU S2S/VNet 到 VNet
隧道
S2S/VNet-to-VNet
Tunnels
P2S
连接
P2S
Connections
聚合
吞吐量基准
Aggregate
Throughput Benchmark
VpnGw1VpnGw1 最大Max. 3030 最大Max. 128128 650 Mbps650 Mbps
VpnGw2VpnGw2 最大Max. 3030 最大Max. 128128 1 Gbps1 Gbps
VpnGw3VpnGw3 最大Max. 3030 最大Max. 128128 1.25 Gbps1.25 Gbps
基本Basic 最大Max. 1010 最大Max. 128128 100 Mbps100 Mbps
  • 聚合吞吐量基准基于对通过单个网关聚合的多个隧道的测量。Aggregate Throughput Benchmark is based on measurements of multiple tunnels aggregated through a single gateway. 受 Internet 流量情况和应用程序行为影响,该吞吐量无法保证。It is not a guaranteed throughput due to Internet traffic conditions and your application behaviors.

  • 可在 定价 页上找到定价信息。Pricing information can be found on the Pricing page.

  • 可在 SLA 页查看 SLA(服务级别协议)信息。SLA (Service Level Agreement) information can be found on the SLA page.

生产与开发-测试工作负荷Production vs. Dev-Test Workloads

由于 SLA 和功能集的差异,建议使用以下 SKU 比较生产与开发-测试:Due to the differences in SLAs and feature sets, we recommend the following SKUs for production vs. dev-test:

工作负载Workload SKUSKUs
生产、关键工作负荷Production, critical workloads VpnGw1、VpnGw2、VpnGw3VpnGw1, VpnGw2, VpnGw3
开发-测试或概念证明Dev-test or proof of concept 基本Basic

如果使用旧版 SKU,则推荐使用的生产 SKU 为标准和高性能 SKU。If you are using the old SKUs, the production SKU recommendations are Standard and HighPerformance SKUs. 有关老版 SKU 的信息,请参阅网关 SKU(旧版 SKU)For information on the old SKUs, see Gateway SKUs (legacy SKUs).

网关 SKU 功能集Gateway SKU feature sets

新版网关 SKU 简化了网关上提供的功能集:The new gateway SKUs streamline the feature sets offered on the gateways:

SKUSKU 功能Features
基本Basic 基于路由的 VPN:包含 P2S 的 10 个隧道;无适用于 P2S 的 RADIUS 身份验证;无适用于 P2S 的 IKEv2Route-based VPN: 10 tunnels with P2S; no RADIUS authentication for P2S; no IKEv2 for P2S
基于策略的 VPN (IKEv1):1 个隧道;不含 P2SPolicy-based VPN: (IKEv1): 1 tunnel; no P2S
VpnGw1、VpnGw2、VpnGw3VpnGw1, VpnGw2, and VpnGw3 基于路由的 VPN:最多 30 个隧道 ( * )、P2S、BGP、主动-主动、自定义 IPsec/IKE 策略、ExpressRoute/VPN 共存Route-based VPN: up to 30 tunnels (*), P2S, BGP, active-active, custom IPsec/IKE policy, ExpressRoute/VPN co-existence

( * ) 可以对“PolicyBasedTrafficSelectors”进行配置,以便将基于路由的 VPN 网关(VpnGw1、VpnGw2、VpnGw3)连接到多个本地的基于策略的防火墙设备。(*) You can configure "PolicyBasedTrafficSelectors" to connect a route-based VPN gateway (VpnGw1, VpnGw2, VpnGw3) to multiple on-premises policy-based firewall devices. 有关详细信息,请参阅使用 PowerShell 将 VPN 网关连接到多个本地的基于策略的 VPN 设备Refer to Connect VPN gateways to multiple on-premises policy-based VPN devices using PowerShell for details.

重设网关 SKU 大小Resizing gateway SKUs

  1. 可以在 VpnGw1 SKU、VpnGw2 SKU 和 VpnGw3 SKU 之间调整大小。You can resize between VpnGw1, VpnGw2, and VpnGw3 SKUs.
  2. 使用旧版网关 SKU 时,仍可在基本、标准和高性能 SKU 之间调整大小。When working with the old gateway SKUs, you can resize between Basic, Standard, and HighPerformance SKUs.
  3. 不能从基本/标准/高性能 SKU 调整为新版 VpnGw1/VpnGw2/VpnGw3 SKU,You cannot resize from Basic/Standard/HighPerformance SKUs to the new VpnGw1/VpnGw2/VpnGw3 SKUs. 而只能迁移到新版 SKU。You must, instead, migrate to the new SKUs.

从旧 SKU 迁移到新 SKUMigrating from old SKUs to the new SKUs

备注

  • 从旧的 SKU 迁移到新的 SKU 时,VPN 网关公共 IP 地址会更改。The VPN gateway Public IP address will change when migrating from an old SKU to a new SKU.
  • 不能将经典 VPN 网关迁移到新的 SKU。You can't migrate classic VPN gateways to the new SKUs. 经典 VPN 网关只能使用旧版(老版)SKU。Classic VPN gateways can only use the legacy (old) SKUs.

不能在旧的 SKU 和新的 SKU 系列之间重设 Azure VPN 网关大小。You can't resize your Azure VPN gateways between the old SKUs and the new SKU families. 如果你在 Resource Manager 部署模型中的 VPN 网关使用旧版 SKU,则可迁移到新的 SKU。If you have VPN gateways in the Resource Manager deployment model that are using the older version of the SKUs, you can migrate to the new SKUs. 若要进行迁移,请删除虚拟网络的现有 VPN 网关,然后创建一个新的。To migrate, you delete the existing VPN gateway for your virtual network, then create a new one.

迁移工作流:Migration workflow:

  1. 删除到虚拟网关的任何连接。Remove any connections to the virtual network gateway.
  2. 删除旧的 VPN 网关。Delete the old VPN gateway.
  3. 创建新的 VPN 网关。Create the new VPN gateway.
  4. 使用新的 VPN 网关 IP 地址更新本地 VPN 设备(适用于站点到站点连接)。Update your on-premises VPN devices with the new VPN gateway IP address (for Site-to-Site connections).
  5. 更新将连接到本网关的任何 VNet 到 VNet 本地网关的网关 IP 地址值。Update the gateway IP address value for any VNet-to-VNet local network gateways that will connect to this gateway.
  6. 下载适用于 P2S 客户端(通过此 VPN 网关连接到虚拟网络)的新客户端 VPN 配置包。Download new client VPN configuration packages for P2S clients connecting to the virtual network through this VPN gateway.
  7. 重新创建到虚拟网关的连接。Recreate the connections to the virtual network gateway.

配置网关 SKUConfigure the gateway SKU

Azure 门户Azure portal

如果使用 Azure 门户创建 Resource Manager 虚拟网络网关,可以使用下拉列表选择网关 SKU。If you use the Azure portal to create a Resource Manager virtual network gateway, you can select the gateway SKU by using the dropdown. 显示的选项对应于所选的网关类型和 VPN 类型。The options you are presented with correspond to the Gateway type and VPN type that you select.

PowerShellPowerShell

以下 PowerShell 示例将 -GatewaySku 指定为 VpnGw1。The following PowerShell example specifies the -GatewaySku as VpnGw1.

New-AzureRmVirtualNetworkGateway -Name vnetgw1 -ResourceGroupName testrg `
-Location 'West US' -IpConfigurations $gwipconfig -GatewaySku VpnGw1 `
-GatewayType Vpn -VpnType RouteBased

更改网关 SKU 或为其调整大小Change (resize) a gateway SKU

如果想要将网关 SKU 升级到更强大的 SKU,可以使用 Resize-AzureRmVirtualNetworkGateway PowerShell cmdlet。If you want to upgrade your gateway SKU to a more powerful SKU, you can use the Resize-AzureRmVirtualNetworkGateway PowerShell cmdlet. 也可以使用此 cmdlet 下调网关 SKU 大小。You can also downgrade the gateway SKU size using this cmdlet.

以下 PowerShell 示例演示如何将网关 SKU 的大小调整为 VpnGw2。The following PowerShell example shows a gateway SKU being resized to VpnGw2.

$gw = Get-AzureRmVirtualNetworkGateway -Name vnetgw1 -ResourceGroupName testrg
Resize-AzureRmVirtualNetworkGateway -VirtualNetworkGateway $gw -GatewaySku VpnGw2

连接类型Connection types

在 Resource Manager 部署模型中,每个配置都需要特定的虚拟网络网关连接类型。In the Resource Manager deployment model, each configuration requires a specific virtual network gateway connection type. -ConnectionType 的可用 Resource Manager PowerShell 值为:The available Resource Manager PowerShell values for -ConnectionType are:

  • IPsecIPsec
  • Vnet2VnetVnet2Vnet
  • ExpressRouteExpressRoute
  • VPNClientVPNClient

在以下 PowerShell 示例中,我们将创建需要 IPsec 连接类型的 S2S 连接。In the following PowerShell example, we create a S2S connection that requires the connection type IPsec.

New-AzureRmVirtualNetworkGatewayConnection -Name localtovon -ResourceGroupName testrg `
-Location 'West US' -VirtualNetworkGateway1 $gateway1 -LocalNetworkGateway2 $local `
-ConnectionType IPsec -RoutingWeight 10 -SharedKey 'abc123'

VPN 类型VPN types

为 VPN 网关配置创建虚拟网络网关时,必须指定 VPN 类型。When you create the virtual network gateway for a VPN gateway configuration, you must specify a VPN type. 选择的 VPN 类型取决于要创建的连接拓扑。The VPN type that you choose depends on the connection topology that you want to create. 例如,P2S 连接需要 RouteBased VPN 类型。For example, a P2S connection requires a RouteBased VPN type. VPN 类型还取决于使用的硬件。A VPN type can also depend on the hardware that you are using. S2S 配置需要 VPN 设备。S2S configurations require a VPN device. 有些 VPN 设备仅支持特定的 VPN 类型。Some VPN devices only support a certain VPN type.

选择的 VPN 类型必须满足所要创建的解决方案的所有连接要求。The VPN type you select must satisfy all the connection requirements for the solution you want to create. 例如,如果要为同一虚拟网络创建 S2S VPN 网关连接和 P2S VPN 网关连接,应使用 VPN 类型基于路由,因为 P2S 需要“基于路由”VPN 类型。For example, if you want to create a S2S VPN gateway connection and a P2S VPN gateway connection for the same virtual network, you would use VPN type RouteBased because P2S requires a RouteBased VPN type. 此外,需确认 VPN 设备支持 RouteBased VPN 连接。You would also need to verify that your VPN device supported a RouteBased VPN connection.

创建虚拟网络网关后,无法更改 VPN 类型。Once a virtual network gateway has been created, you can't change the VPN type. 必须删除虚拟网络网关,并新建一个。You have to delete the virtual network gateway and create a new one. 有两种 VPN 类型:There are two VPN types:

  • 基于策略:基于策略的 VPN 以前在经典部署模型中称为静态路由网关。PolicyBased: PolicyBased VPNs were previously called static routing gateways in the classic deployment model. 基于策略的 VPN 会根据使用本地网络和 Azure VNet 之间的地址前缀的各种组合配置的 IPsec 策略,加密数据包并引导其通过 IPsec 隧道。Policy-based VPNs encrypt and direct packets through IPsec tunnels based on the IPsec policies configured with the combinations of address prefixes between your on-premises network and the Azure VNet. 通常会在 VPN 设备配置中将策略(或流量选择器)定义为访问列表。The policy (or traffic selector) is usually defined as an access list in the VPN device configuration. 基于策略的 VPN 类型的值为 PolicyBasedThe value for a PolicyBased VPN type is PolicyBased. 使用 PolicyBased VPN 时,请记住下列限制:When using a PolicyBased VPN, keep in mind the following limitations:

    • 基于策略的 VPN 能在基本网关 SKU 上使用。PolicyBased VPNs can only be used on the Basic gateway SKU. 此 VPN 类型与其他网关 SKU 不兼容。This VPN type is not compatible with other gateway SKUs.
    • 如果使用 PolicyBased VPN,可以只有 1 个隧道。You can have only 1 tunnel when using a PolicyBased VPN.
    • 只能将 PolicyBased VPN 用于 S2S 连接且只能用于特定配置。You can only use PolicyBased VPNs for S2S connections, and only for certain configurations. 大多数 VPN 网关配置需要 RouteBased VPN。Most VPN Gateway configurations require a RouteBased VPN.
  • 基于路由:基于路由的 VPN 以前在经典部署模型中称为动态路由网关。RouteBased: RouteBased VPNs were previously called dynamic routing gateways in the classic deployment model. RouteBased VPN 使用 IP 转发或路由表中的“路由”将数据包引导到相应的隧道接口中。RouteBased VPNs use "routes" in the IP forwarding or routing table to direct packets into their corresponding tunnel interfaces. 然后,隧道接口会加密或解密出入隧道的数据包。The tunnel interfaces then encrypt or decrypt the packets in and out of the tunnels. RouteBased VPN 的策略(或流量选择器)配置为任意到任意(或通配符)。The policy (or traffic selector) for RouteBased VPNs are configured as any-to-any (or wild cards). 基于路由的 VPN 类型的值为 RouteBasedThe value for a RouteBased VPN type is RouteBased.

以下 PowerShell 示例将 -VpnType 指定为基于路由The following PowerShell example specifies the -VpnType as RouteBased. 在创建网关时,必须确保用于配置的 -VpnType 正确。When you are creating a gateway, you must make sure that the -VpnType is correct for your configuration.

New-AzureRmVirtualNetworkGateway -Name vnetgw1 -ResourceGroupName testrg `
-Location 'West US' -IpConfigurations $gwipconfig `
-GatewayType Vpn -VpnType RouteBased

网关要求Gateway requirements

下表列出了基于策略和基于路由的 VPN 网关的要求。The following table lists the requirements for PolicyBased and RouteBased VPN gateways. 此表适用于 Resource Manager 与经典部署模型。This table applies to both the Resource Manager and classic deployment models. 对于经典模型,基于策略的 VPN 网关与静态网关相同,基于路由的网关与动态网关相同。For the classic model, PolicyBased VPN gateways are the same as Static gateways, and Route-based gateways are the same as Dynamic gateways.

基于策略的基本 VPN 网关PolicyBased Basic VPN Gateway 基于路由的基本 VPN 网关RouteBased Basic VPN Gateway 基于路由的标准 VPN 网关RouteBased Standard VPN Gateway 基于路由的高性能 VPN 网关RouteBased High Performance VPN Gateway
站点到站点连接 (S2S)Site-to-Site connectivity (S2S) 基于策略的 VPN 配置PolicyBased VPN configuration 基于路由的 VPN 配置RouteBased VPN configuration 基于路由的 VPN 配置RouteBased VPN configuration 基于路由的 VPN 配置RouteBased VPN configuration
点到站点连接 (P2S)Point-to-Site connectivity (P2S) 不支持Not supported 支持(可与 S2S 共存)Supported (Can coexist with S2S) 支持(可与 S2S 共存)Supported (Can coexist with S2S) 支持(可与 S2S 共存)Supported (Can coexist with S2S)
身份验证方法Authentication method 预共享密钥Pre-shared key S2S 连接的预共享密钥,P2S 连接的证书Pre-shared key for S2S connectivity, Certificates for P2S connectivity S2S 连接的预共享密钥,P2S 连接的证书Pre-shared key for S2S connectivity, Certificates for P2S connectivity S2S 连接的预共享密钥,P2S 连接的证书Pre-shared key for S2S connectivity, Certificates for P2S connectivity
S2S 连接的最大数目Maximum number of S2S connections 11 1010 1010 3030
P2S 连接的最大数目Maximum number of P2S connections 不支持Not supported 128128 128128 128128
活动路由支持 (BGP)Active routing support (BGP) 不支持Not supported 不支持Not supported 支持Supported 支持Supported

网关子网Gateway subnet

在创建 VPN 网关之前,必须创建一个网关子网。Before you create a VPN gateway, you must create a gateway subnet. 网关子网包含虚拟网络网关 VM 和服务使用的 IP 地址。The gateway subnet contains the IP addresses that the virtual network gateway VMs and services use. 在创建虚拟网络网关时,将网关 VM 部署到网关子网,并使用所需的 VPN 网关设置进行配置。When you create your virtual network gateway, gateway VMs are deployed to the gateway subnet and configured with the required VPN gateway settings. 不能将任何其他内容(例如,其他 VM)部署到网关子网。You must never deploy anything else (for example, additional VMs) to the gateway subnet. 网关子网必须命名为“GatewaySubnet”才能正常工作。The gateway subnet must be named 'GatewaySubnet' to work properly. 将网关子网命名为“GatewaySubnet”,可以让 Azure 知道这就是要将虚拟网络网关 VM 和服务部署到的目标子网。Naming the gateway subnet 'GatewaySubnet' lets Azure know that this is the subnet to deploy the virtual network gateway VMs and services to.

创建网关子网时,请指定子网包含的 IP 地址数。When you create the gateway subnet, you specify the number of IP addresses that the subnet contains. 将网关子网中的 IP 地址分配到网关 VM 和网关服务。The IP addresses in the gateway subnet are allocated to the gateway VMs and gateway services. 有些配置需要具有比其他配置更多的 IP 地址。Some configurations require more IP addresses than others. 查看要创建的配置的说明,验证想要创建的网关子网是否会满足这些要求。Look at the instructions for the configuration that you want to create and verify that the gateway subnet you want to create meets those requirements. 此外,可能需要确保网关子网包含足够多的 IP 地址,以便应对将来可能会添加的配置。Additionally, you may want to make sure your gateway subnet contains enough IP addresses to accommodate possible future additional configurations. 尽管网关子网最小可创建为 /29,但建议创建 /28 或更大(/28、/27 和 /26 等)的网关子网。While you can create a gateway subnet as small as /29, we recommend that you create a gateway subnet of /28 or larger (/28, /27, /26 etc.). 这样一来,如果以后添加功能,就无需断开网关,删除并重新创建网关子网以容纳更多 IP 地址。That way, if you add functionality in the future, you won't have to tear your gateway, then delete and recreate the gateway subnet to allow for more IP addresses.

以下 Resource Manager PowerShell 示例显示名为 GatewaySubnet 的网关子网。The following Resource Manager PowerShell example shows a gateway subnet named GatewaySubnet. 可以看到,CIDR 表示法指定了 /27,这可提供足够的 IP 地址供大多数现有配置使用。You can see the CIDR notation specifies a /27, which allows for enough IP addresses for most configurations that currently exist.

Add-AzureRmVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -AddressPrefix 10.0.3.0/27

重要

使用网关子网时,避免将网络安全组 (NSG) 与网关子网关联。When working with gateway subnets, avoid associating a network security group (NSG) to the gateway subnet. 将网络安全组与此子网关联可能会导致 VPN 网关停止按预期方式工作。Associating a network security group to this subnet may cause your VPN gateway to stop functioning as expected. 有关网络安全组的详细信息,请参阅什么是网络安全组?For more information about network security groups, see What is a network security group?

本地网络网关Local network gateways

创建 VPN 网关配置时,本地网络网关通常代表本地位置。When creating a VPN gateway configuration, the local network gateway often represents your on-premises location. 在经典部署模型中,本地网络网关称为本地站点。In the classic deployment model, the local network gateway was referred to as a Local Site.

指定本地网络网关的名称(即本地 VPN 设备的公共 IP 地址),并指定位于本地位置的地址前缀。You give the local network gateway a name, the public IP address of the on-premises VPN device, and specify the address prefixes that are located on the on-premises location. Azure 将查看网络流量的目标地址前缀、查阅针对本地网络网关指定的配置,并相应地路由数据包。Azure looks at the destination address prefixes for network traffic, consults the configuration that you have specified for your local network gateway, and routes packets accordingly. 也应该针对使用 VPN 网关连接的 VNet 到 VNet 配置指定本地网络网关。You also specify local network gateways for VNet-to-VNet configurations that use a VPN gateway connection.

以下 PowerShell 示例创建新的本地网络网关:The following PowerShell example creates a new local network gateway:

New-AzureRmLocalNetworkGateway -Name LocalSite -ResourceGroupName testrg `
-Location 'West US' -GatewayIpAddress '23.99.221.164' -AddressPrefix '10.5.51.0/24'

有时需要修改本地网络网关设置。Sometimes you need to modify the local network gateway settings. 例如,在添加或修改地址范围时,或 VPN 设备的 IP 地址发生变化时。For example, when you add or modify the address range, or if the IP address of the VPN device changes. 请参阅使用 PowerShell 修改本地网络网关设置See Modify local network gateway settings using PowerShell.

REST API 和 PowerShell cmdletREST APIs and PowerShell cmdlets

有关将 REST API、PowerShell cmdlet 或 Azure CLI 用于 VPN 网关配置的其他技术资源和具体语法要求,请参阅以下页面:For additional technical resources and specific syntax requirements when using REST APIs, PowerShell cmdlets, or Azure CLI for VPN Gateway configurations, see the following pages:

经典Classic Resource ManagerResource Manager
PowerShellPowerShell PowerShellPowerShell
REST APIREST API REST APIREST API
不支持Not supported Azure CLIAzure CLI

后续步骤Next steps

有关可用连接配置的详细信息,请参阅关于 VPN 网关For more information about available connection configurations, see About VPN Gateway.