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. Before you begin, ensure that you are familiar with the Cloud Router Advertised routes overview. For more information about how Cloud Router uses the base advertised priority, see Advertised priority.
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 Cloud Interconnect VLAN attachments on-premises systems to 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 to influence how packets are sent to your VPC network. 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
and9999
, 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
and200
, inclusive. Because region-to-region costs are at least201
, if you use base priorities of201
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 help 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 of200
or less.
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:
In the Google Cloud console, go to the Cloud VPN tunnels page.
From the list of tunnels in the Name column, select the tunnel that you want to modify.
On the Cloud VPN tunnel details page, select Modify BGP session.
Modify the Advertised route priority value.
Click Save and continue.
For Dedicated Interconnect or Partner Interconnect, complete the following steps:
In the Google Cloud console, go to the VLAN attachments tab on the Cloud Interconnect page.
From the list of attachments in the Name column, select the attachment that you want to modify.
On the VLAN attachment details page, select the name of the BGP session.
Modify the Advertised route priority value.
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.
Send a
GET
request to get the current array of BGP peers for the router. For details, see View BGP session configuration.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 ofadvertisedRoutePriority
.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 RouterREGION
: the region where the Cloud Router is locatedROUTER_NAME
: the name of the Cloud RouterBGP_PEERS
: the contents of the new array of BGP peers
The following example includes one BGP peer with the default
advertisedRoutePriority
of100
and another with an updated value of99
:{ "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?
To view the base advertised route priority, see View Cloud Router details.
To troubleshoot issues when using Cloud Router, see Troubleshooting.