List BGP routes

This page describes how to list advertised routes and learned routes onindividualBorder Gateway Protocol (BGP) sessions, which can help youtroubleshoot your Cloud Router routes. You can list routes either before orafterBGP route policiesare applied to a route. To troubleshoot advertised and learned routes, werecommend completing the following sections in order.

Before you begin

gcloud

If you want to use the command-line examples in this guide, do the following:

  1. Install or update to the latest version of theGoogle Cloud CLI.
  2. Set adefault region andzone.

API

If you want to use the API examples in this guide, set upAPI access.

List BGP routes before policies are applied

Console

Do the following:

  1. In the Google Cloud console, go to theCloud Router page.

    Go to Cloud Router

  2. On theCloud Router page, click theBGP sessions tab.

  3. Select the BGP session peer that you want to list. The BGP sessiondetails page is displayed. Advertised routes are listed in theAdvertised routes section.

gcloud

Use thegcloud compute routers list-bgp-routes command:

gcloud compute routers list-bgp-routesROUTER_NAME \    --address-family=ADDRESS_FAMILY \    --no-policy-applied \    --peer=PEER_NAME \    --region=REGION \    --route-direction=ROUTE_DIRECTION

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router

  • ADDRESS_FAMILY: the IP address family to displayroutes for:

    • IPV4: for IPv4-based BGP addresses
    • IPV6: for IPv6-based BGP addresses
  • PEER_NAME: the name of the BGP peer

  • REGION: the region in which your Cloud Router islocated

  • ROUTE_DIRECTION: the direction to display routesfor:

    • INBOUND: routes learned from the BGP peer
    • OUTBOUND: routes advertised to the BGP peer

The output is similar to the following:

---asPaths:- asns:  - 64515  type: AS_PATH_TYPE_SEQUENCEdestination:  prefix: 192.168.1.0/24med: 100origin: BGP_ORIGIN_INCOMPLETE---asPaths:- asns:  - 64515  type: AS_PATH_TYPE_SEQUENCEdestination:  prefix: 192.168.2.0/24med: 333origin: BGP_ORIGIN_INCOMPLETE

API

Use therouters.listBgpRoutesmethod:

GET https://compute.googleapis.com/compute/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/listBgpRoutes{  "addressFamily": "ADDRESS_FAMILY",  "peer": "PEER_NAME",  "policyApplied": FALSE,  "routeType": "ROUTE_TYPE"}

Replace the following:

  • PROJECT_ID: the project that contains yourCloud Router

  • REGION: the region in which your Cloud Router islocated

  • ROUTER_NAME: the name of your Cloud Router

  • ADDRESS_FAMILY: the IP address family to displayroutes for:

    • IPV4: for IPv4-based BGP addresses
    • IPV6: for IPv6-based BGP addresses
  • PEER_NAME: the name of the BGP peer

  • ROUTE_TYPE: the type of route to display:

    • LEARNED: route learned from the BGP peer
    • ADVERTISED: route advertised to the BGP peer

The output is similar to the following:

{  "kind": "compute#routersListBgpRoutes",  "result": [    {      "destination": {        "prefix": "10.0.1.0/24"      },      "med": 100    },    {      "destination": {        "prefix": "10.0.2.0/24"      },      "med": 338    }  ]}

List BGP routes after policies are applied

Console

  1. In the Google Cloud console, go to theCloud Router page.

    Go to Cloud Router

  2. On theCloud Router page, click theBGP sessions tab.

  3. Select the BGP session peer that you want to list. The BGP sessiondetails page is displayed. Advertised routes are listed in theAdvertised routes section.

gcloud

Use thegcloud compute routers list-bgp-routes command:

gcloud compute routers list-bgp-routesROUTER_NAME \    --address-family=ADDRESS_FAMILY \    --policy-applied \    --peer=PEER_NAME \    --region=REGION \    --route-direction=ROUTE_DIRECTION

Replace the following:

  • ADDRESS_FAMILY: the IP address family to displayroutes for:

    • IPV4: for IPv4-based BGP addresses
    • IPV6: for IPv6-based BGP addresses
  • PEER_NAME: the name of the BGP peer

  • ROUTE_DIRECTION: the direction to display routesfor:

    • INBOUND: routes learned from the BGP peer
    • OUTBOUND: routes advertised to the BGP peer

