查看路由器詳細資料

本頁面說明如何查看下列 Cloud Router 詳細資料:

BGP 工作階段的所有路徑都使用相同的通告路徑基本優先順序。詳情請參閱「宣傳優先順序」。

如要進一步瞭解疑難排解程序,請參閱以下資源:

事前準備

gcloud

如要使用本指南中的指令列範例,請完成下列事項:

  1. 安裝或更新至最新版 Google Cloud CLI
  2. 設定預設地區和區域

API

如要使用本指南提供的 API 範例,請設定 API 存取權

查看 Cloud Router 狀態和路徑

如要查看 Cloud Router 狀態和路徑,請按照下列步驟操作:

主控台

檢查 BGP 工作階段的狀態

  1. 前往 Google Cloud 控制台的「Cloud Routers」頁面。

    前往 Cloud Router

  2. 查看「BGP 工作階段」欄。

    • 內有勾號的綠色圓圈表示已建立工作階段。
    • 內有驚嘆號的紅圈代表工作階段仍在建立中或已失敗。

    如要瞭解詳情,請將游標懸停在驚嘆號上。如果工作階段仍在建立中,請稍待片刻再重新載入頁面,以確認工作階段是否已建立。如果工作階段失敗,請查看記錄檔,瞭解該工作階段的相關資訊。詳情請參閱「查看記錄和指標」。

查看路由器通告的路徑

  1. 前往 Google Cloud 控制台的「Cloud Routers」頁面。

    前往 Cloud Router

  2. 按一下路由器名稱,開啟「路由器詳細資料」頁面。

  3. 在「BGP 工作階段」下方,按一下要查看廣告路由的 BGP 工作階段名稱。

  4. 在「BGP 工作階段詳細資料」頁面中,查看「公告路徑」部分。

查看 Cloud Router 在網路中取得的動態路徑

  1. 在 Google Cloud 控制台中,前往「VPC 路由」頁面。

    前往「VPC Routes」(虛擬私有雲路徑)

  2. 選取「動態」

決定 BGP 對等點保持運作間隔設定

  1. 前往 Google Cloud 控制台的「Cloud Routers」頁面。

    前往 Cloud Router

  2. 按一下要查看資訊的路由器。

  3. 在「路由器詳細資料」頁面中的「BGP 對等點保活間隔」下方查看設定。

查看 BFD 工作階段的狀態

  1. 前往 Google Cloud 控制台的「Cloud Routers」頁面。

    前往 Cloud Router

  2. 按一下要查看資訊的路由器。

  3. 在「路由器詳細資料」頁面中的「BGP 工作階段」下方,您可以判斷是否已啟用 BFD,以及設定了哪種 BFD 工作階段初始化模式。

gcloud

  1. 執行 get-status 指令並傳遞路由器的名稱。這個指令會傳回路由器的狀態、通告路徑和已知路徑。

    gcloud compute routers get-status ROUTER_NAME \
       --project=PROJECT_ID \
       --region=REGION
    

    更改下列內容:

    • ROUTER_NAME:Cloud Router 的名稱
    • PROJECT_ID:包含 Cloud Router 的專案
    • REGION:包含 Cloud Router 的地區
  2. 輸出結果會與下列內容相似:

    kind: compute#routerStatusResponse
    result:
      bestRoutes:
      — creationTimestamp: '2019-04-17T07:16:12.789-07:00'
        destRange: 192.168.1.0/24
        kind: compute#route
        nextHopIp: 169.254.0.2
        priority: 100
      — creationTimestamp: '2019-04-17T07:16:12.789-07:00'
        destRange: 192.168.2.0/24
        kind: compute#route
        nextHopIp: 169.254.0.2
        priority: 338
      bestRoutesForRouter:
      — creationTimestamp: '2019-04-17T07:15:42.012-07:00'
        destRange: 192.168.1.0/24
        kind: compute#route
        nextHopIp: 169.254.0.2
        priority: 100
      — creationTimestamp: '2019-04-17T07:15:42.014-07:00'
        destRange: 192.168.2.0/24
        kind: compute#route
        nextHopIp: 169.254.0.2
        priority: 338
      bgpPeerStatus:
      — advertisedRoutes:
        — destRange: 10.0.1.0/24
          kind: compute#route
          nextHopIp: 169.254.0.1
          priority: 100
        — destRange: 10.0.2.0/24
          kind: compute#route
          nextHopIp: 169.254.0.1
          priority: 340
      bfdStatus:
       bfdSessionInitializationMode: ACTIVE
          configUpdateTimestampMicros: '1615561369012381'
          controlPacketCounts:
            numRx: 64014
            numRxRejected: 0
            numRxSuccessful: 64014
            numTx: 63994
          controlPacketIntervals:
          — avgMs: '263'
            duration: MINUTE
            maxMs: '299'
            minMs: '225'
            numIntervals: '227'
            type: TRANSMIT
          — avgMs: '262'
            duration: MAX
            maxMs: '4467'
            minMs: '0'
            numIntervals: '63993'
            type: TRANSMIT
          — avgMs: '261'
            duration: MINUTE
            maxMs: '1000'
            minMs: '176'
            numIntervals: '228'
            type: RECEIVE
          localDiagnostic: NO_DIAGNOSTIC
          localState: UP
          negotiatedLocalControlTxIntervalMs: 1000
          rxPacket:
            authenticationPresent: false
            controlPlaneIndependent: false
            demand: false
            diagnostic: NO_DIAGNOSTIC
            final: false
            length: 24
            minEchoRxIntervalMs: 0
            minRxIntervalMs: 1000
            minTxIntervalMs: 1000
            multiplier: 5
            multipoint: false
            myDiscriminator: 313496190
            poll: false
            state: UP
            version: 1
            yourDiscriminator: 369987665
          txPacket:
            authenticationPresent: false
            controlPlaneIndependent: false
            demand: false
            diagnostic: NO_DIAGNOSTIC
            final: false
            length: 24
            minEchoRxIntervalMs: 0
            minRxIntervalMs: 1000
            minTxIntervalMs: 1000
            multiplier: 5
            multipoint: false
            myDiscriminator: 369987665
            poll: false
            state: UP
            version: 1
            yourDiscriminator: 313496190
          uptimeMs: '16812601'
      enableIpv6: true
      ipAddress: 169.254.0.1
      ipv6NexthopAddress: 2600:2d00:0:0:0:0:1:5
      linkedVpnTunnel: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/us-central1/vpnTunnels/vpn-1-tunnel-1
      name: mysession2
      numLearnedRoutes: 2
      peerIpAddress: 169.254.0.2
      peerIpv6NexthopAddress: 2600:2d00:0:0:0:0:1:4
      state: Established
      status: UP
      uptime: 2 days, 3 hours, 37 minutes, 0 seconds
      uptimeSeconds: '185820'
    network: https://www.googleapis.com/compute/kind: compute#routerStatusResponse
    

    result.bestRoutes 會列出這個 Cloud Router 的 VPC 網路在與這個 Cloud Router 相同區域中的最佳動態路徑。這份清單包含每個前置字串的最佳路徑,這些路徑已編入這個區域的 VPC 資料平面。在 VPC 網路中啟用全球動態轉送模式後,這份清單可能會包含其他區域 Cloud Router 的跨區域動態路徑。

    result.bestRoutesForRouter 會列出此 Cloud Router 取得的最佳 BGP 路徑。如果 Google Cloud 控制層發現前置字詞的最佳路徑,而非由這個 Cloud Router 學習到的路徑,則列出的路徑可能不會編程至資料層。

