ip更改后如何重新连接cloudflare隧道

问题描述 投票:0回答:1

我在 docker 镜像中使用 cloudflare 隧道。 docker compose 配置看起来像

tunnel:
    image: cloudflare/cloudflared:2021.11.0
    command: tunnel --config /etc/cloudflared/config.yml --no-autoupdate run

和 cloudflared 配置

url: http://host.docker.internal:8000
tunnel: ***
credentials-file: /etc/cloudflared/***.json

当我切换主机 wifi 网络时,主机 ip 发生变化并且隧道断开。

cloudflared tunnel info <NAME>
...
This tunnel has no active connectors.

是否有一个参数可以定期重新连接

cloudflared
客户端?

docker cloudflare tunnel reconnect
1个回答
1
投票

似乎您的 docker 容器无法识别任何更新或 ip4 更改,因为您在虚拟 docker 交换机上运行它。

如果你在你的机器上尝试使用这些设置,这应该可以工作:

# run command
$ cloudflared tunnel --no-chunked-encoding run <<your_tunnel_name>>
# config.yml in your default cloudflared folder (~/.cloudflared/):

tunnel: 0000001
credentials-file: .cloudflared/0000001.json
originRequest: # Root-level configuration
  connectTimeout: 10s
loglevel: debug
transport-loglevel: debug

ingress:
  - hostname: example.com
    service: http://localhost:4300
    originRequest:
      connectTimeout: 10s
      tcpKeepAlive: 12s
  - service: http_status:404

这里是重新创建新连接后的日志片段:

2021-11-18T16:39:27Z DBG rpcconnect: tx (abort = (reason = "rpc: shutdown", type = failed, obsoleteIsCallersFault = false, obsoleteDurability = 0))
2021-11-18T16:39:27Z ERR Unable to establish connection. error="already connected to this server, trying another address" connIndex=2
2021-11-18T16:39:27Z ERR Connection terminated error="already connected to this server, trying another address" connIndex=2
2021-11-18T16:39:27Z DBG rpcconnect: rx (return = (answerId = 1, releaseParamCaps = false, results = (content = <opaque pointer>, capTable = [])))
2021-11-18T16:39:27Z INF Connection 90277bf3-1708-490b-803e-fbdabbbb1f75 registered connIndex=3 location=FRA
2021-11-18T16:39:27Z DBG rpcconnect: tx (finish = (questionId = 1, releaseResultCaps = false))
© www.soinside.com 2019 - 2024. All rights reserved.