为专用互连建立 99.9% 可用性配置

以下配置使用专用互连来实现 99.99% 可用性。对于生产级应用,如对停机时间容忍度低的任务关键型操作,Google 建议采用该配置。

如需了解本页面中使用的 Cloud Interconnect 术语,请参阅关键术语

如需了解如何在故障切换方案中创建具有足够容量的冗余专用互连连接,请参阅最佳做法

使用要求

为了实现 99.99% 可用性,需要以下资源和设置:

  • 至少四个专用互连连接,其中两个连接在一个都市区(都市圈),两个连接在另一个都市圈。同一都市圈中的连接必须位于不同的边缘可用性网域(都市圈可用区),才能实现 99.99% 的可用性。将专用互连连接置于同一个都市圈中的两个边缘可用性网域非常重要,因为维护窗口跨都市圈内的边缘可用性网域协调,而维护窗口不跨都市圈协调。

  • 位于至少两个不同的 Google Cloud 区域中的至少两个 Cloud Router。 即使所有虚拟机 (VM) 实例都位于同一个区域中,您也必须将 Cloud Router 置于至少两个区域中。如果发生区域范围问题,Google Cloud 可以通过另一个区域将流量重新路由到您的虚拟机。每个 Cloud Router 都必须连接到一个都市圈中的一对专用互连(每个 Cloud Router 两个 VLAN 连接)。

  • Virtual Private Cloud (VPC) 网络的动态路由模式必须为全局。通过全局动态路由,Cloud Router 路由器可以通告所有子网,并将已知路由传播至所有子网(无论子网的区域如何)。

  • 根据您的可用性要求,您可以在本地网络中使用两个路由器,每个路由器连接到一个 Google Cloud 可用区。

示例拓扑

以下示例拓扑显示了位于两个不同都市圈和不同边缘可用性网域中的四个专用互连连接:lga-zone1-16lga-zone2-1422iad-zone1-1iad-zone2-1。Cloud Router 路由器(每个区域一个)位于 us-central1us-east1 区域的 vpc1 网络中。每个路由器都有自己的边界网关协议 (BGP) 会话。

可实现 99.99% 可用性的冗余连接(点击可放大)。
可实现 99.99% 可用性的冗余连接(点击可放大)

配置首选路径

通过全局动态路由,Cloud Router 路由器向 VPC 网络中的所有子网通告路由。Cloud Router 路由器向远程子网(Cloud Router 路由器区域以外的子网)通告路由所采用的优先级,低于向本地子网(位于 Cloud Router 路由器区域的子网)通告的优先级。如需了解详情,请参阅 Cloud Router 路由器文档中的动态路由模式

在示例拓扑中,VPC 网络的入站流量优先经过 us-central1,因为这些路由的优先级高于 us-east1 区域中的路由。只有当 us-central1 中的连接失败时,流量才会遍历 us-east1

您可以在配置云端路由器的 BGP 会话时更改路由优先级。BGP 会话提供一个选项,供您选择通告路由优先级(一个 MED 值)。值越小,优先级越高。例如,您可为 us-east1 中的 BGP 会话配置较高优先级,使该区域成为首选路径。如需了解详情,请参阅 Cloud Router 文档中的通告前缀和优先级

创建 99.99% 拓扑

以下几个部分介绍创建此拓扑的步骤。 要量身定制自己的拓扑,请将示例输入值替换成您的资源的相应值。例如,将 vpc1 网络名称替换成您的 VPC 网络名称。

更改 VPC 网络的动态路由模式

对于 vpc1 网络,将动态路由模式更改为全局。

控制台

  1. 在 Google Cloud 控制台中,进入 VPC 网络页面。

    转到 VPC 网络页面

  2. 选择 vpc1 网络,然后点击修改

  3. 动态路由模式下,选择全局

  4. 点击保存

gcloud

gcloud compute networks update vpc1\
   --bgp-routing-mode global

订购专用互连连接

您可以使用 Google Cloud 控制台或 Google Cloud CLI 订购重复的连接。

控制台

  1. 在 Google Cloud 控制台中,转到互连混合连接页面。

    前往“互连混合连接”

  2. 点击开始使用

  3. 选择专用互连,然后点击继续

  4. 选择订购新的专用互连,然后点击继续

  5. 指定连接的详细信息:

    • 名称:输入 int-lga1
    • 说明:输入 Example connection in LGA ZONE1
    • 位置:选择 Digital Realty | Telx New York (111 8th Ave),这是 lga-zone1-16 位置的 PeeringDB 名称。
    • 容量:使用默认容量 (10 Gb/s)。
  6. 点击下一步

  7. 指定冗余连接的详细信息:

    • 名称:输入 int-lga2
    • 说明:输入 Example connection in LGA ZONE2
    • 位置:选择 zColo New York - 60 Hudson St,这是 lga-zone2-1422 位置的 PeeringDB 名称。
    • 容量:使用默认容量 (10 Gb/s)。
  8. 点击下一步

  9. 指定您的联系信息:

    • 公司名称:输入 The Customer。此名称在 LOA-CFA 中用作有权请求 Cloud Interconnect 连接的一方。
    • 技术联系人:输入 customer@customer.com。您不需要输入自己的地址;所有通知中都会包含您。
  10. 点击下一步

  11. 查看您的订单。检查连接的详细信息和联系信息是否正确。如果所有信息均正确,点击下订单。如果信息有误,请返回并修改连接详细信息。

  12. 在订单确认页面,查看后续步骤,然后点击完成

  13. 在位置 Equinix Ashburn (DC1-DC11) 再订购两个连接(int-iad1int-iad2),即 iad-zone1-1iad-zone2-1 位置的 PeeringDB 名称。由于阿什本提供商有两个可用区,因此 Google Cloud 控制台会自动为冗余连接选择同一提供商,但会选择不同可用区。

