List BGP route policies

This page describes how to list Border Gateway Protocol (BGP) route policies on Cloud Router, which can help you troubleshoot your BGP route policies.

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 the Google Cloud CLI.
  2. Set a default region and zone.

API

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

List BGP route policies

Console

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

    Go to Cloud Router

  2. On the Cloud Router page, click the BGP Route Policies tab.

  3. To view the BGP route policy terms for a BGP route policy, click the BGP route policy name.

gcloud

Use the gcloud compute routers list-route-policies command:

gcloud compute routers list-route-policies ROUTER_NAME \
 --region=REGION

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router

  • REGION: the region in which your Cloud Router is located

The output is similar to the following:

NAME: test-policy-1
TYPE: ROUTE_POLICY_TYPE_EXPORT
NAME: test-policy-2
TYPE: ROUTE_POLICY_TYPE_IMPORT

API

Use the routers.listRoutePolicies method:

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

Replace the following:

  • PROJECT_ID: the project that contains your Cloud Router

  • REGION: the region in which your Cloud Router is located

  • ROUTER_NAME: the name of your Cloud Router

The output is similar to the following:

{
 "kind": "compute#routersListRoutePolicies",
 "result": [
 {
 "name": "ROUTER_NAME",
 "type": "ROUTE_POLICY_TYPE_IMPORT",
 "terms": [
 {
 "priority": 1,
 "match": {
 "expression": "destination != \"192.168.10.0/24\" && communities.matchesEvery([\"65000:1\", \"65000:2\"])"
 },
 "actions": [
 {
 "expression": "med.set(12345)"
 }
 ]
 },
 {
 "priority": 2,
 "match": {
 "expression": "destination != \"192.168.10.0/24\""
 },
 "actions": [
 {
 "expression": "med.set(12345)"
 }
 ]
 }
 ],
 "fingerprint": "ulgdg-dGCms="
 }
 ]
}

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

Last updated 2025年10月24日 UTC.