为通过 Cloud Interconnect 实现的高可用性 VPN 添加高可用性 VPN 网关

本页面介绍了如何为现有的通过 Cloud Interconnect 实现的高可用性 VPN 部署添加高可用性 VPN 网关。

借助通过 Cloud Interconnect 实现的高可用性 VPN,您可以加密遍历专用互连连接或合作伙伴互连连接的流量。了解如何部署通过 Cloud Interconnect 实现的高可用性 VPN

增加 VLAN 连接的容量后,您可能需要向通过 Cloud Interconnect 实现的高可用性 VPN 部署添加高可用性 VPN 隧道。添加隧道的另一种情况是,您的 Cloud VPN 监控提醒检测到现有 VPN 隧道超出了建议的 50% 利用率阈值。此阈值可确保在 VLAN 连接发生故障时,有足够的容量用于隧道故障切换。

如需增加通过 Cloud Interconnect 实现的高可用性 VPN 部署中的容量,您必须添加高可用性 VPN 隧道。请按照您通常用来在现有高可用性 VPN 网关和外部对等 VPN 网关之间添加高可用性 VPN 隧道的步骤操作。如需了解详情,请参阅添加从高可用性 VPN 网关到对等 VPN 网关的隧道

只有在所有现有高可用性 VPN 网关接口都已连接到所有可用的对等 VPN 网关接口时,您才需要添加一个或多个高可用性 VPN 网关。作为替代方案,您还可以向本地网络添加一个或多个对等 VPN 网关。

您只能使用 Google Cloud CLI 或高可用性 VPN API 将高可用性 VPN 网关与加密的 VLAN 连接相关联。完成通过 Cloud Interconnect 实现的高可用性 VPN 的初始部署过程后,您无法使用 Google Cloud 控制台执行此操作。

如需创建高可用性 VPN 网关,请执行以下步骤。

gcloud

  1. 创建高可用性 VPN 网关。

    例如,以下命令会创建一个高可用性 VPN 网关,并将网关接口分配给加密的 VLAN 连接:

    gcloud compute vpn-gateways create vpn-gateway-c \
       --network NETWORK_NAME \
       --region REGION \
       --interconnect-attachments \
         ATTACHMENT_1,ATTACHMENT_2
    

    对于 --interconnect-attachments 参数,您需要列出两个 VLAN 连接。您列出的第一个 VLAN 连接会分配给高可用性 VPN 网关的接口 0 (if0),第二个 VLAN 连接会分配给接口 1 (if1)。

    示例命令可能如下所示:

    gcloud compute vpn-gateways create vpn-gateway-c \
        --network network-a \
        --region us-central1 \
        --interconnect-attachments \
          attachment-a-zone1,attachment-a-zone2
    
  2. 如果您已将加密的 VLAN 连接配置为使用高可用性 VPN 网关的区域级内部 IP 地址,请查看该网关的详细信息。系统会自动将预留范围内的两个内部 IP 地址分配给该网关。

    如需查看分配给高可用性 VPN 网关的接口的区域级内部 IP 地址,请使用以下命令:

    gcloud compute vpn-gateways describe VPN_GATEWAY_NAME
    

    输出可能如下所示:

    creationTimestamp: '2022-10-14T16:22:31.748-07:00'
    id: '678310480370225624'
    kind: compute#vpnGateway
    labelFingerprint: 2345567=
    name: vpn-gateway-c
    network: https://www.googleapis.com/compute/v1/projects/project-id/global/networks/network-a
    region: https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1
    selfLink: https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/vpnGateways/vpn-gateway-c
    stackType: IPV4_ONLY
    vpnInterfaces:
    – id: 0
    interconnectAttachment: https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/interconnectAttachments/attachment-a-zone1
    ipAddress: 192.168.20.3
    – id: 1
    interconnectAttachment: https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/interconnectAttachments/attachment-a-zone2
    ipAddress: 192.168.21.3
    

API

如需为高可用性 VPN 网关创建完整配置,请使用以下部分中的 API 命令。这些部分使用的所有字段值均为示例值。

如需创建高可用性 VPN 网关,请使用 vpnGateways.insert 方法发出 POST 请求:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/vpnGateways
   {
     "name": "vpn-gateway-c",
     "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME",
     "vpnInterfaces": [
        {
            interconnectAttachment: "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/attachment-a-zone1"
        },
        {
            interconnectAttachment: "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/attachment-a-zone2"
        }
     ]
   }

如果您已将加密的 VLAN 连接配置为使用高可用性 VPN 网关的区域级内部 IP 地址,则系统会自动将预留范围内的内部 IP 地址分配给该网关。

如需查看分配给高可用性 VPN 网关的区域级内部 IP 地址,请使用 vpnGateways.get 方法

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/vpnGateways/VPN_GATEWAY_NAME

输出可能如下所示:

{
"kind": "compute#vpnGateway",
"id": "678310480370225624",
"creationTimestamp": "2022-10-14T16:22:31.748-07:00",
"name": "vpn-gateway-c",
"region": "https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1",
"network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/network-a",
"selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/vpnGateways/vpngw-test",
"labelFingerprint": "2345567=",
"vpnInterfaces": [
  {
    "id": 0,
    "ipAddress": "192.168.20.3",
    "interconnectAttachment": "https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/interconnectAttachments/attachment-a-zone1"
  },
  {
    "id": 1,
    "ipAddress": "192.168.21.3",
    "interconnectAttachment": "https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/interconnectAttachments/attachment-a-zone2"
  }
 ],
"stackType": "IPV4_ONLY"
}

后续步骤