Update or disable BFD
You can update settings for Bidirectional Forwarding Detection (BFD) on an active BGP session or when disabling a session.
For more information about BFD for Cloud Router, see the following resources:
- View descriptions of the BFD settings used on this page.
- Learn more about BFD in the BFD for Cloud Router overview.
- Check BFD status by viewing Cloud Router status.
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.
Update BFD settings on an active BGP session
To update BFD settings on an existing BGP session, 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, in the BGP sessions section, select the BGP session to update. 
- On the BGP session details page, click Edit. 
- Configure BFD options as documented in BFD settings and timers. 
gcloud
Run the update-bgp-peer command:
  gcloud compute routers update-bgp-peer ROUTER_NAME \
      --peer-name=PEER_NAME \
      --project=PROJECT_ID \
      --interface=INTERFACE \
      --ip-address=IP_ADDRESS \
      --peer-asn=PEER_ASN \
      --peer-ip-address=PEER_IP_ADDRESS \
      --region=REGION \
      --bfd-session-initialization-mode=BFD_SESSION_INITIALIZATION_MODE  \
      --bfd-min-receive-interval=BFD_MIN_RECEIVE_INTERVAL \
      --bfd-min-transmit-interval=BFD_MIN_TRANSMIT_INTERVAL \
      --bfd-multiplier=BFD_MULTIPLIER
Replace the following:
- ROUTER_NAME: the name of your Cloud Router
- PEER_NAME: the name of your BGP peer
- PROJECT_ID: the name of the project containing the Cloud Router
- INTERFACE: the name of the interface for this BGP peer
- IP_ADDRESS: the link-local IP address of the Cloud Router interface for this BGP peer in the range- 169.254.0.0/16; belongs to the same subnet as the interface IP address of the peer router
- PEER_ASN: the BGP autonomous system number (ASN) for this BGP peer
- PEER_IP_ADDRESS: the link-local address of the peer router that belongs to the range- 169.254.0.0/16
- REGION: the region where the Cloud Router is located
- Configure BFD options as documented in BFD settings and timers.
API
Use the
routers.patch
method to update the bgpPeers[].bfd 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 - GETrequest to get the current array of BGP peers for the router. For details, see View BGP session configuration.
- Send a - PATCHrequest with a new array of BGP peers. In the array element that contains the BGP session whose BFD settings you want to update, modify the- bgpPeers[].bfdfield:- PATCH https://compute.googleapis.com/compute/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 includes two BGP peers and sets the values in the - bgpPeers[].bfdfield. For more information about these options, see BFD settings and timers.- { "name": "peer-1", "interfaceName": "if-peer-1", "ipAddress": "169.254.10.1", "peerIpAddress": "169.254.10.2", "peerAsn": 64512, "advertisedRoutePriority": 100, "advertiseMode": "DEFAULT" "bfd": { "sessionInitializationMode": DISABLED, "minTransmitInterval": 1000, "minReceiveInterval": 1000, "multiplier": 5 } }, { "name": "peer-2", "interfaceName": "if-peer-2", "ipAddress": "169.254.20.1", "peerIpAddress": "169.254.20.2", "peerAsn": 64513, "advertisedRoutePriority": 99, "advertiseMode": "DEFAULT" "bfd": { "sessionInitializationMode": ACTIVE, "minTransmitInterval": 1000, "minReceiveInterval": 1000, "multiplier": 5 } }
Disable BFD
When disabling BFD, you can optionally configure BFD settings that become active when you re-enable the session. The options remain configured for the disabled session, but are not in effect. This behavior is similar to disabling a firewall rule without deleting it.
To disable BFD on a BGP session, 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, in the BGP sessions section, select the BGP session to update. 
- On the BGP session details page, click Edit. 
- Set BFD session initialization mode to - Disabled.
- Optionally configure other BFD options as documented in BFD settings and timers. 
gcloud
Run the update-bgp-peer command:
  gcloud compute routers update-bgp-peer ROUTER_NAME \
      --project=PROJECT_ID \
      --peer-name=PEER_NAME \
      --interface=INTERFACE \
      --ip-address=IP_ADDRESS \
      --peer-asn=PEER_ASN \
      --peer-ip-address=PEER_IP_ADDRESS \
      --region=REGION \
      --bfd-session-initialization-mode=BFD_SESSION_INITIALIZATION_MODE  \
      --bfd-min-receive-interval=BFD_MIN_RECEIVE_INTERVAL \
      --bfd-min-transmit-interval=BFD_MIN_TRANSMIT_INTERVAL \
      --bfd-multiplier=BFD_MULTIPLIER
Replace the following:
- ROUTER_NAME: the name of your Cloud Router
- PROJECT_ID: the name of the project containing the Cloud Router
- PEER_NAME: the name of your BGP peer
- INTERFACE: the name of the interface for this BGP peer
- IP_ADDRESS: the link-local IP address of the Cloud Router interface for this BGP peer in the range- 169.254.0.0/16; belongs to the same subnet as the interface IP address of the peer router
- PEER_ASN: the BGP autonomous system number (ASN) for this BGP peer
- PEER_IP_ADDRESS: the link-local address of the peer router that belongs to the range- 169.254.0.0/16
- REGION: the region where the Cloud Router is located
- BFD_SESSION_INITIALIZATION_MODE: set to- disabled
- Optional: configure other BFD options as documented in BFD settings
API
Use the
routers.patch
method to update the bgpPeers[].bfd.sessionInitializationMode 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 - GETrequest to get the current array of BGP peers for the router. For details, see View BGP session configuration.
- Send a - PATCHrequest with a new array of BGP peers. In the array element that contains the BGP session for which you want to disable BFD, set the- bgpPeers[].bfd.sessionInitializationModeto- DISABLED:- PATCH https://compute.googleapis.com/compute/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 includes two BGP peers and disables BFD for both of them. For more information about these options, see BFD settings and timers. - { "name": "peer-1", "interfaceName": "if-peer-1", "ipAddress": "169.254.10.1", "peerIpAddress": "169.254.10.2", "peerAsn": 64512, "advertisedRoutePriority": 100, "advertiseMode": "DEFAULT" "bfd": { "sessionInitializationMode": DISABLED, "minTransmitInterval": 1000, "minReceiveInterval": 1000, "multiplier": 5 } }, { "name": "peer-2", "interfaceName": "if-peer-2", "ipAddress": "169.254.20.1", "peerIpAddress": "169.254.20.2", "peerAsn": 64513,https://cloud.google.com/network-connectivity/docs/router/how-to/configuring-bfd "advertisedRoutePriority": 99, "advertiseMode": "DEFAULT" "bfd": { "sessionInitializationMode": DISABLED, "minTransmitInterval": 1000, "minReceiveInterval": 1000, "multiplier": 5 } }
What's next
- To configure BFD on a BGP session or peer router, see Configure BFD for Cloud Router. 
- To find examples of third-party router configurations that support BFD for Cloud Router, see Use third-party router configurations for BFD. 
- For help with BFD diagnostic messages, session states, and status messages, see BFD diagnostic messages and session states. 
- To configure BGP sessions, see Establish BGP sessions. 
- To list, update, or delete a Cloud Router, see List and delete Cloud Routers. 
- To troubleshoot issues with Cloud Router, see Troubleshooting.