62
0
3

cloudflare赛博大善人,免费内网穿透Linux教程

2026-07-09
2026-08-12
cloudflare赛博大善人,免费内网穿透Linux教程
文章摘要
|

Windows 部署教程链接

https://www.chengbuwan.ink/archives/cloudflaresai-bo-da-shan-ren-nei-wang-chuan-tou-windowsjiao-cheng

cloudflare 内网穿透是一个非常良心的内网穿透,提供了免费的 DDoS 和 cc 防御非常的好用,下面为 Linux 搭建教程

1.安装cloudflared

在 Linux 终端 (ssh) 执行

wget -qO /tmp/cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i /tmp/cloudflared.deb && rm /tmp/cloudflared.deb

等待命令跑完,跑完我们就开始执行第二步

2.登录cloudflare账号

这一步是对有域名账号提供的,如果你要临时域名看文章最后

执行

cloudflared tunnel login

然后他会给你一个链接,电脑 / 手机打开链接,登录,并且授权域名,他会提示你上传证书,up 觉得直接复制证书内容,然后在终端执行

mkdir -p /root/.cloudflared && cat > /root/.cloudflared/cert.pem << 'EOF'
证书内容
EOF

就可以了

3.创建隧道

执行

cloudflared tunnel create 隧道名字

隧道名字填你想要的

然后回车

4.绑定域名

执行

cloudflared tunnel route dns 你前面填的隧道名字 你的域名

回车

5.获取隧道UUID

执行

cloudflared tunnel list

把出来的 UUID 复制后面要用

6.编写配置文件

执行

cat > ~/.cloudflared/config.yml << 'EOF'
tunnel: mytunnel
credentials-file: /root/.cloudflared/你的隧道UUID.json
ingress:
  - hostname: 你的域名
    service: http://localhost:你要穿透的端口
  - service: http_status:404
EOF

回车

7.启动隧道!

执行

nohup cloudflared tunnel run 隧道名字 > /tmp/cloudflared.log 2>&1 &

回车

这样就启动了,这个意思是在后台运行,断开 ssh 也不会停止隧道

8.(可选)设置开机自启动

执行

sudo cloudflared service install

回车

其他指令

停止隧道

pkill cloudflared

查看实时日志

tail -f /tmp/cloudflared.log

11.临时域名讲解

执行

nohup cloudflared tunnel --url http://localhost:端口号 > /tmp/cloudflared.log 2>&1 &

然后执行

cat /tmp/cloudflared.log | grep -o 'https://[a-z-]*\.trycloudflare\.com'

查看生成域名

12.总结

想必你一定会了内网穿透了吧,再说一句,临时域名不适合长期使用哦,建议去买域名

比如数字域名.xyz 这种域名便宜

不足点

晚高峰网站延迟非常大,还有中国大陆没有优化

支持与分享

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

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

评论