60
1

cloudflare赛博大善人,内网穿透Windows教程

2026-07-09
2026-07-11
cloudflare赛博大善人,内网穿透Windows教程

上期链接

https://blog.chengbuwan.ink/archives/cloudflaresai-bo-da-shan-ren-mian-fei-nei-wang-chuan-tou

本期带来Windows教程,Windows相对比Linux简单,同样的,临时域名看结尾,所有命令都要用管理员权限运行

1.下载与安装

方法一

先下载安装包:https://github.com/cloudflare/cloudflared/releases/latest

下载 cloudflared-windows-amd64.exe(64位系统)或 cloudflared-windows-386.exe(32位)

方法二

下载msi

https://blog.chengbuwan.ink/upload/cloudflared-windows-amd64.msi

注意msi安装程序路径由安装程序指定,请务必记住地址,是用msi安装无需创建文件夹

使用方法一安装的用户

在C盘新建一个文件夹,叫 cloudflared(路径:C:\cloudflared)

把下载的exe文件放进去,重命名为 cloudflared.exe

设置环境变量(重要):

· 按 Win + X → 系统 → 高级系统设置 → 环境变量

· 在“系统变量”里找到 Path → 编辑 → 新建 → 填入 C:\cloudflared

· 一路点确定保存

重新打开PowerShell,输入 cloudflared --version,看到版本号就说明成功了

使用方法二安装的用户

msi已经设置好所有环境,直接重启电脑即可

2.登录cloudflare账号

在PowerShell输入

cloudflared tunnel login

会给你链接,你去打开登录授权你想要的域名,授权后会下载一个 cert.pem 文件,把它复制到 C:\Users\你的用户名\.cloudflared\ 文件夹里(没有就手动新建)

使用msi安装的把cert.pem文件复制到msi创建的文件夹

3.创建隧道

依旧某神秘PowerShell

在PowerShell执行

cloudflared tunnel create 隧道名字

然后回车,执行完会在.cloudflared 文件夹里生成一个 xxx.json 文件(UUID)

4.绑定域名

cloudflared tunnel route dns 隧道名字 你的域名

执行这个命令

5.获取隧道UUID

执行

cloudflared tunnel list

复制UUID,很重要

6.编写配置文件

在 C:\Users\你的用户名\.cloudflared\ 文件夹里,msi安装用户直接在msi安装时创建的文件夹,新建一个文件叫 config.yml,用记事本打开,粘贴下面内容:

tunnel: 你的隧道名字
credentials-file: C:\Users\你的用户名\.cloudflared\你的隧道UUID.json
ingress:
  - hostname: 你的域名
    service: http://localhost:你要穿透的端口
  - service: http_status:404

把里面的隧道名字、UUID、域名、端口都替换成你自己的。

注意:hostname后面那一行,service的端口写你要穿透的服务端口,比如 http://localhost:8080

7.后台运行

分别执行

cloudflared service install
Start-Service Cloudflared

8.临时域名教程

执行

cloudflared tunnel --url http://localhost:端口号

他会给你一个临时域名

日志是

INF Your quick Tunnel has been created! Visit it at https://他给你的前缀.trycloudflare.com

9.总结

还是一样的,晚高峰(傍晚)延迟大,没有大陆优化

临时域名不推荐长期使用,购买域名看上期结尾

https://blog.chengbuwan.ink/archives/cloudflaresai-bo-da-shan-ren-mian-fei-nei-wang-chuan-tou

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或者给予支持!

cloudflare赛博大善人,内网穿透Windows教程
/archives/cloudflaresai-bo-da-shan-ren-nei-wang-chuan-tou-windowsjiao-cheng
作者
chengbuwan
发布于
2026-07-09
许可协议
chengbuwan

评论