View details such as the status of a router's BGP sessions or the routes that the router is advertising.
Console
To check the status of a BGP session:
- Go to the Cloud Router page in the Google Cloud Console.
Go to the Cloud Router page - View the BGP sessions column.
- A green circle with a checkmark indicates the session is established.
- A red circle with an exclamation mark indicates that the session is still coming up or has already failed. Hover over the exclamation mark for more information. If the session is still coming up, wait a few moments, and then reload the page to verify that the session has been established. If the session failed, view the logs to see information about the session.
- Go to the Cloud Router page in the Google Cloud Console.
To see the routes that your router has advertised:
- Go to the Cloud Router page in the Google Cloud Console.
Go to the Cloud Router page - Click the name of your router to open the Router details page.
- Under BGP sessions, click the name of the BGP session for which you want to see advertised routes.
- On the BGP session details page, see the Advertised routes section.
- Go to the Cloud Router page in the Google Cloud Console.
To see the dynamic routes that your Cloud Router has learned in the network:
Go to the Virtual Private Cloud (VPC) routes page in the Google Cloud Console.
Go to the VPC Routes pageSelect Dynamic.
gcloud
Run the get-status
command and pass the name of the router. The command
returns the router's status and advertised routes.
gcloud compute --project PROJECT_ID routers get-status my-router \ --region asia-east1
PROJECT_ID
is the project that contains your 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
To view a Cloud Router's status and routes, use the
routers.getRouterStatus
method.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/getRouterStatus
Replace the following values:
PROJECT_ID
: the project that contains the Cloud RouterREGION
: the region where the Cloud Router is locatedROUTER_NAME
: the name of the Cloud Router