Disable or remove BGP sessions (original) (raw)
Stay organized with collections Save and categorize content based on your preferences.
You can disable a BGP session temporarily or remove it entirely. Some common reasons for disabling a session are changing router configuration when migrating to a different BGP peer or performing maintenance 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 a default region and zone.
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 all associated routing information is removed.
To disable a BGP session, follow these steps.
Console
- In the Google Cloud console, go to the Cloud Routers page.
Go to Cloud Routers - Select the router that hosts the BGP session that you want to disable.
- On the Router details page, select the BGP session that you to want to disable.
- On the BGP session details page, clickEdit.
- For BGP peer, select Disabled.
- Click Save.
gcloud
Run the update-bgp-peer
command:
gcloud compute routers update-bgp-peer ROUTER_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 the Cloud RouterPEER_NAME
: the name of your BGP peerREGION
: the region where the Cloud Router is located
API
Use therouters.patchmethod 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, seeView BGP session configuration. - Send a
PATCH
request with a new array of BGP peers. For each BGP peer for which you want to disable the BGP session, setbgpPeers[].enable
toFALSE
.
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 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 the Cloud Routers page.
Go to Cloud Routers - Select the router that hosts the BGP session that you want to enable.
- On the Router details page, select the BGP session that you want to enable.
- On the BGP session details page, clickEdit.
- For BGP peer, select Enabled.
- Click Save.
gcloud
Run the update-bgp-peer
command:
gcloud compute routers update-bgp-peer ROUTER_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 the Cloud RouterPEER_NAME
: the name of your BGP peerREGION
: the region where the Cloud Router is located
API
Use therouters.patchmethod to update the bgpPeers[]
field.
The bgpPeers[]
field accepts an array of BGP peers. When you make a PATCH
request with this field specified, 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, seeView Cloud Router details. - Send a
PATCH
request with a new array of BGP peers. For each BGP peer for which you want to enable the BGP session, setbgpPeers[].enable
toTRUE
.
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 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 with a 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, the VPN tunnel or VLAN attachment remains, but the Cloud Router doesn't advertise routes over them.
To remove a BGP session, follow these steps.
Console
- In the Google Cloud console, go to the Cloud Routers page.
Go to Cloud Routers - Select the router that you want to remove a BGP session from.
- For BGP sessions, select the BGP session that you want to remove.
- At the top of the page, click Delete, and then confirm the deletion.
gcloud
Run the remove-bgp-peer
command:
gcloud compute routers remove-bgp-peer ROUTER_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 the Cloud RouterPEER_NAME
: the name of your BGP peerREGION
: the region where the Cloud Router is located
API
To remove BGP peers from a Cloud Router, use therouters.patchmethod 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, seeView Cloud Router details. - Send a
PATCH
request with a new array of BGP peers. Use the array from theGET
request in the previous step, and remove any BGP peers that you do 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 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 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, and the 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.