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

虚拟网络对等互连Virtual network peering

使用虚拟网络对等互连可以无缝连接两个 Azure 虚拟网络Virtual network peering enables you to seamlessly connect two Azure virtual networks. 建立对等互连后,出于连接目的,两个虚拟网络会显示为一个。Once peered, the virtual networks appear as one, for connectivity purposes. 对等虚拟网络中虚拟机之间的流量通过 Microsoft 主干基础结构路由,非常类似于只通过专用 IP 地址在同一虚拟网络中的虚拟机之间路由流量。The traffic between virtual machines in the peered virtual networks is routed through the Microsoft backbone infrastructure, much like traffic is routed between virtual machines in the same virtual network, through private IP addresses only.

使用虚拟网络对等互连的优点包括:The benefits of using virtual network peering include:

  • 对等虚拟网络之间的网络流量是专用的。Network traffic between peered virtual networks is private. 虚拟网络之间的流量仅限于 Microsoft 主干网络。Traffic between the virtual networks is kept on the Microsoft backbone network. 在虚拟网络之间通信不需公共 Internet、网关或加密。No public Internet, gateways, or encryption is required in the communication between the virtual networks.
  • 不同虚拟网络中资源之间的连接延迟低且带宽高。A low-latency, high-bandwidth connection between resources in different virtual networks.
  • 在虚拟网络对等互连之后,一个虚拟网络中的资源与另一虚拟网络中的资源通信的功能。The ability for resources in one virtual network to communicate with resources in a different virtual network, once the virtual networks are peered.
  • 跨 Azure 订阅、部署模型和 Azure 区域传输数据的功能。The ability to transfer data across Azure subscriptions, deployment models, and across Azure regions.
  • 可将通过 Azure 资源管理器创建的虚拟网络对等互连,或者将一个通过资源管理器创建的虚拟网络对等互连到通过经典部署模型创建的虚拟网络。The ability to peer virtual networks created through the Azure Resource Manager or to peer one virtual network created through Resource Manager to a virtual network created through the classic deployment model. 若要详细了解 Azure 部署模型,请参阅了解 Azure 部署模型To learn more about Azure deployment models, see Understand Azure deployment models.
  • 在创建对等互连之时或之后,虚拟网络中的资源不会出现停机的现象。No downtime to resources in either virtual network when creating the peering, or after the peering is created.

连接Connectivity

将虚拟网络对等互连后,其中一个虚拟网络中的虚拟机资源可直接连接到对等互连虚拟网络中的资源。After virtual networks are peered, resources in either virtual network can directly connect with resources in the peered virtual network.

同一区域中对等互连虚拟网络上的虚拟机之间的网络延迟与单个虚拟网络中的延迟相同。The network latency between virtual machines in peered virtual networks in the same region is the same as the latency within a single virtual network. 网络吞吐量取决于可供虚拟机使用的与其大小成比例的带宽。The network throughput is based on the bandwidth that's allowed for the virtual machine, proportionate to its size. 对等互连的带宽没有任何其他限制。There isn't any additional restriction on bandwidth within the peering.

对等互连虚拟网络中虚拟机之间的流量直接通过 Microsoft 主干基础结构路由,而不通过网关或公共 Internet 路由。The traffic between virtual machines in peered virtual networks is routed directly through the Microsoft backbone infrastructure, not through a gateway or over the public Internet.

可根据需要将网络安全组应用于虚拟网络(阻止访问其他虚拟网络)或子网。Network security groups can be applied in either virtual network to block access to other virtual networks or subnets, if desired. 配置虚拟网络对等互连时,可打开或关闭虚拟网络之间的网络安全组规则。When configuring virtual network peering, you can either open or close the network security group rules between the virtual networks. 如果打开对等虚拟网络之间的完全连接(这是默认选项),则可将网络安全组应用到特定子网或虚拟机,以便阻止或拒绝特定访问。If you open full connectivity between peered virtual networks (which is the default option), you can apply network security groups to specific subnets or virtual machines to block or deny specific access. 若要深入了解网络安全组,请参阅网络安全组概述To learn more about network security groups, see Network security groups overview.

服务链Service chaining

可将指向对等虚拟网络中虚拟机的用户定义的路由表配置为“下一跃点”IP 地址(也可配置指向虚拟网关的用户定义的路由),以便启用服务链。You can configure user-defined routes that point to virtual machines in peered virtual networks as the next hop IP address, or to virtual network gateways, to enable service chaining. 使用服务链,可以通过用户定义的路由将流量从一个虚拟网络定向到对等虚拟网络中的虚拟设备(或虚拟网关)。Service chaining enables you to direct traffic from one virtual network to a virtual appliance, or virtual network gateway, in a peered virtual network, through user-defined routes.

可以部署中心辐射型网络,允许中心虚拟网络在其中托管基础结构组件,如网络虚拟设备或 VPN 网关。You can deploy hub-and-spoke networks, where the hub virtual network can host infrastructure components such as a network virtual appliance or VPN gateway. 然后,可以将所有分散虚拟网络与中心虚拟网络对等。All the spoke virtual networks can then peer with the hub virtual network. 流量可以流经中心虚拟网络中的网络虚拟设备或 VPN 网关。Traffic can flow through network virtual appliances or VPN gateways in the hub virtual network.

