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.

Revert to default advertisement mode on a Cloud Router

To revert to default advertisement mode on a Cloud Router, follow these steps.

Console

  1. In the Google Cloud console, go to the Cloud Routers page.

    Go to Cloud Routers

  2. Select the Cloud Router to update.

  3. On the Router details page, click Edit.

  4. In the Advertised routes section, for Routes, select Advertise all subnets visible to the Cloud Router (Default).

  5. 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 Router
  • REGION: the region where the Cloud Router is located
  • ROUTER_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

  1. In the Google Cloud console, go to the Cloud Routers page.

    Go to Cloud Routers

  2. Select the Cloud Router that contains the BGP session to update.

  3. On the Router details page, select the BGP session to update.

  4. On the BGP session details page, click Edit.

  5. For Routes, select Advertise all subnets visible to the Cloud Router (Default).

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

  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. For each BGP peer that you want to revert to default advertisement mode, do the following:

    • Set advertisedMode to DEFAULT
    • Set advertisedGroup[] and advertisedIpRanges[] 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 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 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": []
        }
    

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.