Cloudflare Tunnel Won't Start: Error opening metrics server listener

I can’t start Cloudflare Tunnel:

[email protected]:~$ cloudflared tunnel run
2021-10-21T10:28:06Z INF Starting tunnel tunnelID=REDACTED
2021-10-21T10:28:06Z INF Version 2021.10.3
2021-10-21T10:28:06Z INF GOOS: linux, GOVersion: devel +a84af465cb Mon Aug 9 10:31:00 2021 -0700, GoArch: amd64
2021-10-21T10:28:06Z INF Settings: map[cred-file:/home/ben/.cloudflared/REDACTED.json credentials-file:/home/ben/.cloudflared/REDACTED.json]
2021-10-21T10:28:06Z INF Generated Connector ID: REDACTED
2021-10-21T10:28:06Z INF cloudflared will not automatically update when run from the shell. To enable auto-updates, run cloudflared as a service:
2021-10-21T10:28:06Z INF Initial protocol http2
2021-10-21T10:28:06Z ERR Error opening metrics server listener error="listen tcp bind: cannot assign requested address"
Error opening metrics server listener: listen tcp bind: cannot assign requested address

What’s going wrong? I couldn’t find any suitable resources on Google but apologies if my Google-foo is lacking (or if my lack of sleep last night is showing!).

This is the problem.
Can you share the YAML config you are running with?

Can you share the YAML config you are running with? Looks like the metrics port is configured to be 0, which is wrong.

I don’t believe I’ve configured the port:

tunnel: REDACTED
credentials-file: /home/ben/.cloudflared/REDACTED.json

  - hostname:
    service: ssh://localhost:22
  - service: http_status:404

Is it possible that this version of cloudflared is having an issue?

Try installing an older version of cloudflared and see how it goes.

Sorry, I meant to say that port 0 is leaving it up to the OS to pick it up, which is the default.

Maybe the problem is with the IP chosen?
Can you set up the property: “metrics: addr:port” to an address that cloudflared can bind to, and to a port that is available (or try 0 again, maybe the problem was with the addr)

There wasn’t any change related to the metrics server. The problem should not be cloudflared version.

1 Like

Hmm. I think DNS is behaving:

[email protected]:~$ host localhost
localhost has address
localhost has IPv6 address ::1

Yet metrics: localhost:0 (which I believe is the default) fails and metrics: (and metrics: "[::1]:0") succeeds. Am I being a muppet and missing something obvious?

I can only tell you that both work on various environments/machines that I’ve checked.

So it must be something specific to your machine.

I’m just a bit perplexed that a hostname is failing yet the two things it could resolve as both work OK. Are there any more verbose logs that I could generate and share? I’ve got four other tunnels working fine (two dual stack, two v4 only), hence my surprise that this one is misbehaving.

On second thoughts, perhaps DNS isn’t behaving :slight_smile:

curl -v http://localhost
*   Trying 2606:4700:3036::6815:2c29:80...

Unsurprisingly, fixing this resolves the issue with cloudflared. It’s always DNS!

1 Like

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