安装wireguard等依赖

Debian
apt update -y && apt install wireguard sudo curl vim openresolv -y
Arch Linux
yay -S wireguard-tools openresolv wgcf vim dnsutils linux-headers --needed

安装wgcf

Debian
curl -fsSL git.io/wgcf.sh | sudo bash

注册账户

wgcf register

生成配置文件

wgcf generate

编辑配置文件

vim wgcf-profile.conf

配置文件样式

[Interface]
PrivateKey = 这里会自动生成
Address = 172.16.0.2/32
Address = 这里会自动生成
DNS = 8.8.8.8,8.8.4.4,2001:4860:4860::8888,2001:4860:4860::8844
MTU = 1280
[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
Endpoint = engage.cloudflareclient.com:2408

更改engage.cloudflareclient.com为IPV4/6地址(如双栈网络接入忽略)

[root@archlinux ~]# nslookup engage.cloudflareclient.com
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
Name:   engage.cloudflareclient.com
Address: 162.159.192.1
Name:   engage.cloudflareclient.com
Address: 2606:4700:d0::a29f:c001

接入WARP IPV4

删除配置文件中的AllowedIPs = ::/0

接入WARP IPV6

删除配置文件中的AllowedIPs = 0.0.0.0/0

启动wireguard

复制配置文件到wireguard文件夹

cp wgcf-profile.conf /etc/wireguard/wgcf.conf

启动 wireguard

wg-quick up wgcf

检查网络连通

# IPv4 Only VPS
curl -6 ip.p3terx.com
# IPv6 Only VPS
curl -4 ip.p3terx.com

关闭wgcf接口

wg-quick down wgcf

将wireguard启用守护进程

systemctl start wg-quick@wgcf
systemctl enable wg-quick@wgcf

参考
P3terx
企鹅大大

Last modification:November 2, 2023
如果觉得我的文章对你有用,麻烦点个赞吧 !