API

請使用 routers.getRouterStatus 方法:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/getRouterStatus

更改下列內容:

  • PROJECT_ID:包含 Cloud Router 的專案
  • REGION:Cloud Router 所在的區域
  • ROUTER_NAME:Cloud Router 的名稱

查看 BGP 工作階段設定

如要查看現有 BGP 工作階段的設定,請按照下列步驟操作。

主控台

  1. 前往 Google Cloud 控制台的「Cloud Routers」頁面。

    前往 Cloud Router

  2. 在路由器清單中,根據您要查看的 BGP 工作階段,選取相關的路由器。

  3. 查看「BGP 工作階段」區段,瞭解 Cloud Router BGP 工作階段的詳細資料。

gcloud

  1. 執行 describe 指令並傳遞 Cloud Router 的名稱。

    gcloud compute routers describe ROUTER_NAME \
      --project PROJECT_ID \
      --region REGION
    

    更改下列內容:

    • ROUTER_NAME:Cloud Router 的名稱
    • PROJECT_ID:包含 Cloud Router 的專案
    • REGION:Cloud Router 所在的區域
  2. 在輸出內容中,查看 bgpPeers 區段:

      bgp:
        advertiseMode: DEFAULT
        asn: 65001
        keepaliveInterval: 120
      bgpPeers:
      — advertiseMode: DEFAULT
        bfd:
         minReceiveInterval: 1000
         minTransmitInterval: 1000
         mode: ACTIVE
         multiplier: 5
        enable: 'TRUE'
        enableIpv6: true
        interfaceName: if-mysession2
        ipAddress: 169.254.0.1
        ipv6NexthopAddress: 2600:2d00:0:0:0:0:1:5
        name: mysession2
        peerAsn: 65002
        peerIpAddress: 169.254.0.2
        peerIpv6NexthopAddress: 2600:2d00:0:0:0:0:1:6
      creationTimestamp: '2019-03-15T13:48:12.433-07:00'
      description: ''
      id: '1234567890123456789'
      interfaces:
      — ipRange: 169.254.0.1/30
      linkedVpnTunnel: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/us-central1/vpnTunnels/vpn-1-tunnel-1
      name: if-mysession2
      kind: compute#router
      name: ROUTER_NAME
      network: https://www.googleapis.com/compute/projects/PROJECT_ID/global/networks/network-a
      region: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/us-central1
      selfLink: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/us-central1/routers/ROUTER_NAME
      selfLinkWithId: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/us-central1/routers/7114728016518951267
    

API

請使用 routers.get 方法:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME

更改下列內容:

  • PROJECT_ID:包含 Cloud Router 的專案
  • REGION:Cloud Router 所在的區域
  • ROUTER_NAME:Cloud Router 的名稱

輸出結果中的 bgpPeers[] 欄位包含每個 BGP 工作階段的設定。

後續步驟