Run 2 cloudflared instances on 1 machine

Hi all,

I’m trying to add some application tunnels together with a network tunnel, and as far as I know, I need to run 2 separate cloudflared instances for that, right?

Question I have is now: I’ve got 2 separate config files with corresponding other needed files. But I don’t have a clue on how to install both as a service next to eachother. 1 service is already up and running, but as soon as I want to install a 2nd service, I get the following error:

# cloudflared --config /root/.cloudflared/instance2/config.yml service install
Possible conflicting configuration in /root/.cloudflared/instance2/config.yml and /etc/cloudflared/config.yml. Either remove /etc/cloudflared/config.yml or run `cloudflared --config /etc/cloudflared/config.yml service install`

Any idea on how to install this 2nd service next to the 1st one?

Thanks!
Cadish

I followed these instructions from @matteo:

1 Like

Thanks a lot @sdayman ! This indeed is how to do it.

Much appreciated,
Cadish

1 Like

You can run a single tunnel for both purposes.

E.g.:

credentials-file: /path/to/uuid.json
tunnel: uuid

ingress:
- hostname: some.host.com
  service: http://localhost:23986
- hostname: another.host.com
  service: ws://localhost:23982
- hostname: *
  service: http_status:404

warp-routing:
  enabled: true
1 Like

But there is no way to actually specify the CIDR ranges in the config file, right? They have to be specified via the command line, on any machine that has cloudflared installed?

I thought it needed a 2nd instance, based on this discussion

That is correct. Any cloudflared that has a cert.pem for that account will be able to define which CIDRs are routable to the tunnel ID.

Maybe there was some limitation at some point in time.
I assure you it is possible to do what I described above.

3 Likes

Didn’t know… tried it and it indeed works with only 1 instance! Great!

Thanks a lot for these wonderful solutions!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.