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 regional 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 regional cost that can range from 201 to 9,999, affecting how routes are prioritized. To account for these regional 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 regional costs won'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, regional 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 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 regional costs.

In cases where all routes in a region are equally preferred, you can use the default value of 100. For more information about regional costs and examples, see Route metrics.

To update the base advertised route priority for an existing BGP session:

Console

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

  1. Go to the Cloud VPN page in the Google Cloud Console.
    Go to the Cloud VPN tunnels page
  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 screen, 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. Go to the VLAN attachments tab on the Cloud Interconnect page in the Google Cloud Console.
    Go to the Cloud Interconnect page
  2. From the list of attachments in the Name column, select the attachment that you want to modify.
  3. On the VLAN attachment details screen, 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, specifying the name of the Cloud Router and BGP session that correspond to the appropriate Cloud VPN tunnel or VLAN attachment. Use the --advertised-route-priority flag to update the base advertised route priority.

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

API

To update the base advertised route priority for a BGP session, 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. See Viewing a Cloud Router configuration.

  2. Send a PATCH request with a new array of BGP peers. In the array element that contains the BGP session 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 values:

    • 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.

      See the following example, which 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?