Revert to default advertisement mode
If you no longer need to advertise certain subnets or custom IP ranges, you can revert back to default advertisement mode.
By default, the Cloud Router advertises all available subnets, including new ones. For BGP sessions, the default behavior is to inherit the Cloud Router's behavior.
Before you begin
gcloud
If you want to use the command-line examples in this guide, do the following:
- Install or update to the latest version of the Google Cloud CLI.
- Set a default region and zone.
API
If you want to use the API examples in this guide, set up API access.
Revert to default advertisement mode on a Cloud Router
To revert to default advertisement mode on a Cloud Router, follow these steps.
Console
In the Google Cloud console, go to the Cloud Routers page.
Select the Cloud Router to update.
On the Router details page, click
Edit.In the Advertised routes section, for Routes, select Advertise all subnets visible to the Cloud Router (Default).
Click Save to revert to default advertisement mode.
gcloud
Run the update
command. Use the --advertisement-mode
flag to
change the advertisement mode to default
, as shown in the following
example:
gcloud compute routers update my-router \ --advertisement-mode default
API
Use the
routers.patch
method to set bgp.advertiseMode
to DEFAULT
and clear the custom advertisement mode
configuration:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME { "bgp": { "advertiseMode": "DEFAULT", "advertisedGroups": [], "advertisedIpRanges": [] } }
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 Router
Revert to default advertisement mode on a BGP session
To revert to default advertisement mode on a BGP session, follow these steps.
Console
In the Google Cloud console, go to the Cloud Routers page.
Select the Cloud Router that contains the BGP session to update.
On the Router details page, select the BGP session to update.
On the BGP session details page, click
Edit.For Routes, select Advertise all subnets visible to the Cloud Router (Default).
Click Save to revert to default advertisement mode.
gcloud
Run the update-bgp-peer
command. Use the --advertisement-mode
flag
to change the advertisement mode to default
, as shown in the following
example:
gcloud compute routers update-bgp-peer my-router \ --peer-name my-bgp-session \ --advertisement-mode default
API
For one or more BGP sessions, 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. For each BGP peer that you want to revert to default advertisement mode, do the following:- Set
advertisedMode
toDEFAULT
- Set
advertisedGroup[]
andadvertisedIpRanges[]
to[]
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 reverts two BGP sessions to default advertisement mode:
{ "name": "peer-1", "interfaceName": "if-peer-1", "ipAddress": "169.254.10.1", "peerIpAddress": "169.254.10.2", "peerAsn": 64512, "advertisedRoutePriority": 100, "advertiseMode": "DEFAULT", "advertisedGroups": [], "advertisedIpRanges": [] }, { "name": "peer-2", "interfaceName": "if-peer-2", "ipAddress": "169.254.20.1", "peerIpAddress": "169.254.20.2", "peerAsn": 64513, "advertisedRoutePriority": 100, "advertiseMode": "DEFAULT", "advertisedGroups": [], "advertisedIpRanges": [] }
- Set
What's next
To view the configuration of a Cloud Router, its BGP sessions, and the routes that Cloud Router is advertising, see View Cloud Router details.
To troubleshoot issues with custom advertised routes, see Troubleshooting.