root@OpenWrt:~# opkg update Downloading https://downloads.openwrt.org/releases/23.05.4/targets/ramips/mt7621/packages/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_core Downloading https://downloads.openwrt.org/releases/23.05.4/targets/ramips/mt7621/packages/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/base/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_base Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/base/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/luci/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_luci Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/luci/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/packages/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_packages Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/packages/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/routing/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_routing Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/routing/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/telephony/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_telephony Downloading https://downloads.openwrt.org/releases/23.05.4/packages/mipsel_24kc/telephony/Packages.sig Signature check passed.
root@OpenWrt:~# cloudflared tunnel login 2025-03-31T03:47:24Z ERR Configuration file /etc/cloudflared/config.yml was empty Please open the following URL and log in with your Cloudflare account:
Leave cloudflared running to download the cert automatically. 2025-03-31T03:48:21Z INF Waiting for login...
网页端登录
登录cloudflare,并复制路由器命令行下那一串链接到浏览器的另一个标签页打开。提示如下:
Authorize Tunnel for heiok.com
To finish configuring Tunnel for your zone, click Authorize below.
点击Authorize
浏览器界面显示
Success Cloudflared has installed a certificate allowing your origin to create a Tunnel on this zone.
You may now close this window and start your Cloudflare Tunnel!
路由器界面显示
You have successfully logged in. If you wish to copy your credentials to a server, they have been saved to: /root/.cloudflared/cert.pem root@OpenWrt:~#
建一条通道
1 2 3 4 5 6
root@OpenWrt:~# cloudflared tunnel create openwrt 2025-03-31T03:52:00Z ERR Configuration file /etc/cloudflared/config.yml was empty Tunnel credentials written to /root/.cloudflared/a41e4879-e5a8-4efa-9668-d31ed37585a5.json. cloudflared chose this file based on where your origin certificate was found. Keep this file secret. To revoke these credentials, delete the tunnel.
Created tunnel heiok with id a41e4879-e5a8-4efa-9668-d31ed37585a5 root@OpenWrt:~#
加域名解析
1 2 3 4
root@OpenWrt:~# cloudflared tunnel route dns openwrt openwrt.heiok.com 2025-03-31T03:52:56Z ERR Configuration file /etc/cloudflared/config.yml was empty 2025-03-31T03:53:00Z INF Added CNAME openwrt.heiok.com which will route to this tunnel tunnelID=a41e4879-e5a8-4efa-9668-d31ed37585a5 root@OpenWrt:~#