Reverting to the default advertisement

If you no longer need to advertise certain subnets or custom IP ranges, you can revert back to the default behavior.

By default, Cloud Router advertises all available subnets, including new ones. For BGP sessions, the default behavior is to inherit the Cloud Router's behavior.

To revert advertisements on a Cloud Router:

Console


  1. Go to the Cloud Router page in the Google Cloud Console.
    Cloud Router list
  2. Select the Cloud Router to update.
  3. In the Cloud Router's detail page, select Edit.
  4. Expand the Advertised routes section.
  5. For the Routes, select Advertise all subnets visible to the Cloud Router (Default).
  6. Select Save to revert to the default advertisement.

gcloud


Run the update command and 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

To revert to the default advertisement, use the routers.patch method to set bgp.advertiseMode to DEFAULT and clear the custom advertisement configuration.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME
{
  "bgp": {
    "advertiseMode": "DEFAULT",
    "advertisedGroups": [],
    "advertisedIpRanges": []
  }
}

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

To revert advertisements on a BGP session:

Console


  1. Go to the Cloud Router page in the Google Cloud Console.
    Cloud Router list
  2. Select the Cloud Router that contains the BGP session to update.
  3. In the Cloud Router's detail page, select the BGP session to update.
  4. In the BGP session details page, select Edit.
  5. For the Routes, select Advertise all subnets visible to the Cloud Router (Default).
  6. Select Save to revert to the default advertisement.

gcloud


Run the update-bgp-peer command and use the --advertisement-mode flag 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

To revert to the default advertisement 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. See Viewing a Cloud Router configuration.

  2. Send a PATCH request with a new array of BGP peers. For each BGP peer that you want to revert to the default advertisement, 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 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 reverts two BGP sessions to the default advertisement:

      {
        "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