The output is similar to the following:

---asPaths:- asns:- 64515type: AS_PATH_TYPE_SEQUENCEcommunities:- 65535:65281destination:prefix: 192.168.1.0/24med: 100origin: BGP_ORIGIN_INCOMPLETE---asPaths:- asns:- 64515type: AS_PATH_TYPE_SEQUENCEcommunities:- 65535:65281destination:prefix: 192.168.2.0/24med: 333origin: BGP_ORIGIN_INCOMPLETE

API

Use therouters.listBgpRoutesmethod:

GET https://compute.googleapis.com/compute/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/listBgpRoutes{"addressFamily": "ADDRESS_FAMILY","peer": "PEER_NAME","policyApplied": TRUE,"routeType": "ROUTE_TYPE"}

Replace the following:

  • PROJECT_ID: the project that contains yourCloud Router

  • REGION: the region in which your Cloud Router islocated

  • ROUTER_NAME: the name of your Cloud Router

  • ADDRESS_FAMILY: the IP address family to displayroutes for:

    • IPV4: for IPv4-based BGP addresses
    • IPV6: for IPv6-based BGP addresses
  • PEER_NAME: the name of the BGP peer

  • ROUTE_TYPE: the type of route to display:

    • LEARNED: route learned from the BGP peer
    • ADVERTISED: route advertised to the BGP peer

The output is similar to the following:

{  "kind": "compute#routersListBgpRoutes",  "result": [    {      "destination": {        "prefix": "10.0.1.0/24"      },      "asPaths": [        {          "type": "AS_PATH_TYPE_SEQUENCE",          "asns": [            64514          ]        }      ],      "origin": "BGP_ORIGIN_INCOMPLETE",      "med": 100    },    {      "destination": {        "prefix": "10.0.2.0/24"      },      "asPaths": [        {          "type": "AS_PATH_TYPE_SEQUENCE",          "asns": [            64514          ]        }      ],      "origin": "BGP_ORIGIN_INCOMPLETE",      "med": 338    }  ]}

Check the best dynamic routes

Check the best dynamic routes per Cloud Router and per region perVPC:

gcloud

Use thegcloud compute routers get-statuscommand:

gcloud compute routers get-statusROUTER_NAME \    --region=REGION

The output includes the following information:

  • bestRoutesForRouter: represents the best routes for a specificCloud Router
  • bestRoutes: represents the best routes per region of aCloud Router of that VPC.

The output is similar to the following forbestRoutesForRouter:

  bestRoutesForRouter:  - asPaths:    - asLists:      - 65002      pathSegmentType: AS_SEQUENCE    creationTimestamp: '2024-09-26T18:28:54.346-07:00'    destRange: 192.168.1.0/24    kind: compute#route    network: https://www.googleapis.com/compute/projects/PROJECT_ID/global/networks/NETWORK_NAME    nextHopIp: 169.254.0.2    nextHopOrigin: INCOMPLETE    nextHopVpnTunnel: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/REGION/vpnTunnels/vpc-demo-tunnel0    priority: 100    routeStatus: ACTIVE    routeType: BGP  - asPaths:    - asLists:      - 65002      pathSegmentType: AS_SEQUENCE    creationTimestamp: '2024-09-27T12:44:56.575-07:00'    destRange: 192.168.1.0/24    kind: compute#route    network: https://www.googleapis.com/compute/projects/PROJECT_ID/global/networks/NETWORK_NAME    nextHopIp: 169.254.1.2    nextHopOrigin: INCOMPLETE    nextHopVpnTunnel: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/REGION/vpnTunnels/vpc-demo-tunnel1    priority: 100    routeStatus: ACTIVE    routeType: BGP

