Cloudflare Tunnel Expose Homelab: No Open Ports Guide
This guide shows you how to cloudflare tunnel expose homelab services so you can reach them from anywhere without opening a single port on your router. A Cloudflare Tunnel is a small program called cloudflared that runs on your home server and keeps an outbound connection open to Cloudflare. When you visit your domain, Cloudflare sends the request down that connection, so your router never has to accept inbound traffic. You get a public address for Jellyfin, Immich, Home Assistant, or anything else you run, with no port forwarding. The whole setup takes about twenty minutes, and the tunnel itself costs nothing.
How a Cloudflare Tunnel Works
Normal remote access works the other way round. You open a port on your router, point it at your server, and hope nobody scans it. A tunnel flips that around. The cloudflared program on your server dials out to Cloudflare and holds the connection open. Inbound requests arrive at Cloudflare first, then travel back down that same outbound link to your server. Your router never listens on a public port, and your home IP address never shows up in DNS, because visitors only ever see Cloudflare addresses.
Cloudflare also ends the TLS connection at its edge, so you get a valid certificate for your subdomain without running certbot or renewing anything yourself. This is the same idea behind a zero trust tunnel: nothing on your network is reachable unless a tunnel you control says it is.
What You Need Before You Start
You need four things. First, a domain whose DNS is managed by Cloudflare, which is free to set up. Second, a Linux machine that stays on at home, such as a mini PC, an old laptop, or a Raspberry Pi. Third, at least one service already running on that machine, on a local port you can reach from the machine itself. Fourth, a Cloudflare account, also free.
If you are still planning the hardware, our homelab starter build guide covers what is worth buying and what you can skip. You do not need a static IP, and you do not need to touch your router settings. That is the whole point: a tunnel gives you homelab remote access without asking your router to do anything new. If you want the full picture of how tunnels compare with self-hosted options, read our comparison of Cloudflare Tunnel, Nginx Proxy Manager, and Traefik before you pick one.
Cloudflare Tunnel Expose Homelab: The Setup in Five Steps
The setup has five steps: install cloudflared, log in and create the tunnel, point a DNS record at it, write a small config file, and run it as a service so it starts on boot. Do them in order, and test after step five.
Step 1: cloudflared install. On Debian or Ubuntu, download the package from the Cloudflare GitHub releases page and install it:
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o cloudflared.deb
sudo dpkg -i cloudflared.deb
cloudflared --version
For other systems, Cloudflare publishes packages for most Linux distributions, plus Docker images and binaries for macOS and Windows.
Step 2: Log in and create the tunnel. Run the login command and follow the link it prints to pick your Cloudflare account in the browser:
cloudflared tunnel login
Then create the tunnel and give it a name you will recognise:
cloudflared tunnel create homelab
This writes a credentials file into ~/.cloudflared/ and prints a tunnel ID. Keep that ID handy, you need it in the config file.
Step 3: Route a DNS name to the tunnel. Pick a subdomain for the first service you want to share, for example jellyfin.example.com, and attach it to the tunnel:
cloudflared tunnel route dns homelab jellyfin.example.com
This creates a CNAME record in your Cloudflare DNS that points at the tunnel. You can add more subdomains to the same tunnel later, one per service. No port forwarding is involved at any point, which is why this method is often called the no port forwarding way to share a homelab.
Step 4: Write the config file. Create ~/.cloudflared/config.yml with the tunnel ID from step two and one ingress rule per service:
tunnel: 11111111-2222-3333-4444-555555555555
credentials-file: /home/user/.cloudflared/11111111-2222-3333-4444-555555555555.json
ingress:
- hostname: jellyfin.example.com
service: http://localhost:8096
- hostname: home.example.com
service: http://192.168.1.50:8123
- service: http_status:404
Replace the tunnel ID and the paths with your own values. Each hostname maps to a local address, which can be localhost or another machine on your home network. The last rule is a catch-all that returns a 404 for any hostname with no rule.
Step 5: Run it as a service. Install the systemd unit and start it:
sudo cloudflared service install
sudo systemctl enable cloudflared
sudo systemctl start cloudflared
Check that it is running and connected:
sudo systemctl status cloudflared
cloudflared tunnel info homelab
If the status shows active and the tunnel info lists healthy connections, open https://jellyfin.example.com in a browser. Your service should load over HTTPS with a valid certificate, and your router still has zero ports open.
Point the Tunnel at Services on Your LAN
One tunnel can carry many services, so to cloudflare tunnel expose homelab apps beyond the first one, add a DNS route and an ingress rule for each, then restart cloudflared. A typical homelab ends up with a handful of subdomains for media, photos, home automation, and files. Because the config maps hostnames to local addresses, services on other machines in your house work too, as long as the cloudflared machine can reach them on the local network.
Keep the catch-all 404 rule at the bottom of the ingress list. Rules are matched top to bottom, so a missing catch-all means an unmatched hostname can fall through in ways that are hard to debug. Each service also keeps its own login. The tunnel gives you a public door, it does not add a password to services that have none, so turn on authentication inside each app before you share it.
What the Free Tier Covers
The tunnel itself is free, with no charge for the connection or for the bandwidth that passes through it. Tunnels sit under Cloudflare Zero Trust, whose free tier covers small teams, roughly up to 50 users, but limits change, so check official pricing before you rely on a number. For a personal homelab with one or two users, the free tier is normally enough to cloudflare tunnel expose homelab services for everyday use.
You can also add Cloudflare Access rules in front of a hostname, so only your email address or a one-time code can open it. That is useful for admin panels you do not want the whole internet to see. If you go that route, read our guide to Cloudflare security settings so you know what the WAF, Bot Fight Mode, and SSL modes actually do before you turn them on.
Common Problems and Fixes
If the browser shows a Cloudflare error 1033, the tunnel is up but no ingress rule matches the hostname. Check the spelling of the subdomain in the config file and in DNS, then restart cloudflared. If you see a 502 error, the tunnel is fine but cloudflared cannot reach the service, so check that the app is running and listening on the port in your ingress rule.
If cloudflared service install complains, it is usually because the config file path in the service does not match where you wrote it. The default config path is ~/.cloudflared/config.yml for the user who ran the login, so run the service install as that same user. If DNS does not resolve after a few minutes, check that the CNAME record exists in the Cloudflare dashboard under your domain, and that the domain is using Cloudflare nameservers.
When a Tunnel Is Not the Right Tool
A tunnel is the easiest way to expose a few services, but it is not the answer for everything. Traffic passes through Cloudflare servers, which adds a small hop and means Cloudflare sees the requests. If you only need access from inside your own house, a local reverse proxy is simpler, and our guide to setting up a reverse proxy for homelab services with a custom domain walks through that setup. If you need full network access rather than a few web apps, a VPN such as WireGuard or Tailscale fits better, because a tunnel only forwards the services you list in the config.
What to Do Next After Your First Tunnel
Once the first service loads over HTTPS, add the rest one at a time, testing each subdomain as you go. Back up the credentials file in ~/.cloudflared/ somewhere safe, since losing it means recreating the tunnel and updating every DNS record. With that done, your homelab is reachable from anywhere, and your router has no open ports.