在這個教學課程中,您將使用合作夥伴互連網路建立和設定資源,以達到 99.99% 的可用性。Google 建議將此設定用於產品等級應用程式,例如對停機時間容忍度較低的關鍵作業。
如要瞭解本頁面使用的 Cloud Interconnect 術語,請參閱「重要術語」。
如要瞭解在備援情況下,合作夥伴互連網路連線是否有足夠的容量,請參閱最佳做法。
需求條件
需要下列資源和設定才能達到 99.99% 的可用性:
至少四個 VLAN 連結,每個Google Cloud 區域兩個。即使您只有單一地區的虛擬機器 (VM) 執行個體,也必須使用兩個區域。如此一來,如果一個地區發生問題, Google Cloud 還可以透過其他地區將流量重新轉送至您的 VM。每個 VLAN 連結都必須具有自己的 Cloud Router (兩個不同的 Cloud Router)。
當 Cloud Router 連線至不同邊緣可用性網域中的 VLAN 連結時,Google Cloud 會使用兩個軟體工作來提供備援功能。雖然只需要兩個 Cloud Router,但四個 Cloud Router 的拓樸 (每個 VLAN 連結一個) 也符合服務水準協議規定。
一個地區中的 VLAN 連結必須連線至某個都會區 (都會) 中的合作夥伴互連網路連線,而其他地區中的連結則必須連線至其他都會區的連線。
當您設定備援連結時, Google Cloud 主控台會自動為每個附件指派合作夥伴互連網路連線和不同的邊緣可用性網域 (都會區可用區)。
如要進一步瞭解如何選擇合作夥伴互連網路連線位置,請參閱「要求連線」。
虛擬私有雲 (VPC) 網路的動態轉送模式必須是全域。利用全域動態轉送功能,Cloud Router 可以公告所有子網路,並將路由器發現的路徑傳播至所有子網路,不論子網路的地區為何。
視硬體和可用性需求而定,您的內部部署網路中可以有一或多個路由器。
拓撲範例
這個範例拓撲使用下列資源名稱、地區和連線位置。在逐步進行本教學課程的操作時,請使用您自己的值取代這些值。
地區 | 路由器名稱 | VLAN 連結名稱 | 連線位置 | 邊緣可用性網域 |
---|---|---|---|---|
us-central1 |
router-central1 |
attach-central-a |
達拉斯 | 1 |
us-central1 |
router-central1 |
attach-central-b |
達拉斯 | 2 |
us-east4 |
router-east4 |
attach-east-a |
阿什本 | 1 |
us-east4 |
router-east4 |
attach-east-b |
阿什本 | 2 |
以下圖表顯示兩個不同都會區中的四個第 2 層連線。在每個都會區中,每個連線都位於不同的邊緣可用性網域:Dallas - domain 1
、Dallas - domain 2
、Ashburn - domain 1
和 Ashburn - domain 2
。
Cloud Router (每個地區一個) 位於 us-central1
和 us-east4
地區的 vpc1
網路中。對於第 2 層連線,使用者必須在其內部部署路由器上為每個 Cloud Router 設定邊界閘道通訊協定 (BGP) 工作階段。
與第 2 層拓撲類似,以下第 3 層拓撲顯示在兩個不同都會區和不同邊緣可用性網域中的四個合作夥伴互連網路連線。Cloud Router (每個區域一個) 位於 us-central1
和 us-east4
地區的 vpc1
網路中。對於第 3 層連線,服務供應商會設定 BGP 工作階段。
設定偏好路徑
如要達到 99.99% 的可用性,您必須將您的虛擬私有雲網路的動態轉送模式設定為全球。利用全球動態轉送功能,Cloud Router 可以將路徑公告至虛擬私人雲端網路中的所有子網路。Cloud Router 會將路徑通告至優先順序比本機子網路 (位於 Cloud Router 地區中的子網路) 低的遠端子網路 (Cloud Router 地區之外的子網路)。詳情請參閱 Cloud Router 說明文件中的「動態轉送模式」。
在拓撲範例中,進入虛擬私人雲端網路的輸入流量偏好通過 us-central1
區域,因為這些路徑的優先順序比來自 us-east4
區域的路徑高。只有當 us-central1
中的連線失敗時,流量才會通過 us-east4
。
您可以在設定 Cloud Router 的 BGP 工作階段時變更路徑優先順序。BGP 工作階段具有公告路徑優先順序 (MED 值) 的選項。值越低,優先順序越高。例如,您可以將 us-east4
中的 BGP 工作階段設定為具有較高的優先順序,使該地區成為偏好的路徑。詳情請參閱 Cloud Router 說明文件中的「公告前置字串和優先順序」。
建立 99.99% 拓撲
以下各節將逐一介紹建立此拓撲的步驟。如要建立個人化的拓撲,請使用您自己的值取代範例輸入值。例如,使用您的虛擬私人雲端網路名稱取代 vpc1
網路名稱。
建立虛擬私有雲網路
對於 vpc1
網路,請透過自訂子網路建立網路,然後將其動態轉送模式設定為全域。詳情請參閱 VPC 說明文件中的「建立自訂模式網路」。
主控台
在 Google Cloud 控制台中,前往「VPC Networks」(虛擬私有雲網路) 頁面。
按一下「建立虛擬私有雲網路」。
在「Name」(名稱) 中輸入
vpc1
。在「子網路建立模式」中,選取「自訂」。
指定您的子網路的詳細資料:
- 「Name」:輸入
subnet-uscentral1
。 - 區域:選取
us-central1
。 - IP 位址範圍:指定 IP 範圍,例如
192.168.1.0/24
。請使用不會與您的內部部署網路重疊的範圍。
- 「Name」:輸入
按一下 [新增子網路]。
指定您的第二個子網路的詳細資料:
- 「Name」:輸入
subnet-useast4
。 - 區域:選取
us-east4
。 - IP 位址範圍:指定 IP 範圍,例如
192.168.2.0/24
。請使用不會與您的內部部署網路重疊的範圍。
- 「Name」:輸入
在「動態轉送模式」區段中,選取 [全域]。
按一下 [建立]。
gcloud
建立自訂子網路:
gcloud compute networks create vpc1 \ --subnet-mode custom \ --bgp-routing-mode global
指定
us-central1
和us-east4
地區的子網路前置字串:gcloud compute networks subnets create subnet-uscentral1 \ --network vpc1 \ --region us-central1 \ --range 192.168.1.0/24
gcloud compute networks subnets create subnet-useast4 \ --network vpc1 \ --region us-east4 \ --range 192.168.2.0/24
建立 Cloud Router
建立兩個 Cloud Router,每個地區一個。對於合作夥伴互連網路,所有 Cloud Router 的本機 ASN 都必須為 16550
。
主控台
前往 Google Cloud 控制台的「Create a Cloud Router」頁面。
指定 Cloud Router 詳細資料:
- 名稱:輸入
router-central1
做為第一個 Cloud Router 的名稱。 - 「Network」:選取
vpc1
,這是內部部署網路延伸的目的地網路名稱。 - 地區:選取
us-central1
,這是 Cloud Router 的設定地區,如同範例拓撲所示。 - Google ASN:輸入
16550
,這是合作夥伴互連網路的必要設定。
- 名稱:輸入
在「路徑」下方,選取「公告 Cloud Router 可使用的所有子網路 (預設)」,然後按一下「建立」。
在
us-east4
地區中,使用名稱router-east4
建立另一個具有相同屬性的 Cloud Router。
gcloud
在
us-central1
地區的vpc1
網路中建立 Cloud Router,並使用 ASN16550
:gcloud compute routers create router-central1 \ --asn 16550 \ --network vpc1 \ --region us-central1
在
us-east4
地區的vpc1
網路中建立 Cloud Router,並使用 ASN16550
:gcloud compute routers create router-east4 \ --asn 16550 \ --network vpc1 \ --region us-east4
建立 VLAN 連結
建立四個 VLAN 連結並將連結與 Cloud Router 配對,如以下清單所示:
router-central1
與attach-central-a
和attach-central-b
相關router-east4
與attach-east-a
和attach-east-b
相關聯
主控台
在 Google Cloud 控制台中,前往「Interconnect Hybrid Connectivity」頁面。
按一下「開始使用」。
選取「合作夥伴互連網路」,然後按一下「繼續」。
選取 [我已有服務供應商]。
選取「Create a redundant pair of VLAN attachments (recommended)」(建立一組備援 VLAN 連結,建議做法)。
在「Network」(網路) 和「Region」(地區) 欄位中,選取
vpc1
網路和us-central1
地區,以指定要連線的虛擬私人雲端網路和地區。指定第一個 VLAN 連結 (VLAN A) 的詳細資料:
- Cloud Router:選取
router-central1
。 - VLAN 連結名稱:輸入
attach-central-a
。這個名稱會顯示在 Google Cloud 主控台中,並由 Google Cloud CLI 用於參照連結。
- Cloud Router:選取
指定第二個 VLAN 連結 (VLAN B) 的詳細資料:
- Cloud Router:選取
router-central1
。 - VLAN 連結名稱:輸入
attach-central-b
。
- Cloud Router:選取
按一下 [Create] (建立) 以建立連結,這項作業需要一些時間才能完成。
按一下 [OK] (確定) 以查看您的 VLAN 連結清單。
重複上述步驟,為
us-east4
區域建立另一組備援附件。
gcloud
建立四個附件:
gcloud compute interconnects attachments partner create attach-central-a \ --router router-central1 \ --region us-central1 \ --edge-availability-domain availability-domain-1
gcloud compute interconnects attachments partner create attach-central-b \ --router router-central1 \ --region us-central1 \ --edge-availability-domain availability-domain-2
gcloud compute interconnects attachments partner create attach-east-a \ --router router-east4 \ --region us-east4 \ --edge-availability-domain availability-domain-1
gcloud compute interconnects attachments partner create attach-east-b \ --router router-east4 \ --region us-east4 \ --edge-availability-domain availability-domain-2
擷取配對金鑰
建立 VLAN 連結後, Google Cloud 會為每個連結產生配對金鑰。配對金鑰可讓您無須提供專案或資源名稱的相關資訊,即可讓服務供應商識別您的 VLAN 連結。
主控台
在 Google Cloud 控制台中,前往「VLAN attachments」(VLAN 連結) 分頁。
找出
attach-central-a
VLAN 連結,然後按一下「View instructions」。Google Cloud 控制台會顯示該連結的配對金鑰。複製並記下金鑰,當您向服務供應商要求建立連線時,請將這些金鑰提供給他們。
按一下「OK」,返回 VLAN 連結清單。
擷取
attach-central-b
、attach-east-a
和attach-east-b
VLAN 連結的配對金鑰。
gcloud
透過描述每個 VLAN 連結配對金鑰來擷取金鑰,並使用這些金鑰要求與服務供應商建立連線:
gcloud compute interconnects attachments describe attach-central-a \ --region us-central1
先前的指令會輸出以下資訊:
adminEnabled: false edgeAvailabilityDomain: AVAILABILITY_DOMAIN_1 creationTimestamp: '2017-12-01T08:29:09.886-08:00' id: '7976913826166357434' kind: compute#interconnectAttachment labelFingerprint: 42WmSpB8rSM= name: attach-central-a pairingKey: 7e51371e-72a3-40b5-b844-2e3efefaee59/us-central1/1 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/router-central1 selfLink: https://www.googleapis.com/compute/v1/projects/customer-project/regions/us-central1/interconnectAttachments/attach-central-a state: PENDING_PARTNER type: PARTNER
記錄每個 VLAN 連結的
pairingKey
值。
向服務供應商要求建立連線
請與服務供應商聯絡,要求四個連線 (每個 VLAN 連結一個)。服務供應商必須取得每個連結的配對金鑰、容量和位置。
來自一個 Google Cloud 地區的連結必須連線至單一位置 (城市)。在此範例中,attach-central-a
和 attach-central-b
會連線至達拉斯,而 attach-east-a
和 attach-east-b
則連線至阿什本。
連結設定完成後,您會收到電子郵件通知,指出您已可以啟用連結。
啟用 VLAN 連結
在服務供應商設定您的 VLAN 連結後,您必須先將其啟用,那些連結才能開始傳輸流量。如果您已預先啟用連結,可以略過這個步驟。
主控台
在 Google Cloud 控制台中,前往「VLAN attachments」(VLAN 連結) 分頁。
選取
attach-central-a
VLAN 連結以查看其詳細資料頁面。如果您的連結狀態為
Waiting for service provider
,請等候服務供應商完成 VLAN 設定。查看互連網路資訊,檢查預期的服務供應商是否已設定了 VLAN 連結。
按一下「啟用」,啟用附件。
返回「VLAN attachments」分頁,然後啟用其他連結。
gcloud
描述每個 VLAN 連結,以確認服務供應商是否已完成設定連結:
gcloud compute interconnects attachments describe attach-central-a \ --region us-central1 \ --format '(name,state,partnerMetadata)'
gcloud compute interconnects attachments describe attach-central-b \ --region us-central1 \ --format '(name,state,partnerMetadata)'
gcloud compute interconnects attachments describe attach-east-a \ --region us-east4 \ --format '(name,state,partnerMetadata)'
gcloud compute interconnects attachments describe attach-east-b \ --region us-east4 \ --format '(name,state,partnerMetadata)'
在服務供應商設定您的 VLAN 連結後,您的連結狀態將從
PENDING_PARTNER
變更為PENDING_CUSTOMER
。如果狀態仍為PENDING_PARTNER
,請等候服務供應商完成 VLAN 設定。檢查
partnerMetadata
欄位,確認每個 VLAN 連結是否由正確的服務供應商設定。如果非預期的第三方設定了您的 VLAN 連結,請刪除該連結,然後建立新的連結,如此便能產生新的配對金鑰。請使用新的配對金鑰向您的服務供應商要求建立另一個連線。
如果 VLAN 連結已由正確的服務供應商設定,請使用
--admin-enabled
標記將其啟用:gcloud compute interconnects attachments partner update attach-central-a \ --region us-central1 \ --admin-enabled
gcloud compute interconnects attachments partner update attach-central-b \ --region us-central1 \ --admin-enabled
gcloud compute interconnects attachments partner update attach-east-a \ --region us-east4 \ --admin-enabled
gcloud compute interconnects attachments partner update attach-east-b \ --region us-east4 \ --admin-enabled
設定路由器
Google 會自動在每個雲端路由器上新增 BGP 對等點。對於第 2 層連線,您必須將內部部署 ASN 新增至每個 BGP 對等點。對於第 3 層連線,您不需進行任何操作,Google 會自動使用您服務供應商的 ASN 設定您的 Cloud Router。
主控台
在 Google Cloud 控制台中,前往「VLAN attachments」(VLAN 連結) 分頁。
選取
attach-central-a
VLAN 連結以查看其詳細資料頁面。按一下「Configure BGP」,即可設定與這個 VLAN 連結相關聯的 Cloud Router。
在「對等 ASN」欄位中,新增您的內部部署路由器的 ASN。
按一下 [儲存並繼續]。
返回「VLAN attachments」分頁,然後將內部部署 ASN 新增至其他 Cloud Router。
gcloud
描述與
attach-central-a
VLAN 連結相關聯的 Cloud Router。在輸出內容中,找出與您 VLAN 連結相關聯的自動建立 BGP 對等點名稱。BGP 對等點的ipAddress
和peerIpAddress
值必須與連結的cloudRouterIpAddress
和customerRouterIpAddress
值相符。gcloud compute routers describe router-central1 \ --region us-central1
bgp: advertiseMode: DEFAULT asn: 16550 bgpPeers: — interfaceName: auto-ia-if-attachment-central-a-c2c53a710bd6c2e ipAddress: 169.254.67.201 managementType: MANAGED_BY_ATTACHMENT name: auto-ia-bgp-attachment-central-a-c2c53a710bd6c2e peerIpAddress: 169.254.67.202 creationTimestamp: '2018-01-25T07:14:43.068-08:00' description: 'test' id: '4370996577373014668' interfaces: — ipRange: 169.254.67.201/29 linkedInterconnectAttachment: https://www.googleapis.com/compute/alpha/projects/customer-project/regions/us-central1/interconnectAttachments/customer-attachment1-partner managementType: MANAGED_BY_ATTACHMENT name: auto-ia-if-attachment-central-a-c2c53a710bd6c2e kind: compute#router name: partner network: https://www.googleapis.com/compute/v1/projects/customer-project/global/networks/vpc1 region: https://www.googleapis.com/compute/v1/projects/customer-project/regions/us-central1 selfLink: https://www.googleapis.com/compute/v1/projects/customer-project/regions/us-central1/routers/router-central1
使用內部部署路由器的 ASN 更新 BGP 對等點:
gcloud compute routers update-bgp-peer router-central1 \ --peer-name auto-ia-bgp-attachment-central-a-c2c53a710bd6c2e \ --peer-asn ON_PREM_ASN \ --region us-central1
建立 BGP 工作階段後,您就可以透過服務供應商的網路,在您的虛擬私有雲網路和內部部署網路之間傳輸流量。
後續步驟
如要進一步瞭解這些步驟,請參閱合作夥伴互連網路佈建總覽。
如要取得非必要應用程式的相關資訊,請參閱「為合作夥伴互連網路建立 99.9% 的可用性」。
如要解決使用 Cloud Interconnect 時可能遇到的常見問題,請參閱疑難排解。