Cloudflare Tunnel, is a service that allows you to securely turn any network connected device into a public server. This tutorial will show you how to install the Cloudflare tunnel utility known as cloudflared on a Raspberry Pi.
Why Use Cloudflare Tunnel?
Maybe you want to demo the latest web app you are building or maybe your latest project an IoT robot that can be accessed from anywhere in the world. Cloudflare tunnel lets you do all of this without having to set up port forwarding & firewall rules on your devices and your router, instead you simply lockdown your firewall and then configure and run the cloudflared utility so that only inbound web traffic over Cloudflare’s network ever reaches your device.
To install the cloudflared utility on a raspberry pi open up a terminal and run the following commands.
wget -q https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz tar -xvzf cloudflared-stable-linux-arm.tgz sudo cp cloudflared /usr/local/bin/ sudo chmod +x /usr/local/bin/cloudflared rm cloudflared cloudflared-stable-linux-arm.tgz
Finally to connect the utility to your cloudflare account, run:
cloudflared tunnel login
As shown above you will be prompted to visit a url, log in to your Cloudflare account, and select a domain to use for your tunnel.