This article contains affiliate links — if you click and purchase, we may earn a commission at no extra cost to you. · Editorial Policy
Cloudflare Tunnel Setup Guide

Cloudflare · Security · VPS Guide

Cloudflare Tunnel Guide 2026: Free Secure Tunnel on VPS — No Open Ports Required

By CloudPicked Review Team · Updated September 2026 · ~12 min read

Quick summary: Cloudflare Tunnel (cloudflared) lets you securely expose services on your VPS or home server through Cloudflare's network via an outbound-only connection — no open inbound ports, no public IP, free for basic use.

Table of Contents

  1. What Is Cloudflare Tunnel?
  2. How It Works
  3. Key Benefits
  4. Prerequisites
  5. Install cloudflared on Linux
  6. Create a Tunnel Step by Step
  7. Configure config.yml
  8. Common Use Cases
  9. Cloudflare Tunnel vs. VPN
  10. Limitations to Know
  11. FAQ

What Is Cloudflare Tunnel?

Cloudflare Tunnel (formerly Argo Tunnel) is a Cloudflare service that lets you expose services running on your server — web apps, SSH servers, Remote Desktop — through Cloudflare's global network, without configuring inbound firewall rules or owning a public IP address.

At its core is a lightweight daemon called cloudflared that you install on your server. It creates outbound-only encrypted connections to Cloudflare data centers. Cloudflare then uses those connections to proxy traffic into your services. The result is bidirectional traffic flowing over a single outbound connection.

This makes Cloudflare Tunnel ideal for:

Cloudflare Tunnel is part of Cloudflare Zero Trust (formerly Cloudflare for Teams) and is free for basic use — data as of September 2026, verify current terms at cloudflare.com.

How It Works

Cloudflare Tunnel operates through three main components:

1. The cloudflared Daemon

The cloudflared daemon installed on your server creates persistent outbound-only connections to Cloudflare's global network using Anycast routing — automatically connecting to the nearest data center. These connections are encrypted and require zero inbound firewall rules.

2. Tunnel UUID

Each tunnel has a unique UUID acting as a logical link between your origin server and Cloudflare. You can run multiple cloudflared processes (connectors) within a single tunnel for high availability.

3. Traffic Routing

When a request arrives at your domain (e.g., app.example.com), Cloudflare receives it, routes it through the tunnel to your cloudflared daemon, which forwards it to your local service (e.g., localhost:3000). The response travels the same path back.

Security note: All traffic is authenticated by tunnel credentials that cloudflared holds, preventing unauthorized connections into the tunnel.

Key Benefits

BenefitDetail
No inbound ports neededReduces attack surface — you can close all inbound firewall rules
No public IP requiredWorks behind NAT, CGNAT, or ISPs that don't offer static IPs
Hides origin IPAttackers cannot determine your real server IP; built-in DDoS protection
Automatic TLSCloudflare manages SSL/TLS certificates — no Certbot needed
Free for basic useHTTP tunnels work on Cloudflare's Free plan at no cost
Anycast global network300+ data centers worldwide for low-latency access
Zero Trust readyAdd Access policies to enforce authentication before reaching services

Prerequisites

Before you begin, ensure you have the following:

You do NOT need: a static IP, public IP, inbound firewall rules, or a Let's Encrypt certificate.

Install cloudflared on Linux (Ubuntu/Debian)

Cloudflare maintains an official package repository. Install with these commands:

Method 1: apt repository (recommended)

# Add Cloudflare GPG key
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg > /dev/null

# Add repository
echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflared.list

# Update and install
sudo apt update && sudo apt install cloudflared -y

# Verify version
cloudflared --version

Method 2: Direct binary download

# For Linux x86_64
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

For RHEL/CentOS

sudo yum install cloudflared

Create a Tunnel Step by Step

Step 1: Authenticate with Cloudflare

cloudflared tunnel login

This opens a browser window prompting you to log in to your Cloudflare account and select the domain to use. Once complete, cloudflared saves credentials to ~/.cloudflared/cert.pem.

Step 2: Create a New Tunnel

cloudflared tunnel create my-tunnel

Replace my-tunnel with your preferred name. The output shows your Tunnel UUID (e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) and credentials file path. Note both values.

Step 3: Route DNS

cloudflared tunnel route dns my-tunnel app.example.com

This automatically creates a CNAME record in Cloudflare DNS, pointing app.example.com to the tunnel endpoint with Cloudflare proxy enabled (orange cloud).

Step 4: Create Config File

mkdir -p ~/.cloudflared
nano ~/.cloudflared/config.yml

Step 5: Run the Tunnel

cloudflared tunnel run my-tunnel

Step 6: Verify

cloudflared tunnel info my-tunnel

Configure config.yml

