按日期归档:2021 年 3 月 31 日

Debian10给VPS添加IPV6访问可解锁Netflix以及解除google验证码(内核级)

——————————— debian初始化——————————— 

wget http://coolaj.cn/tools/Debian10.list

sudo mv Debian10.list /etc/apt/sources.list

sudo apt update && sudo apt upgrade -y

apt install libgd3 libgd-dev -y

apt install gcc automake autoconf libtool make -y

 

——————————— WGCF安装——————————— 

#弄个文件夹方便管理相关文件

mkdir wgcf

cd wgcf

#下载对应程序

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

#添加执行权限

chmod +x wgcf

#注册WARP账户

./wgcf register

#生成WireGuard配置文件

./wgcf generate

sed -i "s/AllowedIPs = 0.0.0.0\/0//" wgcf-profile.conf

———————————  WGCF加载———————————

apt-get install sudo net-tools openresolv -y
#Debian添加unstable源
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
#debian更新源并安装
apt-get update
apt-get install wireguard-dkms wireguard-tools
#加载内核模块
modprobe wireguard
#检查WG模块加载是否正常
lsmod | grep wireguard
cat wgcf-profile.conf >/etc/wireguard/wgcf.conf
#开启隧道
sudo wg-quick up wgcf
#关闭隧道
sudo wg-quick down wgcf
#查看是否显示V6IP
ifconfig

V2配置参考下方文章的六

CentOS7给VPS添加IPV6访问可解锁Netflix以及解除google验证码

CentOS7给VPS添加IPV6访问可解锁Netflix以及解除google验证码

一、安装wireguard-go

Github地址:https://github.com/WireGuard/wireguard-go

编译安装

一些需要的软件yum install -y wget git make

如果是debian/ubuntu:apt install -y wget git make

1.安装golang1.16

wget https://golang.org/dl/go1.16.1.linux-amd64.tar.gz

tar xvf go1.16.1.linux-amd64.tar.gz -C /usr/local

cat <<EOF >> /etc/profile

#golang env config

export GO111MODULE=on

export GOROOT=/usr/local/go 

export GOPATH=~/gopath

export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

EOF

source /etc/profile

 

2.拉取代码并编译

git clone https://git.zx2c4.com/wireguard-go.git

git checkout 0.0.20201118

cd wireguard-go

make

mv wireguard-go /usr/local/sbin

#下载编译好的二进制文件安装

#一些需要的软件yum install -y wget

#如果是debian/ubuntu:apt install -y wget

wget https://github.com/peng4740/wireguard-go-builder/releases/download/0.0.20201118/wireguard-go-linux-amd64.tar.gz

tar zxf wireguard-go-linux-amd64.tar.gz

mv wireguard-go /usr/local/sbin

rm -f wireguard-go-linux-amd64.tar.gz

 

二、安装wgcf

这个是用来生成warp配置的

Github地址:https://github.com/ViRb3/wgcf

安装

wget https://github.com/ViRb3/wgcf/releases/download/v2.2.2/wgcf_2.2.2_linux_amd64 -O /usr/local/sbin/wgcf

chmod +x /usr/local/sbin/wgcf

 

三、用wgcf生成配置

echo|wgcf register

wgcf generate

sed -i '/0\.0\.0\.0\/0/d' wgcf-profile.conf

#sed -i '/\:\:\/0/d' wgcf-profile.conf # 如果是IPV6VPS要添加IPV4则改用这个,上一条不要执行

mkdir -p /etc/wireguard

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

 

安装wireguard-tools

CentOS7:yum install -y wireguard-tools

如果提示找不到包安装失败了可能是没有epel源,先安装yum install epel-release -y

其他系统其实也是差不多的

Debian、Ubuntu:apt install wireguard

没说到系统可参考官网教程:https://www.wireguard.com/install/

四、运行测试

1.启动

wg-quick up wgcf

#如果运行完就失联了(VPS的SSH终端没反应了)。先重启VPS,检查一下配置有没有问题。

#提示没有权限解决方案

vi /etc/sysctl.conf 

#修改disable_ipv6的所有变成0

#然后

/sbin/sysctl -p

 

当然,也不用太担心,如果你没漏掉什么步骤,一般是不会有事的。

2.测试

curl ipv6.ip.sb

 

如果能正常显示ip就正常

五、配置开机自启(务必要运行测试过后再配置)

systemctl enable wg-quick@wgcf

六、配置V2,增加ipv6的解析

1. "outbounds": 
2.         [
3.                 {"protocol": "freedom","tag": "direct","settings": {}},
4.                 {"protocol": "freedom","tag": "directv6","settings": {"domainStrategy": "UseIPv6"}},
5.                 {"protocol": "blackhole","tag": "blocked","settings": {}},
6.                 {"protocol": "freedom","tag": "twotag","streamSettings": {"network": "domainsocket","dsSettings": {"path": "/usr/local/etc/xray/ss","abstract": true}}}
7.         ],
8. 
9.         "routing": 
10.         {
11.                 "rules": 
12.                 [
13.                         {"type": "field","outboundTag": "directv6","domain": ["geosite:netflix","geosite:google"]},
14.                         {"type": "field","inboundTag": ["onetag"],"outboundTag": "twotag"},
15.                         {"type": "field","outboundTag": "blocked","ip": ["geoip:private"]},
16.                         {"type": "field","outboundTag": "blocked","domain": ["geosite:private","geosite:category-ads-all"]}
17.                 ]
18.         }