I’ve been debugging a cloudflared tunnel issue in my homelab [1] all day today, and
getting really frustrated. My issue ended up being that it was running twice,
once without the correct config file and another with it. I believe that
cacheing may have compounded the issue.
In yesterday’s post I setup a cloudflared tunnel on my ubuntu server to
expose applications running on the server to the internet. I’m setting up a
new server and running cloudflared in its own vm.
setup cloudflared tunnel on ubuntu [2]
Check that dns is pointing to the correct tunnel # [3]
dig subdomain.example.com
traceroute subdomain.example.com
Check that the tunnel is running # [4]
export CLOUDFLARED_TUNNEL_ID = "my-tunnel-id"
cloudflared tunnel list
cloudflared tunnel info $CLOUDFLARED_TUNNEL_ID
References:
[1]: /homelab/
[2]: /setup-cloudflared-tunnel-on-ubuntu/
[3]: #check-that-dns-is-pointing-to-the-correct-tunnel
[4]: #check-that-the-tunnel-is-running
Posts tagged: networking
All posts with the tag "networking"
2 posts
latest post 2024-12-03
I run a cloudflared tunnel on my ubuntu server to expose applications running
on the server to the internet. I’m setting up a new server and running
cloudflared in its own vm.
Get the cloudflared binary # [1]
sudo wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /usr/local/bin/cloudflared
sudo chmod +x /usr/local/bin/cloudflared
# [2]
Now setup the config directory. For the systemd service to work, the config
file needs to be in /etc/cloudflared. I like to give my user rights to edit
the config file without being sudo, we will do that here by creating a group
cloudflared, add ourselves to the group, give ownership of /etc/cloudflared
to the group, give group write access to the directory, and refresh groups.
sudo mkdir -p /etc/cloudflared
sudo groupadd cloudflared
sudo usermod -aG cloudflared $USER
sudo chown -R root:cloudflared /etc/cloudflared
sudo chmod g+w /etc/cloudflared
newgrp cloudflared
login # [3]
Now we can log into the domain zone with cloudflared.
cloudflared tunnel login
This will give a url, follow it in a browser to log in.
cloudflared tunnel create <NAME>
mv ~/.cloudflared/cert.pem /etc/cloudflared/cert....