通过虚拟网络对等互连,用户定义的路由中的下一个跃点可以成为对等虚拟网络中虚拟机或 VNP 网关的 IP 地址。Virtual network peering enables the next hop in a user-defined route to be the IP address of a virtual machine in the peered virtual network, or a VPN gateway. 但在虚拟网络之间进行路由时,不能通过用户定义的路由将 ExpressRoute 网关指定为下一跃点类型。You cannot however, route between virtual networks with a user-defined route specifying an ExpressRoute gateway as the next hop type. 若要深入了解用户定义的路由,请参阅用户定义的路由概述To learn more about user-defined routes, see User-defined routes overview. 若要了解如何创建中心和分支网络拓扑,请参阅中心和分支网络拓扑To learn how to create a hub and spoke network topology, see hub and spoke network topology.

网关和本地连接Gateways and on-premises connectivity

无论是否与另一个虚拟网络对等,每个虚拟网络仍可具有自己的网关,并使用它连接到本地网络。Each virtual network, regardless of whether it is peered with another virtual network, can still have its own gateway and use it to connect to an on-premises network. 即使虚拟网络对等,用户也可以使用网关配置虚拟网络到虚拟网络连接You can also configure virtual network-to-virtual network connections by using gateways, even though the virtual networks are peered.

若已配置虚拟网络互连的两个选项,则虚拟网络之间的流量将通过对等配置(即通过 Azure 主干)流通。When both options for virtual network interconnectivity are configured, the traffic between the virtual networks flows through the peering configuration (that is, through the Azure backbone).

在同一区域中建立虚拟网络对等互连后,还可将对等互连虚拟网络中的网关配置为本地网络的传输点。When virtual networks are peered in the same region, you can also configure the gateway in the peered virtual network as a transit point to an on-premises network. 在这种情况下,使用远程网关的虚拟网络没有自己的网关。In this case, the virtual network that is using a remote gateway cannot have its own gateway. 虚拟网络只能有一个网关。A virtual network can have only one gateway. 网关可能是本地网关或远程网关(对等虚拟网络中),如下图所示:The gateway can be either a local or remote gateway (in the peered virtual network), as shown in the following picture:

虚拟网络对等互连传输

通过不同部署模型或不同区域创建的虚拟网络之间的对等互连关系不支持网关传输。Gateway transit is not supported in the peering relationship between virtual networks created through different deployment models or in different regions. 若要使网关传输正常工作,对等互连关系中的两个虚拟网络都必须通过资源管理器创建,并且必须在同一区域中。Both virtual networks in the peering relationship must have been created through Resource Manager and must be in the same region for gateway transit to work.

正在共享单个 Azure ExpressRoute 连接的虚拟网络对等时,它们之间的流量会通过对等关系(即通过 Azure 主干网)流通。When the virtual networks that are sharing a single Azure ExpressRoute connection are peered, the traffic between them goes through the peering relationship (that is, through the Azure backbone network). 仍可在各个虚拟网络中使用本地网关连接到本地线路。You can still use local gateways in each virtual network to connect to the on-premises circuit. 也可使用共享网关,并为本地连接配置传输。Alternatively, you can use a shared gateway and configure transit for on-premises connectivity.

故障排除Troubleshoot

若要确认虚拟网络对等互连,可以检查有效路由,看虚拟网络的任何子网中是否存在网络接口。To confirm a virtual network peering, you can check effective routes for a network interface in any subnet in a virtual network. 如果虚拟网络对等互连存在,则虚拟网络中的所有子网都会有下一跃点类型为“VNet 对等互连”的路由,这适用于每个对等互连的虚拟网络中的每个地址空间。If a virtual network peering exists, all subnets within the virtual network have routes with next hop type VNet peering, for each address space in each peered virtual network.

还可以使用网络观察程序的连接性检查来排查与对等互连虚拟网络中某个虚拟机之间的连接问题。You can also troubleshoot connectivity to a virtual machine in a peered virtual network using Network Watcher's connectivity check. 可以通过连接性检查来确定流量如何从源虚拟机的网络接口路由到目标虚拟机的网络接口。Connectivity check lets you see how traffic is routed from a source virtual machine's network interface to a destination virtual machine's network interface.

要求和约束Requirements and constraints

若要了解要求和约束,请参阅虚拟网络对等互连要求和约束To learn about requirements and constraints, see Virtual network peering requirements and constraints. 若要了解可以为虚拟网络创建的对等互连的数目限制,请参阅 Azure 网络限制To learn about the limits for the number of peerings you can create for a virtual network, see Azure networking limits.

权限Permissions

若要了解创建虚拟网络对等互连所需的权限,请参阅虚拟网络对等互连权限To learn about permissions required to create a virtual network peering, see Virtual network peering permissions.

定价Pricing

利用虚拟网络对等互连的入口和出口流量会产生少许费用。There is a nominal charge for ingress and egress traffic that utilizes a virtual network peering connection. 有关详细信息,请参阅定价页For more information, see the pricing page.

后续步骤Next steps