Skip to content
AnswerWell geo Documentation

Research · 9 min read · Answerwell

Unified Routing, Automatic Return Routing and WAN Route Evaluation

How Unified Routing, Automatic Return Routing (ARR), and longest-prefix-match steer Cloudflare WAN, Mesh, and Zero Trust traffic.

This page summarises Cloudflare documentation on Unified Routing, Automatic Return Routing (ARR), and how Cloudflare WAN, Magic Transit, Cloudflare Tunnel, Cloudflare Mesh, and Cloudflare One Client traffic is chosen on the Cloudflare One data plane.

Unified Routing mode: what one routing fabric changes

Section titled “Unified Routing mode: what one routing fabric changes”

Unified Routing mode is the Cloudflare One data plane that uses a single routing fabric for all supported connection types. It routes traffic across the Cloudflare One Client, Cloudflare Tunnel, IPsec, GRE, and Cloudflare Network Interconnect (CNI) in one system.

Unified Routing is generally available for Cloudflare WAN and Magic Transit.

Unified Routing improves the integration between Cloudflare One and the standard connectivity onramps supported by Cloudflare WAN. It is capable of many new features including Automatic Return Routing, BGP and custom client subnets.

We recommend Unified Routing for all new accounts.

— Cloudflare, Unified Routing generally available

In the Cloudflare WAN or Magic Transit dashboard, routing mode appears where you manage routes:

  • Routing mode: Unified — your account is on the unified data plane and supports the new routing features.
  • Routing mode: Legacy — your account uses the previous data plane and does not support all unified routing features.

Without Unified Routing, Cloudflare Mesh and Cloudflare WAN cannot exchange traffic. To route between Mesh and WAN (for example, reaching a Mesh node from a WAN-connected site or vice versa), your account must be on Unified Routing mode.

Area Legacy Routing Unified Routing
Routing fabric Separate routing systems for Zero Trust and WAN routes (WAN) or Magic Transit and Cloudflare One (Magic Transit). One routing fabric across all supported connection types.
Route selection Longest-prefix match within each system; cross-system behaviour can surprise you (see below). Longest-prefix match across supported types; when prefix lengths match, Zero Trust routes take precedence.
Cloudflare Mesh and Cloudflare WAN Does not support traffic between Mesh and WAN connections. Supports Mesh and WAN in the same account.
Cloudflare service source IPs (WAN) Public Cloudflare source IPs for traffic to private networks. Dedicated, non-Internet-routable private source range (configurable IPv4).

Several capabilities require Unified Routing, including Automatic Return Routing (for supported return traffic), BGP over IPsec and GRE, custom Cloudflare One Client device subnets with Cloudflare WAN, and Mesh–WAN interoperability. Details and availability notes are in Cloudflare WAN traffic steering and Magic Transit traffic steering.

Automatic Return Routing (ARR): return path without return routes

Section titled “Automatic Return Routing (ARR): return path without return routes”

Automatic Return Routing (ARR) lets Cloudflare track flows from Cloudflare WAN–connected sites so return traffic goes back over the same tunnel or interconnect that carried the original traffic, without requiring static or dynamic return routes. ARR requires Unified Routing mode.

Magic WAN now supports Automatic Return Routing (ARR), allowing customers to configure Magic on-ramps (IPsec/GRE/CNI) to learn the return path for traffic flows without requiring static routes.

— Cloudflare, Automatic Return Routing (Beta)

ARR is described as beta in that changelog entry; the traffic steering reference lists Automatic Return Routing as generally available for Internet return traffic, with routing between WAN connections not available under ARR.

Instead of consulting the routing table for every return packet, Cloudflare WAN learns flows and remembers which connection a flow arrived on.

When eligible traffic hits a connection with ARR enabled, Cloudflare records the source and destination IPs, ports or protocol identifiers, and the arrival connection. Matching return packets are sent back on that connection, bypassing the Cloudflare Virtual Network routing table for that hop.

Automatic Return Routing bypasses route lookup for return traffic.

When ARR is enabled:

Cloudflare tags each flow with the source connection (tunnel or interconnect) when the flow is established. For return traffic, Cloudflare routes packets back to the tagged source connection directly, bypassing the routing table. This allows multiple sites to use identical private IP ranges without NAT or VRF configuration.

— Cloudflare, Cloudflare Tunnel — Automatic Return Routing (ARR)

Outbound traffic from your network toward the Internet still follows your configured static or BGP routes. ARR affects the return path after the flow is learned.

ARR applies when:

  1. Traffic is received on a tunnel or network interconnect where ARR is enabled.
  2. The traffic is new TCP connections (TCP SYN), UDP, or ICMP echo (ping) requests.
  3. The destination is Internet egress through Cloudflare, a Cloudflare One Client, a private network via Cloudflare Tunnel, or a private network via Cloudflare Mesh.

ARR does not change routing for traffic between Cloudflare WAN connections (for example, one IPsec tunnel to another). That traffic still follows your Cloudflare WAN routes.

Benefit What it means in practice
Route-less return path For supported types, you may not need a routing table entry to return traffic to the originating tunnel or interconnect.
Symmetric routing Responses use the same WAN connection as the request — important for stateful firewalls and middleboxes.
Overlapping private IP space Return path follows learned connection state, not a shared destination prefix.
Per connection Enable ARR on each IPsec, GRE, or CNI on-ramp where you want this behaviour.

Enable Automatic Return Routing on a tunnel

