Traffic steering (2)·续1

Check feature availability before upgrading

Features outside Cloudflare Network Firewall have the following availability:

Feature Availability with Unified Routing
Sample packet captures Generally available.
Full packet captures Not available.
Gateway filtering Generally available. Supports WAN-to-Internet and WAN-to-WAN filtering. Contact your account team to enable WAN-to-WAN filtering.
Load Balancing Generally available.
Workers VPC Generally available.
Application Services Generally available.
Network Analytics Generally available.

Cloudflare Network Firewall features have the following availability:

Feature Availability with Unified Routing
Basic firewall rules Generally available.
GeoIP country rules Beta.
ASN lists Beta.
Account IP lists Beta.
Threat Intel Lists Beta.
SIP rules Beta.
Intrusion detection system (IDS) Beta for Cloudflare WAN only.
Rate limiting Not available.
Managed rulesets Beta.

Evaluate performance

Unified Routing performance can differ from Legacy Routing for the same traffic profile. Throughput depends on traffic distribution, packet sizes, tunnel settings, encryption, and customer equipment.

Before upgrading, establish a Legacy Routing baseline and run a controlled Unified Routing pilot with representative traffic. Test expected and peak throughput, packet loss, latency, tunnel failover, and your existing IPsec settings.

How to upgrade to Unified Routing

If your account uses Legacy Routing, follow these steps to upgrade:

  1. Evaluate Unified Routing features and performance against your current needs. Review the routing mode comparison, feature availability, and performance guidance.
  2. If you use Cloudflare Network Firewall, review Unified Routing behavior changes and update any affected rules.
  3. Identify suitable times for the upgrade. During the upgrade, Cloudflare One Client users can experience a remote access outage of up to three minutes.
  4. Contact your account team to request the change and provide a range of acceptable times.

Route evaluation with Zero Trust connections

When your account uses both Zero Trust routes (Cloudflare Tunnel, Cloudflare Mesh) and WAN routes (IPsec, GRE, CNI), route selection behavior depends on your routing mode.

Terminology

Route type Connection methods
Zero Trust routes Cloudflare Tunnel, Cloudflare Mesh
WAN routes IPsec, GRE, and CNI

Unified Routing mode

Unified Routing uses a single routing fabric for all connection types. Route selection applies longest-prefix-match consistently across all traffic types and connection methods.

Zero Trust route WAN route Traffic destination Selected route
10.0.0.0/24 10.0.0.64/28 10.0.0.70 WAN (more specific)
10.0.0.0/28 10.0.0.0/24 10.0.0.10 Zero Trust (more specific)
10.0.0.0/24 10.0.0.0/24 10.0.0.10 Zero Trust (same prefix length)

When routes have the same prefix length, Zero Trust routes take precedence over WAN routes.

For scenarios with overlapping IP space across sites, enable Automatic Return Routing to ensure return traffic reaches the correct origin.

Legacy Routing mode

For accounts using Legacy Routing, route selection depends on the traffic source.

Cloudflare One Client to private network

For accounts using only Zero Trust, Cloudflare One Client traffic is routed using the Zero Trust IP routing table only, following longest-prefix-match logic.

If your account has Cloudflare WAN enabled, traffic from Cloudflare One Client follows the same route selection behavior as site-to-site traffic with Gateway. Contact your account team if you want Cloudflare One Client to continue to behave as if WAN is not enabled.

Site-to-site traffic (WAN to WAN)

For traffic between WAN connections (IPsec to IPsec, GRE to GRE, and CNI to CNI) that does not require Gateway filtering, longest-prefix-match applies within the WAN routing table. This traffic does not interact with Zero Trust routing.

Site-to-site traffic with Gateway

When Gateway network policies are applied to site-to-site WAN traffic, route selection follows these rules:

Scenario Behavior
More specific Zero Trust route than WAN route Works — longest-prefix-match honored for both inbound and outbound traffic
More specific WAN route than Zero Trust route Not guaranteed — Zero Trust route can take precedence regardless of prefix length
Equal prefix length Zero Trust route wins (by design)

Note

If you need consistent longest-prefix-match across all scenarios, follow How to upgrade to Unified Routing.

