Update the base route priority

When you configure a Border Gateway Protocol (BGP) session on a Cloud Router, you can specify a base advertised priority for the BGP session. The base advertised priority applies to all prefixes (destinations) advertised by that BGP session.

Base priorities are whole numbers from 0 to 65535. The highest possible base priority is 0. The default base priority is 100. If you don't specify a base priority, the default priority is used.

Base priorities let you specify which Cloud VPN tunnels or VLAN attachments on-premises systems use to send packets to your VPC network. You can create active-active, active-passive, or a custom combination of these topologies by using the base priority. For an example using HA VPN tunnels, see Active-active and active-passive routing options for HA VPN in the Cloud VPN documentation.

When choosing base priorities, keep the following in mind:

  • Region-to-region costs are between 201 and 9999, inclusive. The value depends on the distance, latency, and other factors between two regions. Google generates the region-to-region cost values, and you can't modify them.

  • Base priorities among Cloud Routers in a region are recommended to be between 0 and 200, inclusive. Because region-to-region costs are at least 201, if you use base priorities of 201 or more, you might accidentally assign a Cloud VPN tunnel or VLAN attachment a lower priority than you intend. Another BGP session in a different region might advertise the same prefix with an overall higher priority (MED, which equals base priority plus region-to-region cost). Without carefully setting base priorities in other regions, you might cause on-premises traffic to be delivered to your VPC network by way of an unexpected Cloud VPN tunnel or VLAN attachment.

  • Base priorities of 10200 or more ensure that a prefix's overall advertised priority (MED, base priority plus region-to-region cost) is always lower than any other advertised prefix with a base priority of 200 or less.

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


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


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 \


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 View 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": [

    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": "",
          "peerIpAddress": "",
          "peerAsn": 64512,
          "advertisedRoutePriority": 100,
          "advertiseMode": "DEFAULT"
          "name": "peer-2",
          "interfaceName": "if-peer-2",
          "ipAddress": "",
          "peerIpAddress": "",
          "peerAsn": 64513,
          "advertisedRoutePriority": 99,
          "advertiseMode": "DEFAULT"

What's next?