Traffic steering (2)·续2

ECMP and bandwidth utilization

Because ECMP is probabilistic, the algorithm routes roughly the same number of flows through each tunnel. However, it does not consider the amount of traffic already sent through a tunnel when deciding where to route the next packet.

For example, consider a scenario with many very low-bandwidth TCP connections and one very high-bandwidth TCP connection. Packets for the high-bandwidth connection have the same hash and thus use the same tunnel. As a result, that tunnel utilizes greater bandwidth than the others.

Note

Cloudflare WAN supports a weight field that you can apply to a route so that a specified percentage of traffic uses a certain tunnel rather than other equal-cost tunnels. Refer to Route prioritization for more information.

For example, in a scenario where you want to route 70% of your traffic through ISP A and 30% through ISP B, you can use the weight field to help achieve that.

Because ECMP balances flows probabilistically, the use of weights is only approximate.

For more on Cloudflare WAN tunnel weights, contact your Cloudflare customer service manager.

BGP information

Using BGP peering with your Cloudflare One or Magic Transit network routing table allows you to automate the process of adding or removing networks and subnets. BGP does not replace tunnel health checks. Refer to Tunnel health checks.

With this functionality, you can:

  • Establish an eBGP session between your devices and the Cloudflare WAN service when connected through CNI, GRE or IPsec tunnels.
  • Secure the session by MD5 authentication to prevent misconfigurations.
  • Exchange routes dynamically between your devices and your Cloudflare Virtual Network routing table.

Release status

The following table outlines the current availability and recommended use cases for BGP across different connectivity methods.

Feature Release stage Recommended use Prerequisites
BGP over Anycast IPsec/GRE Generally available Production workloads Available to all Unified Routing accounts; no enablement required
BGP over CNI Closed beta Not available to new customers — contact your account team Cloudflare Network Interconnect (CNI) v2

BGP architecture

Global routing and anycast edge

Cloudflare Virtual Network makes a one-pass, per-packet routing decision at the Cloudflare data center that first processes the packet (the ingress node). This ensures that even when a packet traverses multiple nodes within the Cloudflare backbone, its path is determined at the point of entry for maximum efficiency.

Your BGP session over IPsec, GRE, or CNI is established with the Cloudflare data center closest to your BGP peer device. Routes learned here must propagate to Cloudflare's global edge to govern how traffic is routed across the entire network.

  • Convergence time: Global route convergence typically completes within 20 seconds.
  • Visibility: You can monitor learned routes and their propagation status through the Cloudflare dashboard or API.

Centralized route propagation

Cloudflare Virtual Network uses a centralized control plane for route propagation, functioning similarly to a BGP Route Reflector. This architecture decouples the physical BGP session from global route distribution:

  • Session termination: BGP peering sessions are terminated at the Cloudflare edge location closest to your router.
  • SDN conversion: Ingress BGP updates are converted into Software-Defined Networking (SDN) state and transmitted to a centralized relay function.
  • Global dissemination: The relay propagates these instructions to every Cloudflare data center globally, updating the local Forwarding Information Base (FIB) at each site.

Edge Resiliency Mode (Non-Stop Forwarding)

Cloudflare's data plane is designed for high availability. If the edge location loses communication with the centralized relay, the system enters Edge Resiliency Mode, mimicking Non-Stop Forwarding (NSF) behavior:

  • Forwarding continuity: Edge locations continue to route traffic using the last-known-good forwarding table (FIB). Data plane traffic remains uninterrupted.
  • Stale path retention: Because the FIB is frozen during this mode, forwarding decisions remain active even if the underlying BGP session with your router flaps or resets.
  • Continuous health monitoring: While BGP updates are frozen, tunnel health checks remain active. These are sent from all Cloudflare data centers, allowing the edge at any ingress node to detect if a physical connection to your router has failed. If a health check fails, the ingress node at the edge will deprioritize that specific path, preventing traffic from being sent into a black hole despite the frozen routing state.
  • Update freeze: During this state, the global control plane is frozen. New BGP updates received from your router will be held locally at the edge and will not propagate globally until connectivity to the centralized relay is restored.

Traffic persistence during BGP resets

In Edge Resiliency Mode, Cloudflare prioritizes forwarding continuity. If your on-premises router resets or the BGP session flaps, the edge will continue to forward traffic toward your peer device based on the last known valid routing state — provided that the underlying tunnel health checks remain successful.

If the BGP session resets and the tunnel health checks fail (for example, your router is completely offline), the edge will typically take alternate paths until connectivity is restored.

System recovery and re-synchronization

Once connectivity between the Cloudflare edge and the centralized relay is restored, the system automatically exits Edge Resiliency Mode and performs a stateful re-synchronization:

  1. RIB-to-relay sync: The edge pushes all currently held BGP updates (the current RIB state) to the relay.
  2. Global update: The relay reconciles these updates and propagates any changes to the rest of the Cloudflare global network.
  3. FIB unfreeze: The local forwarding tables at the edge are unfrozen and updated with the latest validated routing instructions.