Cross-system traffic (WAN to Zero Trust or Zero Trust to WAN)

Legacy Routing uses two routing components:

  • Zero Trust routing (handles Cloudflare One Client, Cloudflare Tunnel, and Cloudflare Mesh)
  • WAN routing (handles IPsec, GRE, and CNI)

Cross-system traffic follows the same rules as site-to-site traffic with Gateway. A more specific Zero Trust route works correctly; a more specific WAN route is not guaranteed to be selected.

Recommendation: If overlap is required, follow How to upgrade to Unified Routing.

Check your routing mode

To determine the routing mode for your account:

  1. Go to Routes.

Go to Routes ↗

  1. Check the banner at the top of the page:
  2. Your account is using Unified Routing mode. — Your account uses Unified Routing.
  3. Unified routing is available. — Your account uses Legacy Routing.

If your account uses Legacy Routing, follow How to upgrade to Unified Routing.

Scoping routes to specific regions

If you have multiple connectivity paths to a network segment and want to apply different route prioritization based on where traffic arrives at the Cloudflare network, you can scope routes to specific Cloudflare data center regions. This is useful if you run your own anycast network and want your end-user traffic to arrive at your network location closest to the user.

When you scope a route to a Cloudflare data center region, it only shows up in the Cloudflare Virtual Network routing table in that region, along with all global routes that do not have any region scope. Route prioritization and ECMP logic apply across both region-scoped and global routes.

Note

Scoping routes to specific regions is not supported with BGP peering, and is only available to statically configured routes at this time.

When using region-scoped routes, ensure that all prefixes have routes covering all regions. Otherwise, traffic may arrive at a Cloudflare region that is not covered by any route, in which case Cloudflare drops the traffic.

The following table exemplifies how to use geographic scoping for routes:

Prefix NextHop Priority Region code
10.10.10.100/24 TUNNEL_1_IAD 100 AFR
10.10.10.100/24 TUNNEL_2_IAD 100 EEUR
10.10.10.100/24 TUNNEL_3_ATL 100 ENAM
10.10.10.100/24 TUNNEL_4_ATL 100 ME
10.10.10.100/24 TUNNEL_5_ATL 100 WNAM
10.10.10.100/24 TUNNEL_4_ATL 100 ENAM

When there are multiple routes to the same prefix with equal priority, and those routes are assigned to different geographic regions (like WNAM and ENAM), traffic entering the network in a specific region — for example, WNAM — egresses through the route associated with that same region.

Region codes and associated regions

Cloudflare has nine geographic regions:

Region code Region
AFR Africa
APAC Asia Pacific
EEUR Eastern Europe
ENAM Eastern North America
ME Middle East
OC Oceania
SAM South America
WEUR Western Europe
WNAM Western North America

Configure scoping for your traffic in the Region code section when adding or editing a static route. Refer to Create a static route and Edit a static route for more information.

Equal-cost multi-path routing

Equal-cost multi-path routing uses hashes calculated from packet ↗︎ data to determine the route chosen. The hash always uses the source and destination IP addresses. For TCP and UDP packets, the hash includes the source and destination ports as well. The ECMP algorithm divides the hash for each packet by the number of equal-cost next hops. The modulus (remainder) determines the route the packet takes.

Using ECMP has a number of consequences:

  • Routing to equal-cost paths is probabilistic.
  • Packets in the same session with the same source and destination have the same hash. The packets also use the same next hop.
  • Routing changes in the number of equal-cost next hops can cause traffic to use different tunnels. For example, dynamic reprioritization triggered by health check events can cause traffic to use different tunnels.

As a result, ECMP provides load balancing across tunnels with the same prefix and priority.

Note

Packets in the same flow use the same tunnel unless the tunnel priority changes. Packets for different flows can use different tunnels depending on which tunnel the flow's 4-tuple — source and destination IP and source and destination port — hash to.

Examples

This diagram illustrates how ECMP distributes traffic equally across two paths with the same prefix and priority.

Normal traffic flow

flowchart LR
accTitle: Tunnels diagram
accDescr: This example has three tunnel routes, with traffic equally distributed across two paths.

