查看路由器 BGP 会话的状态或路由器所通告的路由等详细信息。
控制台
如需检查 BGP 会话的状态,请执行以下操作:
- 转到 Google Cloud Console 中的“Cloud Router”页面。
转到 Cloud Router 页面 - 查看 BGP 会话列。
- 带有对勾标记的绿色圆圈表示会话已建立。
- 带有英文感叹号的红色圆圈表示会话仍在建立过程中或已失败。将鼠标悬停在英文感叹号上可查看详细信息。如果会话仍在建立过程中,请稍等片刻,然后重新加载页面以验证会话是否已建立完成。如果会话失败,请查看日志以了解有关会话的信息。
- 转到 Google Cloud Console 中的“Cloud Router”页面。
如需查看路由器已通告的路由,请执行以下操作:
- 转到 Google Cloud Console 中的“Cloud Router”页面。
转到 Cloud Router 页面 - 点击路由器的名称以打开路由器详情页面。
- 在 BGP 会话下,点击要查看其通告的路由的 BGP 会话的名称。
- 在 BGP 会话详情页面上,查看通告的路由部分。
- 转到 Google Cloud Console 中的“Cloud Router”页面。
如需查看 Cloud Router 路由器在网络中获知的动态路由,请执行以下操作:
转到 Google Cloud Console 中的“Virtual Private Cloud (VPC) 路由”(Virtual Private Cloud (VPC) routes) 页面。
转到“VPC 路由”(VPC Routes) 页面选择动态。
gcloud
运行 get-status
命令并传递路由器的名称。该命令会返回路由器的状态和通告的路由。
gcloud compute --project PROJECT_ID routers get-status my-router \ --region asia-east1
PROJECT_ID
是包含您的 Cloud Router 路由器的项目。
kind: compute#routerStatusResponse Result: bestRoutes: — destRange: 10.0.1.0/24 kind: compute#route nextHopIp: 169.254.1.1 priority: 100 — destRange: 10.0.2.0/24 kind: compute#route nextHopIp: 169.254.1.1 priority: 100 bgpPeerStatus: — advertisedRoutes: — destRange: 10.21.0.0/16 kind: compute#route nextHopIp: 169.254.1.2 priority: 100 — destRange: 192.168.1.0/24 kind: compute#route nextHopIp: 169.254.1.2 priority: 100 ipAddress: 169.254.1.1 name: bgp-peer1 numLearnedRoutes: 0 peerIpAddress: 169.254.1.2 state: Established status: UP uptime: '10' network: https://www.googleapis.com/compute/v1/projects/<var>project-id</var>/global/networks/my-network
API
如需查看 Cloud Router 的状态和路由,请使用 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 路由器的名称