创建 3 个 VNET,其中所有流量都通过一个 VNET(中心辐射型)路由

Create 3 VNETS where all traffic is routed through one VNET (hub and spoke)

我正在想办法回答我最近在考试中遇到的问题。要求如下:

  1. 您计划跨 3 个虚拟网络(vnetA、vnetB 和 vnetC)创建 100 个 VM
  2. 所有流量都必须通过 vnetA 路由
  3. 所有虚拟机必须能够通过专用 IP 相互通信
  4. 解决方案不得要求任何虚拟网关
  5. 解决方案必须尽量减少对等互连的数量。
  6. 解决方案不得要求任何网络虚拟设备(VM 作为路由器)

对我来说,这听起来像是一个中心辐射型拓扑,我在其中执行以下步骤。

  1. 创建从 vnetA 到 vnetB 的 vnet 对等互连(允许转发流量)
  2. 创建从 vnetB 到 vnetA 的 vnet 对等
  3. 创建从 vnetA 到 vnetC 的 vnet 对等互连(允许转发流量)
  4. 创建从 vnetC 到 vnetA 的 vnet 对等

现在我需要辐条到辐条连接(在 vnetB 和 vnetC 之间),但它必须通过 vnetA,这让我感到困惑。我的第一个想法是简单地在上面的两个对等互连之间启用 Allow gateway transit/Use remote gateways 选项,但由于 vnetA 没有虚拟网关(我什至尝试将 GatewaySubnet 添加到 vnetA),它不允许这样做。

我似乎无法使用附加到 vnetB 和 vnetC 子网的自定义路由 table 来指定下一个跃点,除非我使用无法在此解决方案中使用的虚拟设备。

有人对如何解决这个问题有任何想法吗?

伙计,你走在正确的道路上。这一切都需要是 ARM;当你对等 VNET A 和 B 时,你需要做的就是 select "Allow virtual network access from VNET A/B = Enabled" 用于 A 和 B 之间以及 B 和 A 之间的对等。然后,对于 B 和 A 之间的对等,select "Allow forwarded traffic from VNETA = Enabled"。

B 和 C 之间不需要任何对等互连。
允许转发流量意味着允许不是源自 VNET A(因此 VNET C)的流量进入 VNET B。

在 B 和 C 之间重复相同的过程。然后您将拥有一个轴辐式设计。来自 B 的流量将通过 A 到达 C。因为你没有将任何流量遍历到 ExpressRoute、VPN 或经典 VNET,所以你不需要任何网关。

据我所知,要满足1-6的所有要求是不可能的。由于对等连接是不可传递的,尽管 对等 vnet 之间的传递网络流在 MS 路线图 上,根据此反馈 here,您必须在 VNetB 和 VNetC 之间创建 VNet 对等。但是这种方法会增加 VNetB 到 VNetC 之间的对等互连数量,并且流量不会通过 VNetA 路由。

快速测试后,select 允许转发流量 还不够。在中心 VNet 中配置虚拟网络设备时,此配置选项是必需的,以便传输流量可以通过中心进行路由。更多详情 here.

Allow forwarded traffic: Check this box to allow traffic forwarded by a network virtual appliance in a virtual network (that didn't originate from the virtual network) to flow to this virtual network through a peering. For example, consider three virtual networks named Spoke1, Spoke2, and Hub. A peering exists between each spoke virtual network and the Hub virtual network, but peerings don't exist between the spoke virtual networks. A network virtual appliance is deployed in the Hub virtual network, and user-defined routes are applied to each spoke virtual network that route traffic between the subnets through the network virtual appliance. If this checkbox is not checked for the peering between each spoke virtual network and the hub virtual network, traffic doesn't flow between the spoke virtual networks because the hub is not forwarding the traffic between the virtual networks. While enabling this capability allows the forwarded traffic through the peering, it does not create any user-defined routes or network virtual appliances. User-defined routes and network virtual appliances are created separately. Learn about user-defined routes. You don't need to check this setting if traffic is forwarded between virtual networks through an Azure VPN Gateway.

总而言之,您必须为中心辐射网络创建一个 VPN 网关,或者使用虚拟设备作为中心并为辐射网络创建 UDR。或者只是在 VNetB 和 VNetC 之间创建对等互连。

这需要 Hub and Spoke 设计:

  1. 在 VNET A 和 VNET B 之间创建 VNET 对等互连
  2. 在 VNET B 和 VNET A 之间创建 VNET 对等互连
  3. 在 VNET C 和 VNET B 之间创建 VNET 对等互连
  4. 在 VNET B 和 VNET C 之间创建 VNET 对等互连
  5. 在 VNET B 中添加子网网关
  6. 允许 VNET B 上的网关传输 -VNET A 对等互连
  7. 允许 VNET B 上的网关传输 -VNET C 对等互连
  8. 在 VNET B 中创建虚拟网络网关
  9. 创建路由表
  10. 将路由表附加到 VNET A 和 VNET B 子网
  11. 在 VNET A 上启用远程网关 - VNET B 对等互连
  12. 在 VNET C 上启用远程网关 - VNET B 对等互连

问题并没有说 NVA 不能使用,但任何此类部署都将构成您部署路由解决方案。该问题明确说明了在配置 IP 路由之前您将做什么,因此答案可能没有您预期的那么复杂。

假设您要提供例如在 vNIC 上启用了 IP 转发的 VM 以充当路由器,则您不需要网关子网或虚拟网关来实现中心辐射型拓扑。

  1. 创建 3 个子网,在您的示例中为 vnetA、vnetB 和 vnetC
  2. 从 vnetA,使用资源管理器部署模型创建与 VNETb 的对等
  3. 确保 "Allow forwarded traffic from vnetA to vnetB" 已启用
  4. 重复第 2 步和第 3 步,将 vnetB 替换为 vnetC

就是这样。现在,当您配置 IP 路由时,您将在集线器网络中配置路由器 VM 或其他网络虚拟设备 (NVA),并创建路由 Table 供以后应用到 vnetB 和 vnetC,指定路由器 VM 的内部 IP 作为下一个跳.