gcloud

  • 订购四个名为 int-lga1int-lga2int-iad1int-iad2 的专用互连连接:

    gcloud compute interconnects create int-lga1 \
      --customer-name "The Customer" \
      --description "Example connection in LGA ZONE1" \
      --interconnect-type DEDICATED \
      --link-type ETHERNET_10G_LR \
      --location lga-zone1-16 \
      --requested-link-count 1 \
      --noc-contact-email customer@customer.com
    gcloud compute interconnects create int-lga2 \
      --customer-name "The Customer" \
      --description "Example connection in LGA ZONE2" \
      --interconnect-type DEDICATED \
      --link-type ETHERNET_10G_LR \
      --location lga-zone2-1422 \
      --requested-link-count 1 \
      --noc-contact-email customer@customer.com
    gcloud compute interconnects create int-iad1 \
      --customer-name "The Customer" \
      --description "Example connection in IAD ZONE1" \
      --interconnect-type DEDICATED \
      --link-type ETHERNET_10G_LR \
      --location iad-zone1-1 \
      --requested-link-count 1 \
      --noc-contact-email customer@customer.com
    gcloud compute interconnects create int-iad2 \
      --customer-name "The Customer" \
      --description "Example connection in IAD ZONE2" \
      --interconnect-type DEDICATED \
      --link-type ETHERNET_10G_LR \
      --location iad-zone2-1 \
      --requested-link-count 1 \
      --noc-contact-email customer@customer.com

订购专用互连连接后,Google 会通过电子邮件向您发送确认,并为您分配端口。分配完成后,Google 会针对您的连接生成 LOA-CFA,并将其通过电子邮件发送给您。所有自动发送的电子邮件将发送给 NOC 联系人和连接订购人员。

只有在预配并测试连接后,您才可以使用连接。如需详细了解预配过程,请参阅预配概览

创建云端路由器

创建两个 Cloud Router 路由器,每个区域各一个。

控制台

  1. 在 Google Cloud 控制台中,转到创建 Cloud Router 路由器页面。

    前往“创建 Cloud Router 路由器”

  2. 指定 Cloud Router 路由器详细信息:

    • 名称:输入 rtr-cent1 作为第一个 Cloud Router 路由器的名称。
    • 网络:选择 vpc1,这是本地网络扩展到的目标网络的名称。
    • 区域:选择 us-central1,这是配置了 Cloud Router 路由器的区域,如示例拓扑所示。
    • Google ASN:输入 64513,这是示例 Cloud Router 路由器的 ASN。
  3. 路由下,选择通告向 Cloud Router 公开的所有子网(默认),然后点击创建

  4. us-east1 区域中再创建一个具有相同属性的 Cloud Router 路由器,名称为 rtr-east1

gcloud

  1. us-central1 区域的 vpc1 网络中创建 Cloud Router 路由器;使用 ASN 64513

    gcloud compute routers create rtr-cent1 \
       --asn 64513 \
       --network vpc1 \
       --region us-central1
  2. us-east1 区域的 vpc1 网络中创建 Cloud Router 路由器;使用 ASN 64513

    gcloud compute routers create rtr-east1 \
       --asn 64513 \
       --network vpc1 \
       --region us-east1

创建 VLAN 连接

连接可供使用(处于 ACTIVE 状态)后,创建 VLAN 连接,以便将连接与 Cloud Router 路由器连接。创建四个连接,每个 Cloud Interconnect 连接一个,并使用下表所述的路由器:

  • rtr-cent1 连接到 int-lga1int-lga2
  • rtr-east1 连接到 int-iad1int-iad2

