Cloudflare WAN Connects Corporate Sites
A retail chain with 40 branches runs its own small data center in Austin and a few workloads in AWS. This is a composite scenario, not a named customer. On a Friday morning the Singapore MPLS circuit drops. Store staff keep working because the branch router has an IPsec tunnel to Cloudflare and a second tunnel to a regional hub. That is the first useful distinction in this topic: the tunnel is not the WAN. The tunnel is an on-ramp. The WAN is the private route table and forwarding fabric behind it.
Four terms make the rest of the article readable. A WAN connects sites you operate. An on-ramp is the physical or logical connection from a site to Cloudflare. A tunnel encapsulates packets between two endpoints; GRE and IPsec are the common encapsulations. Anycast means the same address is advertised from many Cloudflare locations, so traffic enters at whichever location the Internet's routing sends it to. BGP is the protocol that announces reachability, and the virtual network is the per-account overlay and route table that decides where traffic goes after it enters Cloudflare.
Cloudflare sells four things that are easy to blur together:
- Cloudflare WAN (formerly Magic WAN) is the site-to-site product. It carries private IP traffic between branches, data centers, and cloud networks. It is Enterprise-only and is positioned as a standalone WAN-as-a-service product; Cloudflare One adds identity-aware services on the same network.
- Magic Transit protects public, Internet-facing IP prefixes. It does not join two private branches. It announces your public space, scrubs and filters inbound traffic, then delivers it to your edge over a tunnel or interconnect.
- Spectrum proxies a specific TCP or UDP application; its HTTP/HTTPS application type uses the Layer 7 pipeline instead. It does not route a site's whole prefix.
- Cloudflare Network Interconnect (CNI) is not a fourth traffic class. It is a private underlay option: a direct, partner, or cloud-provided connection that replaces public Internet transit for an on-ramp.
A courier analogy helps. Cloudflare WAN is the private courier network between your offices. Magic Transit is the guarded front gate for the street address the public already knows. Spectrum is a dedicated service window for one port, such as the door marked 8883. CNI is a private driveway to the depot instead of the public road. The analogy breaks down in one important way: Cloudflare does not automatically know your private routes. You add static routes or peer BGP, and that route table is a design artifact you own.
Figure 1 shows the boundary. Every on-ramp arrow starts at a customer edge and crosses into the Cloudflare network; the virtual network then chooses an egress tunnel. The two dotted branches are the failure cases that matter most: a tunnel health check lowers a route's priority, and a private destination with no matching route is null-routed rather than leaked to the Internet.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
subgraph CE["Customer edge"]
B1["Singapore branch
10.10.0.0/16"]
B2["Frankfurt branch
10.20.0.0/16"]
DC["Austin data center
172.16.0.0/12"]
VPC["AWS VPC
10.30.0.0/16"]
end
subgraph CF["Cloudflare global network"]
VN["Virtual Network
private route table"]
FW["Network Firewall
packet policy"]
end
B1 <-->|"IPsec"| VN
B2 <-->|"GRE"| VN
DC <-->|"CNI and BGP"| VN
VPC <-->|"cloud on-ramp"| VN
VN --> FW
FW -. "allowed flows" .-> VN
VN -. "no matching route" .-> DROP["Private IP null-routed"]
VN -. "tunnel down" .-> FAIL["Priority penalty
peer tunnel takes over"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class FW primary;
class B1,B2,DC,VPC,VN,DROP,FAIL secondary;
Figure 2 separates the layers and the ownership boundary. Routed IP services sit above the underlay; Spectrum sits beside them at Layer 4, not above them.
Magic Transit Protects Routed IP Networks
Suppose the retailer owns 203.0.113.0/24 and AS64496. Magic Transit turns that prefix into a globally distributed front door. The sequence is worth tracing because each step has a different owner.
- Bring your own IP. Cloudflare needs an IP prefix entry and a letter of authorization, plus a BGP prefix entry that controls what is actually announced. Cloudflare accepts a
/24or a larger aggregate (for example, a/20), but not a longer prefix such as/25, because it is not globally routable. Cloudflare documents that each BGP prefix is billed separately, even when prefixes overlap. - Announce. Cloudflare originates the prefix from its anycast network. If you supply your own ASN, Cloudflare prepends
AS13335, so a peer sees13335 64496. Cloudflare's documentation says new onboardings must useAS13335; existingAS209242deployments can continue. - Ingress. A user's packet to
203.0.113.10lands at whichever Cloudflare data center the Internet selects. That may not be the geographically closest one, because anycast follows BGP and peering, not a map. - Filter. DDoS mitigation runs first. Cloudflare Network Firewall then applies packet rules written in a Wireshark-like rules language. Network Firewall is available with a Magic Transit or Cloudflare WAN purchase, and it is Enterprise-only. Its rules also apply to ICMP, so an allowlist that blocks Cloudflare's probe addresses will make health checks fail.
- Deliver. Cloudflare sends the packet to your edge through GRE, IPsec, or CNI. You then choose whether the return path also comes back through Cloudflare.
That last choice is the architectural fork. The table compares the two common implementations.
| Decision | Ingress-only (Direct Server Return) | Ingress and egress |
|---|---|---|
| Return path | Origin replies through its ISP | Origin replies through the Cloudflare tunnel |
| Tunnel requirement | Ingress tunnel only; no return policy needed | Policy-based routing or a default route toward Cloudflare |
| What Cloudflare sees | Inbound traffic only; replies are invisible | Both directions of the flow |
| Failure behavior | ISP return failure is outside Cloudflare's health checks | Return tunnel failure breaks established sessions |
| Best fit | DDoS protection without changing egress | Consistent filtering, inspection, or egress control |
Figure 3 traces both return paths and the failure branch. The important detail is that a health check can lower a route's priority without withdrawing the BGP advertisement; the prefix can still be announced while delivery is broken.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
sequenceDiagram
autonumber
participant C as Client
participant E as Cloudflare anycast edge
participant F as Network Firewall
participant T as GRE / IPsec / CNI
participant O as Origin network
C->>E: Packet to 203.0.113.0/24
Note over E: Prefix announced with BGP
E->>F: DDoS scrub and packet policy
F->>T: Allowed packet
T->>O: Encapsulated delivery
alt Ingress only (DSR)
O-->>C: Return via ISP
Note over O,C: Cloudflare sees one direction only
else Ingress and egress
O-->>T: Return through tunnel
T-->>E: Decapsulate
E-->>C: Return via Cloudflare
end
Note over E,T: Probe failure lowers route priority
Note over E: All tunnels down: blackhole while BGP stays up
The product boundary is narrower than the marketing page suggests. Magic Transit protects public address space that you can advertise and onboard. It does not make a private RFC 1918 network public, it does not replace Cloudflare WAN for site-to-site routing, and it is not available in Cloudflare's China network. Plan availability is contractual: the /24 minimum, the per-prefix billing, and the Enterprise requirement are all real constraints. Confirm current commercial terms rather than treating this paragraph as a price list.
Spectrum Proxies Supported TCP and UDP Services
Now consider a different problem. An industrial IoT fleet publishes telemetry to an MQTT broker on TCP 8883, and the broker must stay reachable without exposing its origin address. Spectrum is the relevant product, but its contract is precise: it is a global TCP and UDP proxy. It terminates the TCP and UDP sockets in both directions at Layer 4, then passes the payload through unchanged. It does not inspect, modify, or upgrade the application protocol. Custom TCP/UDP applications require an Enterprise plan with Spectrum as a paid add-on, and some individual features are also Enterprise-gated.
That single sentence settles most design questions:
- Spectrum cannot add HTTP headers, apply WAF rules, cache content, or convert HTTP to HTTPS. If you need those behaviors, the application type must be HTTP/HTTPS, which sends traffic through Cloudflare's Layer 7 pipeline instead of a direct L4 proxy connection.
- TLS still terminates at your broker, or at a load balancer you control. Spectrum is not a TLS terminator in the application-layer sense, and it does not provide application authentication.
- All TCP ports are supported. UDP applications are supported with BYOIP, but Cloudflare drops fragmented UDP packets at the edge. ICMP is not a Spectrum application.
- The assigned IPv4 and IPv6 addresses are anycast and are not static; the documented way to find them is the application's DNS name. An account is limited by default to 10 unique Spectrum hostnames backed by Cloudflare-managed IPv4 addresses. BYOIP, IPv6-only applications, or CNAMEs to one application can change that math.
- IP Access rules can allow or block by IP address, IP block, country, or ASN. Custom WAF rules do not work with Spectrum applications. Proxy Protocol can preserve the client IP, but it is not supported with Cloudflare Tunnel virtual-network origins or Private Network Load Balancing.
A bounded design starts by asking what the application actually needs. If the requirement is "hide the origin and absorb L3/L4 floods for one TCP or UDP service," Spectrum fits. If the requirement is "join the broker's private network to 40 branch prefixes," that is Cloudflare WAN. If the requirement is "publish a website with header inspection and bot scoring," that is the HTTP proxy path, not Spectrum. Mixing those jobs is how teams end up buying an L4 proxy and then discovering that it cannot see the thing they wanted to filter.
For a private origin, Spectrum can use a Cloudflare Tunnel virtual network, but the origin must be a single private IP routable in that virtual network. Port ranges, hostname origins, multiple direct addresses, and Proxy Protocol are not supported in that mode. Those are documented limits, not tuning knobs.
Spectrum hides an origin and absorbs network-layer floods; it does not make an insecure service secure. TLS, authentication, authorization, patching, and application-level rate limiting remain your responsibility, and fragmented UDP or ICMP traffic will not be proxied the way a generic "L4 firewall" pitch might imply.
Interconnect, BYOIP, and Routing Responsibilities
Figure 4 compares a public Internet on-ramp with a private interconnect and shows the failure path that operators most often miss: the return direction. CNI changes the underlay, not the routing policy. You still choose prefixes, priorities, and return paths. Transit here means the middle mile between your edge and Cloudflare's edge: shared public Internet paths in the first case, a dedicated private path in the second.
CNI comes in three commercial shapes: a direct fiber cross-connect in a shared data center, a partner interconnect through a connectivity provider, and a cloud interconnect from a provider such as AWS or Google Cloud. The dataplane matters as much as the sales motion. Dataplane v1 peers with a Cloudflare edge and uses GRE to reach the virtual network; it supports peering, but only at the connected point of presence. Dataplane v2 uses a Customer Connectivity Router, removes GRE, and documents a 1,500-byte MTU bidirectionally. WAN and Magic Transit with egress work natively on v2; on v1 they need a GRE tunnel over the circuit. Check the location's dataplane before promising a design.
BYOIP is the other shared responsibility. You keep ownership of the prefix and must keep the letter of authorization, Internet Routing Registry entries, and RPKI route origin authorizations consistent with what you submit. Cloudflare announces the prefix. Service bindings decide whether traffic to a given address goes to the CDN, Spectrum, or Magic Transit; address maps decide which addresses DNS returns for proxied records. A mismatch here produces the confusing failure where the route is correct but the packet is delivered to the wrong product.
The responsibility split is easier to remember as three groups. You own prefix rights, origin reachability, return-path policy, MSS/MTU, application security, and origin capacity. Cloudflare owns anycast announcement, DDoS scrubbing, packet filtering when purchased, tunnel and interconnect termination, health probes, and route selection inside the virtual network. Both sides own failover testing, BGP change control, and observability. Most incidents live in the shared group.
Four failure modes deserve explicit test cases.
Asymmetric routing. DSR is asymmetric by design: ingress comes through Cloudflare, egress goes through the ISP. That is fine for stateless packet delivery, but a stateful firewall, NAT, or flow-based analytics device that sees only one direction will behave unpredictably. The same problem appears when some prefixes use egress-through-Cloudflare and others use DSR. Decide flow symmetry per application, not per product.
BGP flaps. A flapping route creates churn, and mixing control planes makes it worse. Cloudflare documents that you should use only one advertisement control method per prefix. Mixing API advertisement with BGP peering, or with Network Flow thresholds, can leave the control plane and the data plane disagreeing. Remember the tie-breaks too: lower priority values win, longest prefix match wins, and a static route beats a BGP route at the same prefix and priority.
MTU issues. GRE adds 24 bytes of overhead; on a 1,500-byte underlay, the inner IP packet has 1,476 bytes, and TCP MSS must be clamped. Cloudflare's Magic Transit getting-started guidance sets a 1,436-byte TCP MSS clamp on transit ports for an ingress-only deployment, with a lower value for IPsec. If ICMP is blocked, path MTU discovery fails and you get the classic symptom: small requests and TLS handshakes work, bulk transfers stall. CNI Dataplane v2's 1,500-byte MTU avoids GRE overhead, but it does not rescue an application that already sends oversized datagrams.
Stale failover. Cloudflare WAN marks a tunnel degraded when at least 0.1% of health checks fail in the previous five minutes, with at least two failures, and marks it down when all probes of at least three samples in the last second fail. A priority penalty then shifts traffic. But the BGP advertisement may remain, and endpoint health checks do not influence steering. If every tunnel is down, the prefix can still be advertised and traffic is blackholed. Test the all-tunnels-down case, not just the single-tunnel case.
Draw a Branch, Data-Center, and Cloud Connectivity Design
This exercise is design-only. No Cloudflare account, tunnel, prefix, or Spectrum application was provisioned, and no latency, throughput, or convergence measurement was taken. It is a tabletop design you can reproduce on paper or in a diagramming tool, then validate later in a vendor-approved lab.
Draw a Branch, Data-Center, and Cloud Connectivity Design
Status: Design-only; no hosted validation.
Prerequisites: An Enterprise commercial path or a quote for Cloudflare WAN, Magic Transit, Spectrum, and CNI; a public /24 you control or a Cloudflare leased-IP option; an ASN or agreement to use AS13335; two routers per critical site; the current Cloudflare docs; and a worksheet with columns for prefix, next hop, priority, return path, and owner.
Inputs: 40 branches, two data centers, three cloud VPCs, and one public /24. Use these controlled values throughout so every worksheet row refers to the same design:
| Site or resource | Prefix | On-ramp in this design |
|---|---|---|
| Singapore branch | 10.10.0.0/16 | IPsec |
| Frankfurt branch | 10.20.0.0/16 | GRE |
| Austin data center | 172.16.0.0/12 | CNI and BGP |
| AWS VPC | 10.30.0.0/16 | Cloud on-ramp |
| Public service | 203.0.113.0/24 | Magic Transit |
Actions:
- Classify every flow as private site-to-site, public inbound, or a single TCP/UDP application. Write the classification down before choosing a product.
- Assign an on-ramp per site: IPsec for a branch, GRE or CNI for a data center, a cloud on-ramp for a VPC. Record why each was chosen.
- Build the virtual-network route table. For each prefix, write the next hop, priority, and optional weight. Lower priority wins; equal priorities use ECMP; longest prefix match wins; static beats BGP at the same prefix and priority.
- Choose Magic Transit behavior for
203.0.113.0/24: ingress-only DSR or ingress-plus-egress. Draw the return path on the same diagram. - Attach Spectrum only to the MQTT
8883flow. Mark what Spectrum does not inspect: TLS, MQTT authentication, and application authorization. - Budget MTU. Start at a 1,500-byte underlay, subtract 24 bytes for GRE, and record the MSS clamp. Mark every firewall that must allow ICMP for path MTU discovery.
- Define BGP ownership: prefix, origin AS, one control method, withdrawal procedure, and who maintains the LOA, IRR entry, and ROA.
- Build a failure matrix with six rows: one tunnel down, all tunnels down, BGP withdrawn, ISP return down, MTU blackhole, and stale DNS or stale advertisement.
Expected observations: Every flow has a named on-ramp and a named return path. Every critical flow has at least one tested alternate. No flow depends on a single tunnel. The Spectrum flow is visibly L4-only. The advertised prefix state and the delivery state are checked separately.
Failure checks: Remove the highest-priority tunnel and confirm the route shifts. Withdraw the BGP prefix and confirm traffic stops, then re-announce it and confirm it returns. Send a 1,500-byte IP packet with the DF bit set through GRE and confirm the expected drop. Break the ISP return path under DSR and confirm which sessions survive. Check that an endpoint health check failure does not change steering.
Cost dimensions: Enterprise plan commitments; per-BGP-prefix Magic Transit billing, including overlapping prefixes; CNI port, partner, or cloud-circuit fees; Spectrum add-on and IPv4 hostname quota; egress; and engineering time for change control. Confirm every number in a current quote.
Cleanup: No resources were created, so archive the worksheet and diagrams. If you repeat this in a sandbox, delete tunnels, static routes, BGP prefixes, Spectrum applications, and interconnect attachments, then verify that no prefix is still advertised.
Trace Traffic Direction and Mark Enterprise Prerequisites
Use pass/fail evidence rather than a product checklist. You pass if you can point to the route-table entry and the return path for every flow. You pass if a single tunnel failure has a documented alternate and an owner. You pass if BGP advertisement and packet delivery are tested as separate failure domains. You pass if MTU is validated with DF packets, not inferred from a successful ping. You fail if "Cloudflare handles failover" is the only answer, if Spectrum is expected to inspect HTTP, or if Magic Transit is expected to protect a private /16.
Self-check.
- A branch has two IPsec tunnels with priorities
100and200, and tunnel 1 fails. Does BGP withdraw the prefix? Not necessarily. The health check lowers the route priority and steers traffic to tunnel 2, but the advertisement can remain. If both tunnels fail, the prefix may still be announced and traffic is blackholed. - Why does a 1,500-byte packet fail over GRE while a small ping succeeds? GRE consumes 24 bytes, the inner packet exceeds the path MTU, and blocked ICMP prevents path MTU discovery. The fix is an MSS clamp and an ICMP policy that permits the probes.
- Which product fits an MQTT broker on TCP
8883, and what remains yours? Spectrum fits the L4 proxy role; TLS, MQTT authentication, authorization, patching, and origin capacity remain yours.
Unresolved limitations. This article was verified against Cloudflare documentation on 2026-11-05, with a planning baseline of 2026-11-02. No hosted lab was executed, so no convergence time, throughput, or packet-loss figure is claimed. Pricing, plan gating, regional availability, CNI dataplane availability, and Unified Routing or beta status can change; confirm them at purchase. Magic Transit's China limitation and third-party router interoperability were not tested here. Spectrum's protocol-per-plan matrix and IPv4 hostname quota are documented but commercially variable.
References.
- Cloudflare WAN: https://developers.cloudflare.com/cloudflare-wan/
- Cloudflare One product name updates, 17 February 2026: https://developers.cloudflare.com/changelog/post/2026-02-17-product-name-updates/
- Cloudflare WAN traffic steering: https://developers.cloudflare.com/cloudflare-wan/reference/traffic-steering/
- Cloudflare WAN tunnel health checks: https://developers.cloudflare.com/cloudflare-wan/reference/tunnel-health-checks/
- Magic Transit overview: https://developers.cloudflare.com/magic-transit/about/
- Magic Transit prefix advertisement: https://developers.cloudflare.com/magic-transit/how-to/advertise-prefixes/
- Magic Transit traffic steering: https://developers.cloudflare.com/magic-transit/reference/traffic-steering/
- Magic Transit GRE and IPsec tunnels: https://developers.cloudflare.com/magic-transit/reference/gre-ipsec-tunnels/
- Cloudflare Network Interconnect: https://developers.cloudflare.com/network-interconnect/
- Spectrum configuration options: https://developers.cloudflare.com/spectrum/reference/configuration-options/
- Spectrum limitations: https://developers.cloudflare.com/spectrum/reference/limitations/
- Cloudflare Network Firewall: https://developers.cloudflare.com/cloudflare-network-firewall/
- Cloudflare BYOIP: https://developers.cloudflare.com/byoip/
Next in the Series
In Connect Cloudflare to AWS, Azure, and Private Services, we'll explore Keep delivery, private connectivity, and cloud ownership explicit.