Manage BGP timers

This page describes the following:

  • Cloud Router's BGP timers and their settings, including guidance for configuring the same settings on your on-premises router.
  • Updating the BGP keepalive interval for Cloud Router.

BGP timers and settings

The Cloud Router and your on-premises router maintain communication by using the following set of timer settings.

Keepalive timer

BGP systems exchange keepalive messages to determine whether a link or host has failed or is no longer available. In conjunction with the hold timer, the keepalive timer indicates whether a router is reachable to its BGP peer.

The keepalive timer is the KEEPALIVE_INTERVAL between periodic BGP messages exchanged between a Cloud Router and its corresponding on-premises peer router. You can configure this value as described in Update the BGP keepalive interval. The default value is 20 seconds. Google recommends setting the keepalive timers to the same value on your on-premises router and the Cloud Router.

Hold timer

This timer tracks the minimum amount of time since the last successful keepalive message was detected. It indicates the length of time that a Cloud Router or your on-premises router should wait, absent a graceful restart notification, before removing the routes that it learned from the other router.

Cloud Router sets this value to the value of its configured keepalive timer multiplied by three. For example, if the keepalive timer is 20 seconds, the hold timer is set to 60 seconds. Similarly, set the hold timer on your on-premises router to the value of the Cloud Router keepalive timer multiplied by three.

Graceful restart timer

This timer tracks the amount of time that a router waits after it receives a graceful restart notification (TCP FIN or RST packet) from another router. A router that supports graceful restart advertises a graceful restart timer value that defines the amount of time that the other router should wait after receiving a graceful restart notification. Two peer routers can use different graceful restart timer values, but a router is expected to honor the graceful restart timer value of its peer. When establishing a new BGP session, each router communicates its own graceful restart timer value to the peer router through the BGP OPEN message.

Cloud Router supports graceful restart, and the Cloud Router graceful restart timer is set to 60 seconds. Every Cloud Router sends a graceful restart notification before each software maintenance event.

If you configured your on-premises router with graceful restart, it can also send a graceful restart notification to the Cloud Router during on-premises router restart or maintenance events. Set your on-premises router's graceful restart timer to a value that is appropriate for your needs.

Stalepath timer

This setting determines how long a router waits before deleting learned routes after it receives an end-of-record (EOR) message from the other router. This timer starts when the BGP session is reinitialized after a graceful restart, but the prefix in question hasn't been addressed by an UPDATE message. We recommend setting the stalepath timer to 300 seconds on your on-premises router to match the setting for the Cloud Router.

Update the BGP keepalive interval

To modify the BGP keepalive interval on a Cloud Router, follow these steps.

Console

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

    Go to Cloud Routers

  2. Select the Cloud Router that contains the BGP interval to modify.

  3. On the Router details page, click Edit.

  4. Update the BGP peer keepalive interval. This value must be an integer between 20 and 60 that specifies the number of seconds for the interval. The default is 20 seconds.

  5. Click Save.

gcloud

Run the update command:

gcloud compute routers update ROUTER_NAME \
    --project=PROJECT_ID \
    --keepalive-interval=KEEPALIVE_INTERVAL \
    --region=REGION

Replace the following:

  • ROUTER_NAME: the name of the Cloud Router
  • PROJECT_ID: the project that contains the Cloud Router
  • KEEPALIVE_INTERVAL: the interval between BGP keepalive messages that are sent to the peer router

    This value must be an integer between 20 and 60 that specifies the number of seconds for the interval. The default is 20 seconds.

  • REGION: the region where the Cloud Router is located

The output is similar to the following:

  Updating router [my-router]...done.

API

Use the routers.patch method to update the bgp.keepaliveInterval field:

    PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME
    {
      "bgp": {
        "keepaliveInterval": KEEPALIVE_INTERVAL
     }
   }

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
  • KEEPALIVE_INTERVAL: the interval between BGP keepalive messages that are sent to the peer router

    This value must be an integer between 20 and 60 that specifies the number of seconds for the interval. The default is 20 seconds.

What's next