Part 5: Your First Argo Tunnel

January 6, 2020 - Reading time: 13 minutes

It’s now time to witness first-hand the magic that is Argo-Tunnel.  First, let’s go through some pre-requisite reading here:  https://developers.cloudflare.com/argo-tunnel/quickstart/.  

 

We now need to download the correct Cloudflared client compiled for Raspberry Pi.  The official client for Pi can be found here:  https://developers.cloudflare.com/argo-tunnel/downloads/.  However, there is a problem when using this version with a Pi Zero.  Instead, you’ll need to get a correctly compiled client here: https://hobin.ca/cloudflared.  

 

You are now ready to start digging your first tunnels!

 

Once downloaded, create a folder called argo-tunnel, copy the downloaded file there, and un-compress:

 

sudo mkdir argo-tunnel

sudo cp /Downloads/cloudflared_2019.12.0_arm.tar.gz /home/pi/argo-tunnel

tar -xvzf cloudflared_2019.12.0_arm.tar.gz

 

Now check the version of the client (this should work without any errors):

 

./cloudflared –version

 

Now let’s use the client to make a connection to Cloudflare and download the correct certificate for your domain:

 

./cloudflared login

 

This should launch a browser window and ask you to log into the Cloudflare Dashboard.  Once done, select the domain you want to authorise (in our case makerflare.com).  You should get prompted about a certificate being downloaded.  Let’s go check to make sure this was done correctly by opening the file in a text editor:

 

sudo nano /home/pi/.cloudflared/cert.pem

 

You should see a bunch of randomised characters.  

 

Now let’s move the cert.pem file to the correct folder.

 

sudo mkdir /etc/cloudflared

sudo cp /home/pi/.cloudflared/cert.pem /etc/cloudflared

 

We still need to create a config file before running the Cloudflared client for the first time.  Let’s do this as follows:

 

sudo nano /etc/cloudflared/config.yml

 

Once inside nano, type the following:

 

hostname: makerflare.com

url: http://localhost:80

lb-pool: makerflare_lb_pool

logfile: /var/log/cloudflared.log

 

Most of the entries are self-explanatory.  However, the “lb-pool” field is used for load-balancing, and we’ll cover that topic later on in another blog entry.  

 

Save the file and exit the text editor.  It’s time to install the Cloudflared client as a service and start it for the first time.  Run the following commands from the argo-tunnel folder

 

sudo ./cloudflared service install

sudo systemctl start cloudflared

 

Finally, let’s check to see if the service has started correctly:

 

systemctl status cloudflared

 

Recap:

 

We’ve created our first argo-tunnel using the cloudflared client.  This establishes a persistent connection to Cloudflare.  Any incoming requests to your origin will now be routed through one of four tunnels created when the cloudflared service first starts.  

About

A playground of creativity that combines Cloudflare technology with hobbyists.