This Cloudflare Tunnel for beginners guide explains what a tunnel is, what you need, the steps to set one up and how to keep it safe. It suits a home lab app you want to reach from anywhere, like a website or a status page.

01What is Cloudflare Tunnel?
Normally, to let the outside world reach an app at home, you open a door in your router. That is called port forwarding, and it points strangers straight at your home network.
A tunnel works the other way round. A small program called cloudflared runs on your server and calls out to Cloudflare. Visitors go to Cloudflare, and Cloudflare passes them down that connection to your app.
02Why use a tunnel instead of opening ports?
- NO OPEN PORTSThe connection goes outwards only. Your router stays closed.
- YOUR HOME ADDRESS STAYS OUT OF ITVisitors connect to Cloudflare, not straight to your home.
- THE PADLOCK COMES WITH ITCloudflare serves your app over https, so browsers show it as secure.
- ON EVERY PLANCloudflare Tunnel is available on all Cloudflare plans.
03What do you need for Cloudflare Tunnel?
- A Cloudflare account.
- A domain on Cloudflare. You need one to publish an app.
- A server with internet where
cloudflaredcan run. Your home server is fine. - The app's local address, such as
http://localhost:3001.
04How to set up Cloudflare Tunnel
- In the Cloudflare dashboard, go to Networking, then Tunnels.
- Select Create Tunnel, give it a name and select Create Tunnel again.
- Under Setup Environment, pick your server's system. Copy the commands under Install and Run and run them on your server.
- Wait until the tunnel shows as Healthy.
- Open your tunnel. Under Routes, select Add route, then Published application.
- Under Hostname, type a subdomain such as
statusand pick your domain. - For Service URL, enter your app's local address, then select Add route.
If your server uses Docker, the install command looks like this, with your own token in place of the last word:
docker run -d --restart unless-stopped \
cloudflare/cloudflared:latest tunnel \
--no-autoupdate run --token YOUR_TUNNEL_TOKEN Menu names in the dashboard change now and then. If yours looks different, search the dashboard for Tunnels.
05How to keep a tunnel safe
A published app is public. Anyone who has the address can open it, so treat it like any website.
- Only publish apps that have their own login, or put Cloudflare Access in front. Access asks visitors to sign in before they reach your app.
- Never publish admin pages, such as your router or your storage system.
- Publish one app at a time, and only the ones you need outside your home.
If only you and your family need access, a VPN is the better tool. A tunnel is for things you want the outside world to reach.
06Can you try a tunnel without a domain?
Yes, for testing. With cloudflared installed, this command gives your app a temporary address that ends in trycloudflare.com:
cloudflared tunnel --url http://localhost:3001 The address is random and goes away when you stop the command. Use it to see how a tunnel feels, not for anything you want to keep.
07What this means for CosmolinkOS
CosmolinkOS runs in Docker on your own hardware, for example as an app on TrueNAS. More platforms are planned. The What you need page lists the hardware.
08Questions people ask
Do I need a domain for Cloudflare Tunnel?
Yes, to publish an app you need a domain on Cloudflare. For a quick test, a temporary trycloudflare.com address works without one.
Do I need to open ports on my router?
No. The cloudflared program makes an outgoing connection to Cloudflare, so no incoming ports are opened.
Is Cloudflare Tunnel the same as a VPN?
No. A tunnel publishes an app so that people with the address can reach it. A VPN gives only your own devices a private way into your home network.
What is cloudflared?
It is the small program that runs on your server and keeps the connection to Cloudflare open.
Is a published app safe by default?
It is public by default. Publish only apps with their own login, or put Cloudflare Access in front so visitors must sign in first.
Is Cloudflare Tunnel free?
Yes. Cloudflare Tunnel is free to use, including on Cloudflare's free plan. You only pay for your own domain name.
Related guides: Twingate vs Tailscale and Tailscale vs WireGuard.