VPS服务器无损部署Warp双栈解锁Netflix并解决Google验证码问题

By | 2023-01-08

安装WireGuard
Ubuntu 20.04
以下安装步骤以 Ubuntu 20.04 系统为例,其它系统可以参照官方安装介绍:https://www.wireguard.com/install/

更新软件包列表

apt update

安装依赖包

sudo apt -y install net-tools openresolv

安装WireGuard-tools

sudo apt install wireguard
Debian 10
apt install sudo lsb-release -y

添加backports源

echo “deb http://deb.debian.org/debian $(lsb_release -sc)-backports main” | sudo tee /etc/apt/sources.list.d/backports.list
sudo apt update

安装依赖包

sudo apt -y —no-install-recommends install net-tools iproute2 openresolv dnsutils linux-headers-$(uname -r)

安装WireGuard-tools

sudo apt —no-install-recommends install wireguard-tools wireguard-dkms
Debian10 部分内核下 linux-headers 无法通过 apt-get install linux-headers-$(uname -r) 完成安装,可尝试如下解决

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
reboot
sudo apt-get install linux-headers-$(uname -r) -y
安装wgcf
如果需要在VPS服务器上使用Warp,我们需要安装wgcf:https://github.com/ViRb3/wgcf

创建文件夹

mkdir warp && cd warp

安装wgcf「请自行根据当前Github最新版替换以下下载地址」

wget -O wgcf https://github.com/ViRb3/wgcf/releases/download/v2.2.4/wgcf_2.2.4_linux_amd64

赋予权限

chmod +x wgcf
配置

注册warp账户「回车选择Y同意协议」

./wgcf register

生成WireGuard配置文件

./wgcf generate
之后输入 ifconfig 查看当前VPS出口网卡的IP地址「下图红框部分」

VPS服务器无损部署Warp双栈解锁Netflix并解决Google验证码问题

输入 nano wgcf-profile.conf 并将下面2行内容添加到配置文件 [Interface] 部分的最后

PostUp = ip rule add from [上面查出的IP] lookup main
PostDown = ip rule delete from [上面查出的IP] lookup main
最终的格式效果样式应该如下:

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxx
Address = xxx.xx.x.x/xx
Address = xxxx:xxxx:xxxx:xxxx:xxx:xxx:xxxx:xxxx/xxx
DNS = 1.1.1.1
MTU = xxxx
PostUp = ip rule add from xxx.xx.xxx.xxx lookup main
PostDown = ip rule delete from xxx.xx.xxx.xxx lookup main
[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
Endpoint = engage.cloudflareclient.com:2408
将生成的 wgcf-account.toml 及 wgcf-profile.conf 文件保存好

一定需要添加好 PostUP 及 PostDown 规则,否则启动后可能存在失联风险,因为warp将接管VPS的ipv4及ipv6地址。
启动WireGuard
将上述生成的 wgcf-profile.conf 文件复制到 /etc/wireguard/ 目录下并重命名为 wgcf.conf

重命名并复制配置文件

sudo cp wgcf-profile.conf /etc/wireguard/wgcf.conf
我们输入 sudo wg-quick up wgcf 启动,检查是否有报错,如果没有报错,我们输入 ip a 命令应该能够看到 wgcf 的网络接口,类似如下

VPS服务器无损部署Warp双栈解锁Netflix并解决Google验证码问题

我们确认完成后,输入 sudo wg-quick down wgcf 停止运行

后台运行

启用守护进程

sudo systemctl start wg-quick@wgcf

设置开机启动

sudo systemctl enable wg-quick@wgcf

查看状态

sudo systemctl status wg-quick@wgcf

停止

sudo systemctl stop wg-quick@wgcf

重启

sudo systemctl restart wg-quick@wgcf
运行后,我们也可以通过如下命令查看相应的 IPv4 及 IPv6 地址

IPv4

wget -qO- ip.gs

IPv6 Only VPS

wget -qO- -6 ip.gs
如果ipv4检测显示的地址为 8.xxx 开头的ip地址,即为成功。

一定概率下,启动后VPS会完全没网,这时只需通过 sudo systemctl restart wg-quick@wgcf 重启服务再次尝试即可。不确定什么原因导致
测试Netflix解锁
apt install curl jq -y
bash <(curl -sSL “https://github.com/CoiaPrant/MediaUnlock_Test/raw/main/check.sh“)
VPS服务器无损部署Warp双栈解锁Netflix并解决Google验证码问题