Cloudflare Tunnel
A secure tunnel from your machine to Cloudflare — no public IP, no open ports, no exposed server.
What is Cloudflare Tunnel?
Cloudflare Tunnel lets you publish a service running on your own computer or private network to the internet — safely — without giving it a public IP address or opening holes in your firewall.
You run a tiny program called cloudflared. Instead of waiting for visitors to connect in, it makes an outbound connection from your machine up to Cloudflare. Visitors reach Cloudflare, and Cloudflare passes their requests down through that tunnel to your service.
Think of it like…
A private valet who walks out to greet guests and escorts them in — instead of leaving your front door unlocked. Your house never has to expose an entrance to the street.
Why use it?
Traditionally, to make a home server or office app reachable from the internet you'd need a public IP, port forwarding, and inbound firewall rules — each one a security risk and a hassle. Tunnel removes all of that.
No open ports
You can block all inbound traffic at the firewall and still stay reachable.
No public IP needed
Works behind home routers, CGNAT, or dynamic IPs that change all the time.
Hidden origin
Your server's real IP is never exposed, so attackers can't target it directly.
Free HTTPS
Cloudflare terminates TLS at its edge, so your public URL is encrypted automatically.
When should you use it?
Home lab / self-hosting
Publish a Raspberry Pi app, NAS, or hobby project without router config.
Local dev demos
Share a localhost site with a client or teammate via a real public URL.
Internal tools
Reach an internal dashboard or database without a full VPN setup.
SSH / RDP
Securely reach machines for remote admin without exposing those ports.
How to create a tunnel
There are two ways: the dashboard (remotely-managed, beginner-friendly) or the command line. Here's the classic CLI flow once cloudflared is installed.
Install cloudflared
Install the connector daemon on the machine running your service (macOS example shown).
# macOS (Homebrew) brew install cloudflared # or download a binary for Linux/Windows from CloudflareLog in
This opens a browser to authorize cloudflared and pick which domain the tunnel belongs to.
cloudflared tunnel loginCreate the tunnel
Give it a name. Cloudflare generates a unique tunnel ID and a credentials file on your machine.
cloudflared tunnel create my-tunnelRoute a hostname to it
Create the DNS record so app.example.com points at your tunnel.
cloudflared tunnel route dns my-tunnel app.example.comMap your local service
In ~/.cloudflared/config.yml, point the hostname at your local service (e.g. a site on localhost:8080).
tunnel: my-tunnel credentials-file: /Users/you/.cloudflared/<TUNNEL-ID>.json ingress: - hostname: app.example.com service: http://localhost:8080 - service: http_status:404 # catch-all, requiredRun it
Start the tunnel. Your local service is now live at https://app.example.com. Later, install it as a service so it runs on boot.
cloudflared tunnel run my-tunnel # run automatically on startup (Linux/macOS): # sudo cloudflared service install
Key concepts
cloudflared
The lightweight daemon (background program) that creates and maintains the tunnel.
Tunnel
A persistent object with a unique UUID linking your origin to Cloudflare.
Outbound-only
cloudflared dials out to Cloudflare; nothing ever connects inbound to you.
Ingress rules
The config that maps each public hostname to a local service.
Connector
Each running cloudflared process; you can run several for redundancy.
Remotely-managed
Configure the whole tunnel from the Zero Trust dashboard, no local config file.
Tips & billing
Add a login wall with Access
Pair Tunnel with Cloudflare Access to require a login (Google, GitHub, email PIN) before anyone can reach your service — perfect for private internal tools.
- cloudflared and Cloudflare Tunnel are free to use.
- Block all inbound ports on your firewall once the tunnel works — outbound-only is the whole point.
- Run cloudflared as a system service so the tunnel survives reboots.
- The dashboard (remotely-managed) flow is the easiest start; the CLI gives you more control via config.yml.
Related products
menu_bookOfficial docsopen_in_new