Traffic steering (3)
Last updated Oct 12, 2026
Magic Transit Virtual Network routing table
When traffic enters Cloudflare's network, it needs to reach the correct destination in your infrastructure — a specific data center, office, or cloud environment. Traffic steering controls how Cloudflare makes these routing decisions.
The Magic Transit Virtual Network is a virtual network overlay, private to your account, that spans all Cloudflare data centers globally. This overlay network provides:
- Magic Transit delivery for Denial of Service (DoS) and Cloudflare Network Firewall filtered Internet traffic, from the entry data center where the traffic ingressed, to your publicly addressed edge/border network.
- Magic Transit packet transport between IPsec/GRE tunnels, interconnects, Cloudflare Load Balancer, and Zero Trust connections such as Cloudflare One Client, Remote Browser Isolation, Access, and Gateway.
The Magic Transit Virtual Network supports routing the Magic Transit traffic through anycast tunnels using GRE and Internet Protocol Security (IPsec) or CNI with Dataplane v2. You can add entries to the Magic Transit Virtual Network routing table through static route configuration or through routes learned through BGP peering.
Allowed IP ranges
The following IPv4 address ranges are allowed in the Magic Transit Virtual Network routing table:
- BYOIP public address space which you have onboarded to Cloudflare Magic Transit.
- Cloudflare leased IPs assigned to your account.
Default routing
If traffic does not match any route you have configured in the virtual network, Cloudflare applies default behavior based on the destination address type:
- Public (Internet-routable) addresses: Traffic exits to the Internet.
- Private addresses (RFC 1918 ↗︎ or CGNAT/RFC 6598 ↗︎): Traffic is dropped (null routed), because private addresses are not routable on the public Internet and Cloudflare has no path to deliver them without a matching route.
Route prioritization
Magic Transit steers traffic along tunnel routes based on route entry priorities.
- Lower values have greater priority.
- When the priority values for prefix entries match, Cloudflare uses equal-cost multi-path (ECMP) packet forwarding to route traffic. You can apply an optional weight value to static routes to modify ECMP tunnel distribution.
- Cloudflare routing applies longest-prefix match. A more specific static route (like
/30) always takes precedence over a less specific one (like/29), regardless of tunnel priority — unless you remove the more specific route. - When BGP and static routes have the same prefix and priority, Cloudflare enforces priority by preferring static routes over BGP routes. This ensures that manually configured static routes take precedence unless you explicitly deprioritize them.
Set priority and weights for static routes
The priority value for static routes is directly configured as part of the route object in the Cloudflare dashboard or through the API. For example:
| Prefix | NextHop | Priority |
|---|---|---|
10.10.10.100/24 |
TUNNEL_1_IAD |
200 |
10.10.10.100/24 |
TUNNEL_2_IAD |
200 |
10.10.10.100/24 |
TUNNEL_3_ATL |
100 |
10.10.10.100/24 |
TUNNEL_4_ATL |
100 |
In this example, tunnels with priority of 100 are preferred to tunnels with priority of 200 because lower numbers have greater priority.
Optionally, you can assign weights to distribute traffic more effectively among multiple tunnels. Weight values determine traffic proportion, with higher weights receiving more traffic. The maximum weight value is 256.
In the following example, TUNNEL_2_IAD is likely to receive twice as much traffic as TUNNEL_1_IAD.
| Prefix | NextHop | Priority | Weight |
|---|---|---|---|
10.10.10.100/24 |
TUNNEL_1_IAD |
100 |
64 |
10.10.10.100/24 |
TUNNEL_2_IAD |
100 |
128 |
10.10.10.100/24 |
TUNNEL_3_ATL |
100 |
192 |
10.10.10.100/24 |
TUNNEL_4_ATL |
100 |
255 |
Aside from priority, scoping static routes to specific geographic regions also impacts how traffic is steered. Refer to Scoping routes to specific regions for more details.
Set priority for BGP routes
When BGP advertises a route, Cloudflare automatically adds it to the Magic Transit Virtual Network routing table with a default priority of 100 which applies to all regions. However, if a static route exists with the same prefix and priority, the static route always takes precedence over the BGP route. Set a different priority for static routes (more or less than 100) depending on which you want to prioritize. Lower values have greater priority.
Additionally, when multiple BGP routes exist with the same prefix length and priority, ECMP distributes traffic across them using equal-cost multi-path (ECMP) routing.
Change route priorities with BGP attributes
Cloudflare supports traffic engineering through BGP communities and AS prepending. You can use these traffic routing techniques to set route priorities and perform traffic engineering across multiple interconnects.
BGP communities for setting route priority
The default BGP route priority is 100. This base priority can be adjusted using communities. For example, when a route is tagged with the community 13335:60010 its priority is set to 10. This makes it a higher priority than the default of 100 because lower numeric priorities are preferred.
The community values supported for setting base route priority are:
13335:60010: Set base route priority to1013335:60050: Set base route priority to50UNSET: Set base route priority to10013335:60150: Set base route priority to15013335:60200: Set base route priority to20013335:60901: Set base route priority to50100013335:60902: Set base route priority to1001000
Setting multiple base priority communities in the same prefix update message is a misconfiguration. In this situation, Cloudflare prefers the highest priority (lowest integer value).
AS path prepending for adjusting route priority
For each additional mention of your ASN in the received AS path, Cloudflare adds 10 to the route's base priority. By increasing the priority number, the route becomes less preferred.
For example, if your ASN is 65000 then the BGP UPDATE to Cloudflare will be:
# No change to base priority.
AS_PATH: 65000 65200
# Add 10 to base priority for 1 prepend of 65000
AS_PATH: 65000 65000 65200
# Add 20 to base priority for 2 prepend of 65000
AS_PATH: 65000 65000 65000 65200
How communities and prepends work together
Cloudflare adjusts route priority when using AS prepending with communities. For example, if a route is tagged with 13335:60150, the base priority is set to 150. If you prepend your ASN twice, Cloudflare adds 10 for each prepend, increasing the route priority to 180.
Unified Routing mode
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.
In the 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.
Compare routing modes
Unified Routing is generally available and is our recommended routing mode for all new accounts.
| Area | Legacy Routing | Unified Routing |
|---|---|---|
| Routing fabric | Evaluates Magic Transit routes independently from Cloudflare One routes. | Uses one routing fabric across all supported connection types. |
| Route selection | Applies longest-prefix match within the Magic Transit routing table. | Applies longest-prefix match across supported connection types. |
| Cloudflare One integration | Uses separate routing systems for Magic Transit and Cloudflare One connections. | Uses one routing system for Magic Transit and Cloudflare One connections. |
| BGP over CNI | Closed beta and not available to new customers. | Closed beta and not available to new customers. |
| IPv6 | Beta for Magic Transit only. | Beta for Cloudflare WAN and Magic Transit. |
Use features available only with Unified Routing
The following features require Unified Routing.
| Feature | Availability with Unified Routing |
|---|---|
| BGP over IPsec and GRE | Generally available. |
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. |
| 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) | Not available for Magic Transit. |
| 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:
- Evaluate Unified Routing features and performance against your current needs. Review the routing mode comparison, feature availability, and performance guidance.
- If you use Cloudflare Network Firewall, review Unified Routing behavior changes and update any affected rules.
- Identify suitable times for the upgrade. During the upgrade, Cloudflare One Client users can experience a remote access outage of up to three minutes.
- Contact your account team to request the change and provide a range of acceptable times.
