437 字
1 分钟
内网穿透 Cloudflare Tunnels
Cloudflare Tunnels
Cloudflare Tunnel(原名 Argo Tunnel)是 Cloudflare 推出的一项安全网络技术,旨在将您的本地服务器(无论是家庭 NAS、本地 PC 还是私有云服务器)安全地连接到 Cloudflare 的全球网络,而无需在路由器上开启任何入站端口(Port Forwarding),也不需要公网 IP。
简单来说,它就像是在你的本地服务器和 Cloudflare 之间打通了一条专属的“地下秘密隧道”。
Windows(可搭配 WSL 使用)
1.登陆 cloudflare 账户启动Tunnels创建隧道,选择操作系统与架构,下载安装cloudflared-windows-amd64.msi
2.安装连接器,启动隧道服务:
方式1:
命令提示符:安装服务,本身并不负责建立连接,启动、停止、查看状态需要交给 Windows 系统自带的服务管理器(Service Control Manager)来处理:
cloudflared.exe service install <你的完整TOKEN>使用 Windows 系统的 PowerShell 命令启动服务:
Start-Service -Name "Cloudflared"方式2:
命令提示符:这是一个即时执行命令。当按下回车,程序立即开始联网、握手、建立隧道。
cloudflared.exe tunnel --protocol http2 run --token <你的完整TOKEN>3.Cloudflare配置映射关系:
-
Subdomain: 填入想访问的子域名(如 web)。
-
Domain: 选择个人域名(如 example.com)。
-
Service: 填入内网服务的本地地址。
-
Type: HTTP(最常用)。
-
URL: localhost:8080 或内网 IP 192.168.1.50:80。
-
停止服务指令:
net stop CloudflaredLinux(Ubuntu)
下载并安装 cloudflared
1.下载最新版
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb2.安装
sudo dpkg -i cloudflared-linux-amd64.deb3.创建并运行连接
临时测试(前台运行)
cloudflared tunnel --protocol http2 run --token <你的完整TOKEN>永久连接(注册为 Systemd 服务)
sudo cloudflared service install <你的完整TOKEN>查看cloudflared服务有没有正常运行:
sudo systemctl status cloudflared 分享
如果这篇文章对你有帮助,欢迎分享给更多人!
部分信息可能已经过时
相关文章 智能推荐










