How to setup Cloudflare Tunnel to access internal services from public cloud

How to setup Cloudflare Tunnel to access internal services from public cloud

Cloudflare Tunnel setup summary

Cloudflare Tunnel setup explains how to create a tunnel and publish an application in under 5 minutes. A tunnel lets Cloudflare securely proxy traffic from a public hostname to a private service running on your server, without opening inbound firewall ports.

Requirements

  1. Cloudflare account (can be free account)

  2. A domain available in Cloudflare DNS. The domain does not need to be registered through Cloudflare; it can stay with another registrar as long as Cloudflare is authoritative for DNS by using Cloudflare nameservers.

  3. An internal server or VM with internet access where cloudflared can be installed (Windows, Debian, Redhat, Docker)

Main steps

  1. In the Cloudflare dashboard, go to Networking > Tunnels.

  2. Select Create Tunnel, give it a name, then create it.

  3. Choose the server operating system and architecture.

  4. Copy and run the generated cloudflared install/run commands on the server.

  5. Wait until the tunnel shows as Healthy.

  6. Add a published application route that maps a public hostname to your local service.

  7. Enter the service URL, such as http://mcp.domain.com:80, https://mcp.domain.com:443, or another internal IP and port.

  8. Add the route so Cloudflare creates or updates the proxied DNS record and sends traffic through the tunnel. This works when the hostname’s DNS zone is active in Cloudflare, even if the domain is registered with another registrar.