白嫖Cloudflare实现内网穿透

1、Cloudflare账号,注册地址:https://www.cloudflare.com
2、下载 Cloudflare可执行文件 下载地址:https://github.com/cloudflare/cloudflared/releases
3、提前在Cloudflare中添加自己的域名

被控端电脑配置

将上述下载的cloudflared-windows-amd64.exe 重命名为cloudflared.exe,方便操作。

1、在当前目录打开 cmd 窗口,输入如下命令进行登录验证,会自动打开游览器进行登录

cloudflared login

登录完成之后会在 C:\Users\%USERNAME%\.cloudflared 目录下生成登录凭证

2、创建隧道,随意自定义名称

cloudflared.exe tunnel create rdpName #此会在 [C:\Users\%USERNAME%\.cloudflared] 中生成一个【guid】.json

3、打开cloudflared.exe同级目录的config.yml,改为如下:

# 隧道的 UUID, 就是登录凭证的json文件名称 tunnel: <guid> # 鉴权文件的全路径 credentials-file: C:\Users\%USERNAME%\.cloudflared\【guid】.json ingress: # rdp - hostname: 二级域名.domian.com service: rdp://localhost:3389 # http 在cloudflare中添加一条CName记录指向 【guid】.cfargotunnel.com 即可 - hostname: 另一个二级域名.domian.com service: http://localhost:80 # 默认错误404 - service: http_status:404

3.1 添加一个http记录

注意:添加的解析记录内容为上一步生成的 【guid】.cfargotunnel.com

4、开启服务

cloudflared -config=D:\02Software\cloudflare\config.yml tunnel run

开启被控端的开机自启

以管理员身份打开cmd, 进入cloudflared.exe所在目录,执行如下命令,注册成服务

cloudflared service install

打开注册表regedit.exe,在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services找到 Cloudflared
ImagePath 修改为 D:\02Software\cloudflare\cloudflared.exe -config=D:\02Software\cloudflare\config.yml tunnel run 注意替换自己路径

再打开Windows服务services.msc,找到 cloudflared agent 右键 重新启动。

控制端电脑配置

同样需要下载cloudflared-windows-amd64.exe,打开cmd
执行:

cloudflared.exe access rdp --hostname 二级域名.domian.com --url localhost:3000

然后在控制端win+r输入mstsc,输入localhost:3000即可访问远程了。(有一点慢,如果打不开的话,试着用一点魔法,╮(╯▽╰)╭)


__EOF__

本文作者徐徐赵赵
本文链接https://www.cnblogs.com/xuxuzhaozhao/p/17251949.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   xuxuzhaozhao  阅读(3397)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示