CH 17 / 50Chapter 3: Zero Trust

What Is Cloudflare Tunnel? Publishing Without Opening Ports

On this page11 items

On the previous page, I noted that Access is only effective if the origin (the server being protected) isn’t exposed directly. Cloudflare Tunnel is what makes that possible. It lets you publish servers and NAS devices through Cloudflare without opening ports on your router, and among home-server enthusiasts it’s one of Cloudflare’s most popular features.

This page starts with what’s dangerous about opening ports in the first place, then looks at how Tunnel eliminates that problem at its root.

What you’ll learn on this page#

  • What port forwarding is and why it’s dangerous
  • How Tunnel works (why outbound connections alone are enough to publish)
  • What you can publish (web apps, SSH, private networks)
  • The standard setup combined with Access
  • Pricing and points for beginners to watch out for

What port forwarding is and why it’s dangerous#

“Punching a hole in the wall” so traffic can reach you#

When you wanted to use your home NAS or server from outside, the traditional approach was port forwarding on your router. A router normally blocks all traffic coming from outside in. Port forwarding punches a hole in that wall: “forward traffic arriving on port 443 to the NAS”.

This gets the job done, but at a price. The hole you open is equally visible to your friends and to attackers.

  • You’re constantly being scanned: scans that mechanically sweep the entire internet looking for “open ports” run 24 hours a day, 365 days a year. From the moment you publish, your NAS login screen becomes a target for brute-force attacks from all over the world
  • Vulnerabilities become fatal: when a vulnerability is found in an exposed device or piece of software, you stay defenseless until you apply the patch. Many ransomware attacks targeting NAS products come through this route
  • Your home IP address is exposed: you end up registering your home connection’s IP address directly in DNS, revealing your “location on the internet”, if not your street address

How Cloudflare Tunnel works#

“Placing a call” from the inside out#

Tunnel solves this problem by “never opening any hole for traffic coming in”. The key is the direction of the connection.

When you install a small program called cloudflared on your server or NAS, cloudflared makes an outbound connection from the server to Cloudflare’s network and keeps that connection alive. Routers and firewalls generally allow traffic from inside to outside, so no configuration changes are needed.

Think of it as calling Cloudflare from your end and staying on the line without hanging up. When an outside user visits your site (for example, nas.example.com), the request first reaches Cloudflare, and Cloudflare relays it to your server over this “call that’s still connected”. The response comes back the same way. Because two-way communication is possible over an established connection, you can publish without opening a hole from outside.

The difference between port forwarding and Tunnel

This setup achieves all of the following at once:

  • All router ports stay closed. Scanning finds nothing
  • Only Cloudflare’s addresses appear in DNS, and your home IP address isn’t published
  • Since all access always passes through Cloudflare, the WAF, DDoS protection and bot protection from Chapter 2, along with Access from the previous page, are reliably applied (attacks that bypass the proxy and hit the origin directly become impossible in principle)

Also, cloudflared connects redundantly to multiple Cloudflare data centers, so it’s built not to drop because of a single connection or a single site failing.

What you can publish and connect#

It’s not just websites that you can route through Tunnel.

  • Web apps (HTTP/HTTPS): your NAS admin screen, web apps on your home server, sites under development, and so on. This is the most basic use
  • SSH and RDP: remote server administration (SSH) and remote desktop (RDP) can also go through the tunnel, protected by Access authentication
  • An entire private network: rather than “publishing” a specific app, you connect the whole address range of your home or office network to Cloudflare through the tunnel, so it’s reachable only from devices running WARP. This replaces traditional site-to-site VPNs (WARP is covered two pages from now)

These days the standard way to set up a tunnel is to create and manage it in the Cloudflare One dashboard (remote management). The older method of managing it with a configuration file on the server (config.yml) still exists, but beginners are better off starting with the dashboard method.

The standard setup: Tunnel + Access#

Tunnel is only a “communication path”; it doesn’t decide who gets through. A URL published through a tunnel can be opened by anyone as it stands. That’s why the standard approach is to combine it with Access from the previous page.

  1. Use Tunnel to connect nas.example.com to your NAS admin screen (no open ports, IP not published)
  2. Protect nas.example.com with Access and Allow only your own email address

This completes the basic Zero Trust pattern: “hide the path, authenticate at the entrance”. Both fall within Cloudflare One’s Free plan (free for up to 50 users), and using Tunnel itself is free (as of August 2026).

Points for beginners to watch out for#

  • Tunnel alone has no authentication: to repeat, anyone can access it the moment you publish it. When routing admin screens and the like, always set up Access alongside it
  • You need a domain: to publish a tunnel under a name, you need a domain managed in Cloudflare (the domain and DNS knowledge from Chapter 1 applies directly). For trying things out, there’s also Quick Tunnels (trycloudflare.com), which issues a temporary URL without needing a domain
  • Don’t forget to update cloudflared: since it’s a program that runs constantly on the server, it needs updating like any other software. Many NAS guides run it in a container (Docker), so it’s easiest to fold it into your container update routine
  • Check the terms for what you route: if you deliver large amounts of video or large files through Cloudflare’s proxy, including Tunnel, pay attention to the terms of use for each plan and service (the same thinking mentioned on the CDN page in Chapter 1)
  • If your connection goes down, it’s unreachable: naturally, if the home or office connection or server behind the tunnel stops, it can’t be accessed. Tunnel is a mechanism for a safe path, not for availability

Related services#

  • Cloudflare Access: the authentication gatekeeper used together with Tunnel (previous page)
  • WARP (Cloudflare One Client): the device-side component for private network connections (two pages from now)
  • Cloudflare’s proxy: the “always go through Cloudflare” idea that Tunnel is built on (Chapter 1)
  • DNS: routing to the tunnel is done with DNS records (Chapter 1)

Summary#

  • Port forwarding opens “a hole to let traffic in”, which brings the risks of constant scanning, vulnerability attacks and IP exposure
  • With Tunnel, cloudflared on the server keeps an outbound connection to Cloudflare open, making publishing possible without opening a hole
  • Ports stay fully closed and your IP stays private, and the path always gets Cloudflare’s defenses such as WAF and Access applied
  • Besides web apps, you can also connect SSH, RDP and entire private networks
  • Tunnel is free. “Hide the path with Tunnel, guard the entrance with Access” is the standard setup

Read next#