Updating the base advertised route priority

When Cloud Router advertises routes, it uses route metrics to set route priorities. Route metrics include the base advertised route priority and a region-to-region cost. The lower the metric, the more a route is preferred. For existing BGP sessions, you can update the base advertised route priority to tweak these route metrics. All routes for the BGP session use the same base advertised route priority.

With global dynamic routing, Cloud Router can advertise routes from regions other than its own. When it does, it adds a region-to-region cost that can range from 201 to 9,999, affecting how routes are prioritized. To account for these region-to-region costs, use the following guidelines when setting base advertised route priorities:

  • To adjust priorities between routes in a single region, use values less than 201. This guarantees that region-to-region costs don't impact route priorities. A route from another region (a remote region) can't have a priority lower than 201. If you use higher values, region-to-region costs might impact your route priorities.

    For example, suppose you have a primary and a backup connection. If you set the backup connection's base advertised route priority too high, you might unintentionally prefer routes from other regions.

  • To deprioritize a route globally in a Virtual Private Cloud (VPC) network, use values higher than 10,200. This ensures that all other routes lower than 201 have priority regardless of region-to-region costs.

In cases where all routes in a region are equally preferred, you can use the default value of 100. For more information about region-to-region costs and examples, see Advertised prefixes and priorities.

To update the base advertised route priority for an existing BGP session, follow these steps.

Console

For Cloud VPN tunnels that use dynamic routing, including HA VPN tunnels, complete the following steps:

  1. In the Google Cloud Console, go to the Cloud VPN tunnels page.

    Go to Cloud VPN tunnels

  2. From the list of tunnels in the Name column, select the tunnel that you want to modify.

  3. On the Cloud VPN tunnel details page, select Modify BGP session.

  4. Modify the Advertised route priority value.

  5. Click Save and continue.

For Dedicated Interconnect or Partner Interconnect, complete the following steps:

  1. In the Cloud Console, go to the VLAN attachments tab on the Cloud Interconnect page.

    Go to Cloud Interconnect

  2. From the list of attachments in the Name column, select the attachment that you want to modify.

  3. On the VLAN attachment details page, select the name of the BGP session.

  4. Modify the Advertised route priority value.

  5. Click Save and continue.

gcloud

Run the update-bgp-peer command using the --advertised-route-priority flag. Specify the name of the Cloud Router and BGP session that correspond to the appropriate Cloud VPN tunnel or VLAN attachment.

gcloud compute routers update-bgp-peer ROUTER_NAME \
    --peer-name=NAME_OF_BGP_SESSION \
    --advertised-route-priority=BASE_PRIORITY_VALUE

API

Use the routers.patch method to update the bgpPeers[] field.

The bgpPeers[] field accepts an array of BGP peers. When you PATCH this field, you overwrite the existing array of BGP peers with the new array included in your request.

  1. Send a GET request to get the current array of BGP peers for the router. For details, see Viewing BGP session configuration.

  2. Send a PATCH request with a new array of BGP peers. In the array element that contains the BGP session that you want to update, modify the value of advertisedRoutePriority.

    PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME
    {
      "bgpPeers": [
        BGP_PEERS
      ]
    }
    

    Replace the following:

    • PROJECT_ID: the project that contains the Cloud Router
    • REGION: the region where the Cloud Router is located
    • ROUTER_NAME: the name of the Cloud Router
    • BGP_PEERS: the contents of the new array of BGP peers

    The following example includes one BGP peer with the default advertisedRoutePriority of 100 and another with an updated value of 99:

        {
          "name": "peer-1",
          "interfaceName": "if-peer-1",
          "ipAddress": "169.254.10.1",
          "peerIpAddress": "169.254.10.2",
          "peerAsn": 64512,
          "advertisedRoutePriority": 100,
          "advertiseMode": "DEFAULT"
        },
        {
          "name": "peer-2",
          "interfaceName": "if-peer-2",
          "ipAddress": "169.254.20.1",
          "peerIpAddress": "169.254.20.2",
          "peerAsn": 64513,
          "advertisedRoutePriority": 99,
          "advertiseMode": "DEFAULT"
        }
    

What's next?