BGP peering with the Cloudflare Virtual Network routing table

Cloudflare WAN BGP peering is with the Cloudflare Virtual Network routing table (as opposed to peering with the Cloudflare Internet global network). BGP peers configured by following this guide will receive advertisements for all prefixes in the Cloudflare Virtual Network routing table plus any additional prefixes configured in the on-ramp Advertised prefix list.

If instead you are seeking to do public peering with the Cloudflare ASN 13335 at one of the Cloudflare data centers, refer to PNI and peering setup. It is not currently possible to share Cloudflare Virtual Network BGP peering and PNI on the same physical interconnect port.

BGP route distribution and convergence

Cloudflare redistributes routes received from your device into the Cloudflare Virtual Network routing table, which both Cloudflare WAN and Magic Transit use.

All routes in the Cloudflare Virtual Network routing table are advertised to BGP peers. Each BGP peer receives each prefix route along with the full AS_PATH, with the selected Cloudflare side ASN ↗︎ prepended. This is so that the peer can accurately perform loop prevention ↗︎.

BGP peering sessions can advertise reachable prefixes to a peer and withdraw previously advertised prefixes. This propagation takes no more than a few minutes.

BGP timers and settings

Cloudflare uses the following timers, which are not configurable:

Setting Description
Hold timer 240 seconds<br> (To establish a session, Cloudflare compares its hold timer and the peer's hold timer, and uses the smaller of the two values to establish the BGP session.)
Keepalive timer One third of the hold timer.
Graceful restart Helper mode only. Cloudflare advertises a restart time of 120 seconds and honors a peer restart time of up to 90 seconds.
  • Hold timer: Specifies the maximum amount of time that a BGP peer waits to receive a KEEPALIVE, UPDATE, or NOTIFICATION message before declaring the BGP session down. Cloudflare uses the smaller of this default hold timer and that received from the peer in the OPEN message.
  • Keepalive timer: BGP systems exchange keepalive messages to determine whether the peer router is reachable. If keepalive messages are not received within the hold timer, the session is assumed to be down, indicating that the peer is no longer reachable at the BGP protocol level.
  • Graceful restart timer: Tracks how long a router waits for a peer to re-establish a BGP session after the peer initiates a graceful restart. If the peer does not reconnect within this time, the router declares the session down and removes stale routes.

BGP capabilities and limitations

BGP multipath is supported. If BGP learns the same prefix on two different interconnects, Cloudflare distributes traffic destined for that prefix across each interconnect according to the usual ECMP behavior.

Cloudflare supports BGP Graceful Restart (RFC 4724 ↗︎) in helper mode only. Cloudflare never acts as the restarting speaker, because your device always initiates the BGP session.

If your device negotiates graceful restart and then restarts, Cloudflare keeps its routes as stale while it reconnects. Cloudflare removes stale routes after your device sends End-of-RIB, or after 90 seconds.

BGP support has the following limitations:

  • The Cloudflare account ASN and your device ASN must be different. Only eBGP is supported.
  • Cloudflare always injects routes with a priority of 100.
  • Bidirectional Forwarding Detection (BFD) is not supported.

Tunnel health checks

You need to enable legacy health checks alongside BGP. This is essential to determine if a specific Cloudflare data center is reachable from your device. Tunnel health checks modify the route priorities for dynamically learned BGP routes.

Application-aware policies

By default, Cloudflare balances and steers traffic based on network-layer characteristics (IP, port etc). If you are using the Cloudflare WAN Connector, you can also steer traffic based on well-known applications. Application-aware policies provide easier management and more granularity over traffic flows.

For more information, refer to Applications and app types.

Was this helpful?

YesNo

On this page

Traffic steering (2)·续2 - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/cloudflare-wan/reference/traffic-steering/#page","headline":"Traffic steering","description":"Cloudflare WAN uses a static configuration to route traffic through anycast tunnels using the Generic Routing Encapsulation (GRE) and Internet Protocol Security (IPsec) protocols from Cloudflare's global network to your network.","url":"https://developers.cloudflare.com/cloudflare-wan/reference/traffic-steering/","inLanguage":"en","image":"https://developers.cloudflare.com/cloudflare-wan/reference/traffic-steering/og.png?v=eceef563a603fdd0","dateModified":"2026-10-12","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Cloudflare WAN uses probes to check for tunnel health. Review information on this page to learn more. title: Tunnel health checks image: https://developers.cloudflare.com/cloudflare-wan/reference/tunnel-health-checks/og.png?v=19471dc969be6b58


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/cloudflare-wan/llms.txt
Use this file to discover all available pages before exploring further.