The output is similar to the following forbestRoutes:

  bestRoutes:  - asPaths:    - asLists:      - 65002      pathSegmentType: AS_SEQUENCE    creationTimestamp: '2024-09-26T18:33:50.505-07:00'    destRange: 192.168.1.0/24    kind: compute#route    network: https://www.googleapis.com/compute/projects/PROJECT_ID/global/networks/NETWORK_NAME    nextHopIp: 169.254.0.2    nextHopOrigin: INCOMPLETE    nextHopVpnTunnel: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/REGION/vpnTunnels/vpc-demo-tunnel0    priority: 100    routeType: BGP  - asPaths:    - asLists:      - 65002      pathSegmentType: AS_SEQUENCE    creationTimestamp: '2024-09-27T12:46:49.028-07:00'    destRange: 192.168.1.0/24    kind: compute#route    network: https://www.googleapis.com/compute/projects/PROJECT_ID/global/networks/NETWORK_NAME    nextHopIp: 169.254.1.2    nextHopOrigin: INCOMPLETE    nextHopVpnTunnel: https://www.googleapis.com/compute/projects/PROJECT_ID/regions/REGION/vpnTunnels/vpc-demo-tunnel1    priority: 100    routeType: BGP

The output includes the following values:

  • PROJECT_ID: the project that contains yourCloud Router

  • NETWORK_NAME: the name of the VPCnetwork

  • REGION: the name of the region

API

Use therouters.getRouterStatus method:

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

Replace the following:

  • PROJECT_ID: the project that contains yourCloud Router

  • REGION: the region in which your Cloud Router islocated

  • ROUTER_NAME: the name of your Cloud Router

The output includes the following information:

  • bestRoutes: represents the best routes per region of aCloud Router of that VPC.
  • bestRoutesForRouter: represents the best routes for a specificCloud Router

The output is similar to the following forbestRoutes:

    "bestRoutes": [      {        "kind": "compute#route",        "creationTimestamp": "2025-03-05T11:20:40.323-08:00",        "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME",        "destRange": "200.0.0.0/24",        "priority": 100,        "nextHopIp": "169.254.0.1",        "nextHopVpnTunnel": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/vpnTunnels/TUNNEL_NAME",        "routeType": "BGP",        "asPaths": [          {            "pathSegmentType": "AS_SEQUENCE",            "asLists": [              65001            ]          }        ],        "nextHopOrigin": "INCOMPLETE"      },

The output is similar to the following forbestRoutesForRouter:

    "bestRoutesForRouter": [      {        "kind": "compute#route",        "creationTimestamp": "2025-03-05T11:20:50.240-08:00",        "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME",        "destRange": "10.2.1.0/24",        "priority": 100,        "nextHopIp": "169.254.0.1",        "nextHopVpnTunnel": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/REGION/vpnTunnels/TUNNEL_NAME",        "routeType": "BGP",        "asPaths": [          {            "pathSegmentType": "AS_SEQUENCE",            "asLists": [              65001            ]          }        ],        "routeStatus": "ACTIVE",        "nextHopOrigin": "INCOMPLETE"      },      {        "kind": "compute#route",        "creationTimestamp": "2025-03-05T01:50:01.725-08:00",        "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/on-prem",        "destRange": "200.0.0.0/24",        "priority": 100,        "nextHopIp": "169.254.0.1",        "nextHopVpnTunnel": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/vpnTunnels/TUNNEL_NAME",        "routeType": "BGP",        "asPaths": [          {            "pathSegmentType": "AS_SEQUENCE",            "asLists": [              65001            ]          }        ],        "routeStatus": "ACTIVE",        "nextHopOrigin": "INCOMPLETE"      },      {        "kind": "compute#route",        "creationTimestamp": "2025-03-06T05:30:06.277-08:00",        "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/on-prem",        "destRange": "10.2.1.0/24",        "priority": 100,        "nextHopIp": "169.254.1.1",        "nextHopVpnTunnel": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/vpnTunnels/TUNNEL_NAME",        "routeType": "BGP",        "asPaths": [          {            "pathSegmentType": "AS_SEQUENCE",            "asLists": [              65001            ]          }        ],        "routeStatus": "ACTIVE",        "nextHopOrigin": "INCOMPLETE"      }    ],

The output includes the following values:

  • PROJECT_ID: the project that contains yourCloud Router

  • REGION: the region in which your Cloud Router islocated

  • ROUTER_NAME: the name of your Cloud Router

  • TUNNEL_NAME: if applicable, the name of your VPN tunnel

View the VPC forwarding plane route table

Do the following:

  1. In the Google Cloud console, go to theRoutes page.

    Go to Routes

  2. On theEffective routes tab, select the network you want to list routesfor.

  3. In theRegion list, select the region that you want to list routes in,and then clickView.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.