Updating or disabling 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:

Before you begin

If you want to use the command-line examples in this guide, do the following:

  1. Install or update to the latest version of the Google Cloud CLI.
  2. Set a default region and zone.

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

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

    Go to Cloud Routers

  2. Click the name of the Cloud Router whose BGP sessions you want to edit.

  3. On the Router details page, under BGP sessions, click the name of the BGP session that you want to edit.

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

  5. 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 range169.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.

  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. In the array element that contains the BGP session whose BFD settings you want to update, modify the bgpPeers[].bfd field:

       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[].bfd field. 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

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

    Go to Cloud Routers

  2. Click the name of the Cloud Router whose BGP sessions you want to edit.

  3. On the Router details page, under BGP sessions, click the name of the BGP session that you want to edit.

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

  5. Set BFD session initialization mode to Disabled.

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

  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. In the array element that contains the BGP session for which you want to disable BFD, set the bgpPeers[].bfd.sessionInitializationMode to 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