subgraph Cloudflare
direction LR
B[Cloudflare <br> data center]
C[Cloudflare <br> data center]
D[Cloudflare <br> data center]
end

Z("Load balancing for some <br> priority tunnels uses ECMP <br> (hashing on src IP, dst IP, <br> scr port, dst port)") --- Cloudflare
A((User)) --> Cloudflare --- E[Anycast IP]
E[Anycast IP] --> F[/"GRE Tunnel 1 / <br> priority 1 / <br> ~50% of flows"/] --> I{{Customer <br> data center/ <br> network 1}}
E[Anycast IP] --> G[/"GRE Tunnel 2 / <br> priority 1 / <br> ~50% of flows"/] --> J{{Customer <br> data center/ <br> network 2}}
E[Anycast IP] --> H[/GRE Tunnel 3 / <br> priority 2 / <br> 0% of flows/] --o K{{Customer <br> data center/ <br> network 3}}

Failover traffic flow: Scenario 1

Customer router failure

When Cloudflare WAN health checks determine that Tunnel 2 is unhealthy, Cloudflare WAN dynamically de-prioritizes that route, leaving Tunnel 1 as the sole top-priority route. As a result, Cloudflare WAN steers traffic away from Tunnel 2, and all traffic flows to Tunnel 1.

flowchart LR
accTitle: Tunnels diagram
accDescr: This example has Tunnel 2 unhealthy, and all traffic prioritized to Tunnel 1.

subgraph Cloudflare
direction LR
B[Cloudflare <br> data center]
C[Cloudflare <br> data center]
D[Cloudflare <br> data center]
end

Z(Tunnel health is <br> determined by <br> health checks that <br> run from all Cloudflare <br> data centers) --- Cloudflare
A((User)) --> Cloudflare --- E[Anycast IP]
E[Anycast IP] --> F[/"Tunnel 1 / <br> priority 1 / <br> ~100% of flows"/]:::green --> I{{Customer <br> data center/ <br> network 1}}
E[Anycast IP] --> G[/Tunnel 2 / <br> priority 3 / <br> unhealthy / 0% of flows/]:::red --x J{{Customer <br> data center/ <br> network 2}}
E[Anycast IP] --> H[/Tunnel 3 / <br> priority 2 / <br> 0% of flows/] --o K{{Customer <br> data center/ <br> network 3}}
classDef red fill:#EE4B2B,color: black
classDef green fill:#00FF00,color: black

Failover traffic flow: Scenario 2

Intermediary Internet Service Provider (ISP) failure

When Cloudflare WAN determines that Tunnel 1 is unhealthy as well, that route is also de-prioritized, leaving Tunnel 3 with the top priority route. In that case, all traffic flows to Tunnel 3.

flowchart LR
accTitle: Tunnels diagram
accDescr: This example has Tunnel 1 and 2 unhealthy, and all traffic prioritized to Tunnel 3.

subgraph Cloudflare
direction LR
B[Cloudflare <br> data center]
C[Cloudflare <br> data center]
D[Cloudflare <br> data center]
end

Z(Lower-priority tunnels <br> are used when <br> higher-priority tunnels <br> are unhealthy) --- Cloudflare
A((User)) --> Cloudflare --- E[Anycast IP]
E[Anycast IP]  -- Intermediary <br> network issue -->  F[/Tunnel 1 / <br> priority 3 / <br> unhealthy / 0% of flows/]:::red --x I{{Customer <br> data center/ <br> network 1}}
E[Anycast IP]  -- Intermediary <br> network issue -->  G[/Tunnel 2 / <br> priority 3 / <br> unhealthy / 0% of flows/]:::red --x J{{Customer <br> data center/ <br> network 2}}
E[Anycast IP] -->  H[/Tunnel 3 / <br> priority 2 / <br> 100% of flows/]:::green --> K{{Customer <br> data center/ <br> network 3}}
classDef red fill:#EE4B2B,color: black
classDef green fill:#00FF00,color: black

When Cloudflare WAN determines that Tunnels 1 and 2 are healthy again, it re-prioritizes those routes, and traffic flow returns to normal.