Disable or remove BGP sessions
You can disable a BGP session temporarily or remove it entirely.Some common reasons for disabling a session are changing routerconfiguration when migrating to a different BGP peer or performingmaintenance on a BGP peer.
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 theGoogle Cloud CLI.
- Set adefault region andzone.
API
If you want to use the API examples in this guide, set upAPI access.
Disable a BGP session
You can disable a BGP session by using the Google Cloud console, theupdate-bgp-peer command, or the API. BGP sessions are enabled by default.
If disabled, any active session with the BGP peer is shut down, and allassociated routing information is removed.
To disable a BGP session, follow these steps.
Console
In the Google Cloud console, go to theCloud Routers page.
- Select the router that hosts the BGP session that you want to disable.
- On theRouter details page, select the BGP session that you to wantto disable.
- On theBGP session details page, clickEdit.
- ForBGP peer, selectDisabled.
- ClickSave.
gcloud
Run theupdate-bgp-peer command:
gcloud compute routers update-bgp-peerROUTER_NAME \ --project=PROJECT_ID \ --peer-name=PEER_NAME \ --region=REGION \ --no-enabled
Replace the following:
ROUTER_NAME: the name of your Cloud RouterPROJECT_ID: the project that contains theCloud RouterPEER_NAME: the name of your BGP peerREGION: the region where the Cloud Routeris located
API
Use therouters.patchmethod to update thebgpPeers[] field.
ThebgpPeers[] field accepts an array of BGP peers. When youPATCH thisfield, you overwrite the existing array of BGP peers with the new arrayincluded in your request.
Send a
GETrequest to get the current array of BGP peers for the router.For details, seeView BGP session configuration.Send a
PATCHrequest with a new array of BGP peers. For each BGP peer forwhich you want to disable the BGP session, setbgpPeers[].enabletoFALSE.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 theCloud RouterREGION: the region where the Cloud Routeris locatedROUTER_NAME: the name of the Cloud RouterBGP_PEERS: the contents of the new array of BGPpeers
The following example disables the session for the first BGP peer:
{ "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": [],"enable": "FALSE" }, { "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": [] }
Enable a BGP session
You can enable a BGP session by using the Google Cloud console, theupdate-bgp-peer command, or the API. BGP sessions are enabled by default.
If enabled, the peer connection can be established with routing information.
To enable a BGP session, follow these steps.
Console
In the Google Cloud console, go to theCloud Routers page.
- Select the router that hosts the BGP session that you want to enable.
- On theRouter details page, select the BGP session that you want to enable.
- On theBGP session details page, clickEdit.
- ForBGP peer, selectEnabled.
- ClickSave.
gcloud
Run theupdate-bgp-peer command:
gcloud compute routers update-bgp-peerROUTER_NAME \ --project=PROJECT_ID \ --peer-name=PEER_NAME \ --region=REGION \ --enabled
Replace the following:
ROUTER_NAME: the name of your Cloud RouterPROJECT_ID: the project that contains theCloud RouterPEER_NAME: the name of your BGP peerREGION: the region where the Cloud Routeris located
API
Use therouters.patchmethod to update thebgpPeers[] field.
ThebgpPeers[] field accepts an array of BGP peers. When you make aPATCHrequest with this field specified, you overwrite the existing array of BGP peerswith the new array included in your request.
Send a
GETrequest to get the current array of BGP peers for the router.For details, seeView Cloud Router details.Send a
PATCHrequest with a new array of BGP peers. For each BGP peer forwhich you want to enable the BGP session, setbgpPeers[].enabletoTRUE.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 theCloud RouterREGION: the region where the Cloud Routeris locatedROUTER_NAME: the name of the Cloud RouterBGP_PEERS: the contents of the new array of BGPpeers
The following example enables the session for the first BGP peer:
{ "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": [],"enable": "TRUE" }, { "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": [] }
Remove a BGP session
If you delete the Cloud VPN tunnel or VLAN attachment associated witha BGP session, the session is automatically shut down.
You can remove BGP sessions manually by using the Google Cloud console, theremove-bgp-peer command, or the API. If you remove the BGP session, theVPN tunnel or VLAN attachment remains, but the Cloud Routerdoesn't advertise routes over them.
To remove a BGP session, follow these steps.
Console
In the Google Cloud console, go to theCloud Routers page.
- Select the router that you want to remove a BGP session from.
- ForBGP sessions, select the BGP session that you want to remove.
- At the top of the page, clickDelete, and then confirm the deletion.
gcloud
Run theremove-bgp-peer command:
gcloud compute routers remove-bgp-peerROUTER_NAME \ --project=PROJECT_ID \ --peer-name=PEER_NAME \ --region=REGION \
Replace the following:
ROUTER_NAME: the name of your Cloud RouterPROJECT_ID: the project that contains theCloud RouterPEER_NAME: the name of your BGP peerREGION: the region where the Cloud Routeris located
API
To remove BGP peers from a Cloud Router, use therouters.patchmethod to update thebgpPeers[] field.
ThebgpPeers[] field accepts an array of BGP peers. When youPATCHthis field, you overwrite the existing array of BGP peers with the new arrayincluded in your request.
Send a
GETrequest to get the current array of BGP peers for the router.For details, seeView Cloud Router details.Send a
PATCHrequest with a new array of BGP peers. Use the array fromtheGETrequest in the previous step, and remove any BGP peers that youdo not want on the router.You can send an empty array to remove all BGP peers.
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 theCloud RouterREGION: the region where the Cloud Routeris locatedROUTER_NAME: the name of the Cloud RouterBGP_PEERS: the contents of the new array of BGPpeers
The following example contains two BGP peers:
{ "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": 100, "advertiseMode": "DEFAULT" }
What's next
- To view the configuration of a Cloud Router, its BGP sessions, andthe routes that Cloud Router is advertising, seeView Cloud Router details.
- For information about BGP session states, seeBGP session states.
- To troubleshoot issues with Cloud Router, seeTroubleshooting.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.