免费内网穿透cloudflare Zero Trust设置几个关键地方

有时候人都是逼出来的,男人就得对自己狠一点,迟迟掌握不了的cloudflare Zero Trust,今天还是把它给拿下了,目前的状态很不错,体验还可以。记录一下cloudflare Zero Trust设置的几个关键地方,备用。

1,使用cloudflare Zero Trust时,先得将域名DNS自定义为cloudflare DNS

这需要进域名注册后台,不同的域名商有不同的界面,腾讯云看图:

图片[1]-免费内网穿透cloudflare Zero Trust设置几个关键地方-墨铺

使用cloudflare Zero Trust服务时,填写的cloudflare DNS是:

gordon.ns.cloudflare.com
shubhi.ns.cloudflare.com

提示:这DNS地址不会永远不变,写在这是因为有时候cloudflare官网很不好访问,时常打不开查看DNS的页面。

2,在对cloudflare Zero Trust设置之前,应将域名同步过来的DNS记录都删除,这在B站等平台UP主视频里面都有详细说明,在这就不截图了,因为打开抽风。先清空DNS记录的原因是cloudflare Zero Trust后面的设置里面需要填写解析,如果前面有相应解析了就不能正常填写。但需要注意的是,如果有不需要使用cloudflare Zero Trust服务的域名,就不用删除。

3,cloudflare Zero Trust中需要下载一个cloudflared-windows-amd64文件,安装时一闪而过,就已经成功了。下载速度极看人品,不过已经分享出来了。

cloudflared-windows-amd64下载地址:https://www.123pan.com/s/9xsRVv-at4Fv.html

4,cloudflared-windows-amd64安装后,需要用管理员权限运行CMD命令行,强调必须得管理员权限,否则绿色运行提示只有一行,当三行里面有绿色运行提示时才成功。

命令行代码如下:

cloudflared.exe service install eyJhIjoiM2Q4YjJiZTczMGMwMmFkYmM2YWNhOminaTY2MjIwMGFmN2UiLCJ0IjoiNzczZTYxOWEtODk4NC00NDZkLThiN2UtMzY4ZDZiNmM3ODQwIiwicyI6Ik1XUmxObVkyTldJdE5UQTVOeTAwTlRsaUxUaGhNelF0T0dZeU1XUTJaV0poWVRFMyJ9

5,同一台本地服务器上的多个网站,可以使用同一条隧道,不需要每一个网站都建立一条。只需要在公共站点里面填加上就行。

6,如果配置正确,却无法正常连接服务,有可能是quic协议引起的,这里博主胡萝虎有分享。

在Cloudflared容器的启动参数中将协议改为http2就可以了:

version: '3.8'
services:
    cloudflared:
        container_name: cloudflared
        restart: unless-stopped
        network_mode: bridge
        environment:
            - TZ=Asia/Shanghai
        command: tunnel --no-autoupdate --protocol http2 run --token <youtoken>
        image: 'cloudflare/cloudflared:latest'

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

图片[2]-免费内网穿透cloudflare Zero Trust设置几个关键地方-墨铺

链接出处:遇事不决,量子力学!搞定Cloudflare Tunnels无法建立隧道的问题 – 胡萝虎的博客

当然,正常服务中的突然异常了,你可以这样排查,而刚穿透的则需要多等一下,有可能是各地DNS还没有同步过来引起的,匆忙设置反而出错。这里只记录下来,我也没亲手设置过。

7,如果正常连接的cloudflare Zero Trust异常,提示:

cloudflared service is already installed at Cloudflared; if you are running a cloudflared tunnel, you can point it to multiple origins, avoiding the need to run more than one cloudflared service in the same machine; otherwise if you are really sure, you can do `cloudflared service uninstall` to clean up the existing service and then try again this command

可按提示运行命令:cloudflared service uninstall

然后重复运行cloudflare Zero Trust命令。

图片[3]-免费内网穿透cloudflare Zero Trust设置几个关键地方-墨铺

 

© 版权声明
THE END
喜欢请点赞支持!
点赞6 分享
大话西游 抢沙发

蒹葭苍苍,白露为霜

    所谓伊人,在水一方