控制台

  1. 在 Google Cloud 控制台中,进入 VLAN 连接标签页。

    转到 VLAN 连接

  2. 点击添加 VLAN 连接

  3. 选择专用互连,然后点击继续

  4. 选择在此项目中

  5. 选择 int-lga1 连接,然后点击继续

  6. 选择添加 VLAN 连接

    • 名称:输入 attachment-lga1-central1
    • 路由器:选择 rtr-cent1 Cloud Router 路由器。
  7. 点击创建。创建连接需要一点时间。

  8. 对于连接,如需将 BGP 会话添加到 rtr-cent1,请点击配置。VLAN 连接已填充 Google 和对等 BGP IP 地址。

  9. 记录每个连接的 IP 地址、ASN 和 VLAN 标记。配置本地路由器需要此信息。

  10. 如需添加 BGP 会话,请点击保存配置。在您在本地路由器上配置 BGP 之前,BGP 会话处于非活动状态。

  11. 为其他连接再创建三个连接:

    • int-lga2 (rtr-cent1)
    • int-iad1 (rtr-east1)
    • int-iad2rtr-east1

    记录每个连接的信息。

gcloud

  1. 创建四个连接:

    gcloud compute interconnects attachments create attachment-lga1-central1 \
       --interconnect int-lga1 \
       --router rtr-cent1 \
       --region us-central1
    gcloud compute interconnects attachments create attachment-lga2-central1 \
       --interconnect int-lga2 \
       --router rtr-cent1 \
       --region us-central1
    gcloud compute interconnects attachments create attachment-iad1-east1 \
       --interconnect int-iad1 \
       --router rtr-east1 \
       --region us-east1
    gcloud compute interconnects attachments create attachment-iad2-east1 \
       --interconnect int-iad2 \
       --router rtr-east1 \
       --region us-east1
  2. 描述 attachment-lga1-central1 连接以检索它分配的资源,如 VLAN ID 和 BGP 对等互连地址;使用这些值配置 Cloud Router 路由器和本地路由器:

    gcloud compute interconnects attachments describe attachment-lga1-central1 \
       --region us-central1

    以上命令输出以下信息:

    cloudRouterIpAddress: 169.254.58.49/29
    creationTimestamp: '2017-08-15T08:34:11.137-07:00'
    customerRouterIpAddress: 169.254.58.50/29
    id: '5630382895290821276'
    interconnect:
    https://www.googleapis.com/compute/v1/projects/customer-project/global/interconnects/int-lga1
    kind: compute#interconnectAttachment
    name: attachment-lga1-central1
    operationalStatus: ACTIVE
    privateInterconnectInfo:
      tag8021q: 1000
    region: https://www.googleapis.com/compute/v1/projects/customer-project/regions/us-central1
    router: https://www.googleapis.com/compute/v1/projects/customer-project/regions/us-central1/routers/router1
    selfLink: https://www.googleapis.com/compute/v1/projects/customer-project/regions/us-central1/interconnectAttachments/attachment-lga1-central1
      
  3. 记录以下值:

    • tag8021q:指定 VLAN ID,即 1000。VLAN ID 可识别经过此连接的流量。使用此值配置本地路由器上已标记的 VLAN 子接口。
    • cloudRouterIpAddress:Cloud Router 路由器 IP 地址,即 169.254.58.49/29。将此地址分配给 Cloud Router 接口,并将此地址指定为本地路由器上的 BGP 邻居。
    • customerRouterIpAddress:客户路由器 IP 地址,即 169.254.58.50/29。在 Cloud Router 路由器上,将此地址指定为已为其分配 Cloud Router 路由器 IP 地址的接口上的 BGP 对等地址。将此地址分配给本地路由器上的 VLAN 子接口。
  4. rtr-cent1 Cloud Router 路由器上,为 attachment-lga1-central1 连接添加接口:

    gcloud compute routers add-interface rtr-cent1 \
       --interface-name rtr-cent1-1 \
       --interconnect-attachment attachment-lga1-central1 \
       --ip-address 169.254.58.49 \
       --mask-length 29 \
       --region us-central1
  5. 将对等 BGP 添加到接口;对于本示例,本地 ASN 为 12345

    gcloud compute routers add-bgp-peer rtr-cent1 \
       --interface rtr-cent1-1 \
       --peer-name central1 \
       --peer-ip-address 169.254.58.50 \
       --peer-asn 12345 \
       --advertised-route-priority 100 \
       --region us-central1
  6. 描述其他连接,然后按照类似方法在适当的 Cloud Router 路由器上配置新的 BGP 会话。

配置本地路由器

如需配置本地路由器,请使用 VLAN 连接中的信息。以下示例摘自某 Juniper 路由器配置。您可参照该示例来配置您自己的路由器。如需了解详情,请参阅配置本地路由器

interface ae20 {
  flexible-vlan-tagging;
  native-vlan-id 1;
  aggregated-ether-options {
    lacp {
      active;
     }
   }
  unit 1000 {
    vlan-id 1000;
    family inet {
      address 169.254.58.50/29;
    }
  }
}

protocols bgp {
  group google {
    type external;
    multihop {
      ttl 4;
    }
    hold-time 60;
    peer-as 64513;
    local-as 12345;
    local-address 169.254.58.50;
    neighbor 169.254.58.49 {
      ...
    }
  }
}

后续步骤