The ~/.cloudflared/config.yml file defines where cloudflared routes traffic.

Single web app (HTTP)

tunnel: <YOUR-TUNNEL-UUID>
credentials-file: /root/.cloudflared/<YOUR-TUNNEL-UUID>.json

ingress:
  - hostname: app.example.com
    service: http://localhost:3000
  - service: http_status:404

Multiple services

tunnel: <YOUR-TUNNEL-UUID>
credentials-file: /root/.cloudflared/<YOUR-TUNNEL-UUID>.json

ingress:
  - hostname: app.example.com
    service: http://localhost:3000
  - hostname: api.example.com
    service: http://localhost:8080
  - hostname: dashboard.example.com
    service: http://localhost:8443
    originRequest:
      noTLSVerify: true
  - service: http_status:404

Run as a systemd service (auto-start on boot)

# Install systemd service
sudo cloudflared service install

# Start and enable
sudo systemctl start cloudflared
sudo systemctl enable cloudflared

# Check status
sudo systemctl status cloudflared

Common Use Cases

1. Exposing a Web App or API

The most common use case: run any web server (Nginx, Apache, Node.js, Python Flask, etc.) on localhost, then let cloudflared expose it via your domain.

ingress:
  - hostname: myapp.example.com
    service: http://localhost:3000
  - service: http_status:404

2. SSH via Browser (No Port 22 Exposed)

Cloudflare Tunnel supports browser-based SSH access combined with Cloudflare Access — no need to open port 22 to the internet at all.

ingress:
  - hostname: ssh.example.com
    service: ssh://localhost:22
  - service: http_status:404

Users connect using: cloudflared access ssh --hostname ssh.example.com after authenticating through Cloudflare Access.

3. Remote Desktop (RDP)

ingress:
  - hostname: rdp.example.com
    service: rdp://localhost:3389
  - service: http_status:404

4. Private Network (Zero Trust)

For organizations requiring ZTNA, enable warp-routing so Cloudflare WARP clients can reach the private network:

tunnel: <UUID>
credentials-file: /root/.cloudflared/<UUID>.json
warp-routing:
  enabled: true

5. Quick Development Exposure

Developers needing a temporary public URL for webhooks or demos can use:

cloudflared tunnel --url http://localhost:3000

This generates a temporary public URL instantly without any config file required.

Cloudflare Tunnel vs. Traditional VPN

FeatureCloudflare TunnelVPN (WireGuard/OpenVPN)
Public IP requiredNoYes (or DDNS)
Open inbound portsNot requiredRequired (UDP 51820 / TCP 1194)
SSL/TLSAutomaticManual setup
CostFree (basic use)Cost of VPS/server
DDoS protectionBuilt-in (Cloudflare)Depends on provider
Zero Trust / AccessBuilt-in supportRequires additional layers
LatencyLow (Anycast)Depends on server location
ComplexityLow (few commands)Higher (extensive config)
Full network routingYes (warp-routing)Yes (split tunnel)

In summary: Cloudflare Tunnel is better for securely exposing specific services to the internet. Traditional VPNs are better for full network access between clients.

Limitations to Know

Verdict

Cloudflare Tunnel is a powerful and free tool for securely exposing services on a VPS or home server. With just a handful of commands, you get automatic SSL, DDoS protection, and zero firewall configuration. It's an excellent choice for developers, sysadmins, and home server enthusiasts alike.

FAQ — Frequently Asked Questions

Is Cloudflare Tunnel free?

Cloudflare Tunnel is free for basic use with any Cloudflare account (Free plan), as long as your domain uses Cloudflare Nameservers. Data as of September 2026 — verify at cloudflare.com.

How is it different from a VPN?

Cloudflare Tunnel uses an outbound-only connection — no inbound ports needed, no public IP required. Traditional VPNs require both.

Do I need a public IP address?

No. cloudflared connects outbound to Cloudflare's network automatically, making it ideal for servers behind NAT or CGNAT.

What protocols are supported?

HTTP/HTTPS (web apps), SSH, RDP (Remote Desktop), and other TCP protocols per Cloudflare documentation.

Which Linux distributions support cloudflared?

Ubuntu, Debian, RHEL/CentOS, Arch Linux, macOS (Homebrew), and Windows.

What happens if cloudflared crashes?

The tunnel stops. Install it as a systemd service with Restart=always to ensure automatic recovery.

Can I use Cloudflare Tunnel with any hosting provider?

Yes. cloudflared can run on any server or VPS that supports SSH access and outbound internet connections, regardless of hosting provider.

Looking for reliable Thai hosting?

CloudPicked recommends AsiaGB.com — Thai hosting with 24h support, DirectAdmin, and affordable pricing.

Visit AsiaGB →