Cloudflare Tunnels无法建立隧道的解决办法

没落的情绪 2023-12-18 AM 613℃ 0条

docker容器创建Cloudflare Tunnels隧道的时候提示

2023-10-13T09:52:58Z ERR Failed to create new quic connection error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=1 ip=198.41.192.227
2023-10-13T09:52:58Z INF Retrying connection in up to 2s seconds connIndex=1 ip=198.41.192.227
2023-10-13T09:52:58Z ERR Connection terminated error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=1

其中ERR Failed to create new quic connection error="failed to dial to edge with quic: timeout: no recent network activity"的意思是创建新的quic连接失败,使用quic协议无法连接到边缘服务器。简单说就是使用quic协议无法成功建立隧道!
quic协议使用的是UDP协议,国内运营商眼里UDP协议是不好的,所以会导致阻断UDP的连接,
将quic协议手动指定为http2协议就能解决这个问题

在指令中增加--protocol http2 即可,此时强制指定协议为http2,使用的是TCP,这样就不会被运营商阻断了。
当然,也可以设置为--protocol auto ,开启自动切换,默认依然是quic,但是失败后可自动切换到http2。

运行下面的指令即可解决,注意,需要改成你的token

docker run cloudflare/cloudflared:latest tunnel --no-autoupdate --protocol http2 run --token <token>
或者
docker run cloudflare/cloudflared:latest tunnel --no-autoupdate --protocol auto run --token <token>

标签: Cloudflare

非特殊说明,本博所有文章均为博主原创。

上一篇 搭建iredmail邮箱
下一篇 没有了

评论啦~