Linux 安装 WGCF 快速创建 Wireguard 协议的 WARP 代理节点为服务器添加 iPV4 和 iPv6
- Linux 相关
- 2025-02-14
- 206热度
- 0评论
介绍
wgcf 是 Cloudflare Warp 的非官方跨平台 CLI
Github 项目地址:https://github.com/ViRb3/wgcf
特征
- 注册新账户
- 更改许可证密钥以使用现有的 Warp+ 订阅
- 生成 WireGuard 配置文件
- 检查帐户状态
- 打印跟踪信息来调试 Warp/Warp+ 状态
如何使用
1.下载 WGCF
mkdir wgcf && cd wgcf
wget -O wgcf https://github.com/ViRb3/wgcf/releases/download/v2.2.23/wgcf_2.2.23_linux_amd64
2.赋予执行权限
chmod u+x wgcf
3.注册 WARP 账户
执行后选择 yes, 回车即可。
./wgcf register
4.生成 WireGuard 配置文件
./wgcf generate
配置文件详解
在 wgcf 里面会出现生成的 wgcf-profile.conf 文件,AllowedIPs = 0.0.0.0/0, ::/0 表示所有公网 ipv4 和 ipv6 的流量都会进行接管。Endpoint = engage.cloudflareclient.com:2408 中的 engage.cloudflareclient.com 是连接 Cloudflare 的对端,我们可以手动解析出来更换对端 ipv4 和 ipv6。
[Interface]
PrivateKey = yJv6GYch2o4xVYPi0Pmf1fw2zF0doSRvoC3pO03dOXE=
Address = 172.16.0.2/32, 2606:4700:110:80fa:699d:f283:fff9:b4b1/128
DNS = 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
MTU = 1280
[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = engage.cloudflareclient.com:2408
如果我们只需要 ipv4, 移除 ::/0, 下面是只接管 ipv4 的全部流量:
[Interface]
PrivateKey = yJv6GYch2o4xVYPi0Pmf1fw2zF0doSRvoC3pO03dOXE=
Address = 172.16.0.2/32, 2606:4700:110:80fa:699d:f283:fff9:b4b1/128
DNS = 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
MTU = 1280
[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/0
Endpoint = engage.cloudflareclient.com:2408
如果我们只需要 ipv6, 移除 0.0.0.0/0, 下面是只接管 ipv6 的全部流量:
[Interface]
PrivateKey = yJv6GYch2o4xVYPi0Pmf1fw2zF0doSRvoC3pO03dOXE=
Address = 172.16.0.2/32, 2606:4700:110:80fa:699d:f283:fff9:b4b1/128
DNS = 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
MTU = 1280
[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = ::/0
Endpoint = engage.cloudflareclient.com:2408
安装 Wireguard 客户端
以 Dbian 11 为例:
1.安装 sudo 和 lsb_release
apt install lsb-release -y
2.添加 backports 源
echo "deb http://deb.debian.org/debian $(lsb_release -sc)-backports main" | sudo tee /etc/apt/sources.list.d/backports.list
apt update
3.安装必要的网络工具
apt install iproute2 openresolv -y
4.安装 wireguard-tools (WireGuard 配置工具:wg、wg-quick)
apt install wireguard-tools --no-install-recommends
5.安装 wireguard 内核模块
apt install wireguard-dkms -y
开启 WARP
然后把 wgcf-profile.conf 复制到 /etc/wireguard, 修改文件名为 wgcf.conf
mv ./wgcf-profile.conf /etc/wireguard/wgcf.conf
开启隧道
wg-quick up wgcf
关闭隧道
wg-quick down wgcf
设置开机自启
systemctl enable wg-quick@wgcf