Section titled “Enable Automatic Return Routing on a tunnel”
  1. Create an IPsec or GRE tunnel using the dashboard flow described under Configure Automatic Return Routing.
  2. In the tunnel options, select Automatic return routing.
  3. Save the tunnel, or create the tunnel via API with "automatic_return_routing": "true" on POST to accounts/$ACCOUNT_ID/magic/ipsec_tunnels (token needs Magic WAN Write or Magic Transit Write). See Configure routes for the example request.

Route evaluation: longest-prefix-match and Zero Trust vs WAN

Section titled “Route evaluation: longest-prefix-match and Zero Trust vs WAN”

By default, Cloudflare evaluates private network routes using longest-prefix-match. When several prefixes match a destination, the most specific prefix wins (for example, 10.0.1.0/24 beats 10.0.0.0/16 for 10.0.1.50).

Within one virtual network, each prefix may appear only once in the Zero Trust routing table. To send the same prefix to different destinations, use separate virtual networks.

Unified Routing: one table, clear precedence

Section titled “Unified Routing: one table, clear precedence”

With Unified Routing, longest-prefix-match applies consistently across connection types:

Zero Trust route WAN route 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 prefix lengths are equal, Zero Trust routes take precedence over WAN routes. For overlapping private space across sites, Cloudflare recommends enabling ARR so return traffic reaches the correct origin. Full rules are in Route evaluation with Zero Trust connections (section within traffic steering).

On Legacy Routing, Zero Trust and WAN use separate routing components. For site-to-site WAN traffic with Gateway policies, a more specific WAN route is not guaranteed to win; a Zero Trust route can take precedence regardless of prefix length. Equal prefix length always favours Zero Trust by design.

If you need predictable longest-prefix-match everywhere, Cloudflare’s recommendation is to move to Unified Routing (traffic steering).

Open Routes in the Cloudflare dashboard and read the banner:

  • Your account is using Unified Routing mode. — Unified Routing is active.
  • Unified routing is available. — Legacy Routing is active; upgrade via your account team if you need unified features.
Section titled “Related WAN routing capabilities in the cluster”

BGP peering over IPsec and GRE is generally available for Cloudflare WAN and Magic Transit on accounts using Unified Routing, with dynamic route exchange instead of manual static updates. BGP over CNI remains closed beta. Announcement: Cloudflare One changelog (BGP over IPsec and GRE tunnels generally available).

Bidirectional tunnel health checks and HA tunnels

Section titled “Bidirectional tunnel health checks and HA tunnels”

For Magic tunnels with bidirectional health checks, return packets may now traverse any tunnel in a high-availability configuration, not only the tunnel used for forward traffic — helping SD-WAN platforms such as VeloCloud that cannot steer return traffic per tunnel.

All bidirectional tunnel health check return packets are accepted by any Magic on-ramp.

— Cloudflare, Bidirectional tunnel health checks are compatible with all Magic on-ramps

Health check and traffic volume data with CMB EU

Section titled “Health check and traffic volume data with CMB EU”

Customers with CMB EU (Customer Metadata Boundary – Europe) can access GRE, IPsec, and CNI health check and traffic volume data in the dashboard and API, including GraphQL endpoints magicTransitTunnelHealthChecksAdaptiveGroups and magicTransitTunnelTrafficAdaptiveGroups. See Magic Transit and Magic WAN health check data is fully compatible with the CMB EU setting.

Network Analytics fully supports accounts on Unified Routing; tunnel traffic on unified on-ramps and off-ramps appears with the same dimensions as standard data plane traffic, with no extra configuration. See Cloudflare One changelog — Network Analytics support for Unified Routing.

Cloudflare Network Firewall on Unified Routing

Section titled “Cloudflare Network Firewall on Unified Routing”

If you use Cloudflare Network Firewall, review rule behaviour before upgrading: on Unified Routing, some IPv6-only expressions in Legacy mode may also match IPv4 unless you constrain address family (for example ip.src in {::/0}). See Unified Routing behavior changes.

Common mistakes when planning return paths and routes

Section titled “Common mistakes when planning return paths and routes”
  • Enabling ARR but expecting it to steer WAN-to-WAN site traffic — ARR does not replace WAN routes for tunnel-to-tunnel flows.
  • Relying on a more specific WAN route under Legacy Routing when Gateway policies and Zero Trust routes overlap — upgrade or adjust design.
  • Assuming ARR removes all routing work — outbound Internet traffic still uses static or BGP routes; only supported return flows use learned state.
  • Using one virtual network for two routes with the same prefix to different tunnels — split virtual networks instead (Cloudflare Tunnel routing).
  • Skipping a performance pilot before Unified Routing cutover — throughput can differ from Legacy (traffic steering — Evaluate performance).
  1. In the Cloudflare dashboard, open Routes and confirm whether the banner shows Unified Routing or Legacy (traffic steering — Check your routing mode).
  2. For each IPsec, GRE, or CNI on-ramp that should use flow-based return paths, verify Automatic return routing is enabled (Configure routes).
  3. Test a representative flow (TCP, UDP, or ICMP echo) from a WAN site and confirm return traffic stays symmetric; cross-check tunnel health if you use bidirectional checks (changelog).
  4. If you use CMB EU, query magicTransitTunnelHealthChecksAdaptiveGroups or view tunnel health in the dashboard per CMB EU compatibility announcement.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page does not match your environment or the official docs, email yimasynthetic@gmail.com with the page URL and the exact statement you want clarified.