内网穿透小工具介绍
背景
家庭宽带没有外网IP且路由器上WAN口分配的是内网IP(集中式光猫管理),此情况下无法通过路由器NAT将外网流量转发到内网主机,如有一些简单需求比如内网搭建一个应用服务器,提供给外部能临时访问的场景推荐使用以下工具来进行处理。
工具
下载
下载页面选择符合当前系统的版本下载。以下以windows操作系统amd64位为例。cloudflared-windows-amd64.exe
命令
cloudflared-windows-amd64.exe tunnel --url http://localhost:8080
# 将内网http协议,8080端口创建隧道,创建成功后会返回临时域名
2025-12-04T05:44:16Z INF Requesting new quick Tunnel on trycloudflare.com...
2025-12-04T05:44:27Z INF +--------------------------------------------------------------------------------------------+
2025-12-04T05:44:27Z INF | Your quick Tunnel has been created! Visit it at (it may take some time to be reachable): |
2025-12-04T05:44:27Z INF | https://tank-temp-provide-gig.trycloudflare.com |
2025-12-04T05:44:27Z INF +--------------------------------------------------------------------------------------------+
2025-12-04T05:44:27Z INF Cannot determine default configuration path. No file [config.yml config.yaml] in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp]
2025-12-04T05:44:27Z INF Version 2025.11.1 (Checksum 413f9b24dc6e61a455564651524f167b8ce29ac4ccd40703dea7af93cd37ed39)
2025-12-04T05:44:27Z INF GOOS: windows, GOVersion: go1.24.9, GoArch: amd64
2025-12-04T05:44:27Z INF Settings: map[ha-connections:1 protocol:quic url:http://localhost:8080]
2025-12-04T05:44:27Z INF cloudflared will not automatically update on Windows systems.
2025-12-04T05:44:35Z INF Generated Connector ID: 53bd7934-8f5b-435c-988d-526da48b5b0c
2025-12-04T05:44:42Z INF Initial protocol quic
2025-12-04T05:44:42Z INF ICMP proxy will use 192.168.10.3 as source for IPv4
2025-12-04T05:44:42Z INF ICMP proxy will use 2409:8a4d:c43:1fd0:58ec:456b:cf8c:330e in zone WLAN as source for IPv6
2025-12-04T05:45:05Z ERR Cannot determine default origin certificate path. No file cert.pem in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp]. You need to specify the origin certificate path by specifying the origincert option in the configuration file, or set TUNNEL_ORIGIN_CERT environment variable originCertPath=
2025-12-04T05:45:05Z INF cloudflared does not support loading the system root certificate pool on Windows. Please use --origin-ca-pool <PATH> to specify the path to the certificate pool
2025-12-04T05:45:05Z INF ICMP proxy will use 192.168.10.3 as source for IPv4
2025-12-04T05:45:05Z INF Tunnel connection curve preferences: [X25519MLKEM768 CurveP256] connIndex=0 event=0 ip=198.41.200.63
2025-12-04T05:45:05Z INF ICMP proxy will use 2409:8a4d:c43:1fd0:58ec:456b:cf8c:330e in zone WLAN as source for IPv6
2025-12-04T05:45:05Z INF Starting metrics server on 127.0.0.1:20241/metrics
2025-12-04T05:45:06Z INF Registered tunnel connection connIndex=0 connection=2b6ada60-3ac7-469f-b466-300970f821a6 event=0 ip=198.41.200.63 location=lax01 protocol=quic
# https://tank-temp-provide-gig.trycloudflare.com
# 直接外网访问即可
本文链接:https://www.jingber.cn/post/3893.html 转载需授权!

微信扫一扫,打赏作者吧~