This is a simple guide to setting up multiple cloudflared services (via systemctl). Useful if you have to run tunnels authenticated by different accounts and want to let each account handle their tunneling configurations via the Dashboard/UI.
- (optional, so its easy to clone the service definition file) Setup your first tunnel using the standard
sudo cloudflared service install <token>
command cd
into the folder containing thecloudflared.service
definition (usually/etc/systemd/system
or/usr/lib/systemd/system
- Duplicate the existing cloudflared.service into another file with a unique name e.g.
sudo cp cloudflared.service cloudflared-b.service
- Open up your new service cloudflared-b.service in your favorite text editor
- Change the token within the
ExecStart=
line to match your second tunnel - Change the service
Description=
to match your service filename - Save your changes
- Start the new service with
sudo systemctl start cloudflared-b
- Check that the service is all-ok with
sudo systemctl status cloudflared-b
- You are good to go (rinse and repeat for more tunnels)
(In case you want to create each service definition by hand)
[Unit]
Description=cloudflared
After=network.target
[Service]
TimeoutStartSec=0
Type=notify
ExecStart=/usr/bin/cloudflared --no-autoupdate tunnel run --token TOKEN_HERE
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target