xixiha's Blogs

https://github.com/xixiha5230/

0%

v2ray+wireguard+warp实现流媒体解锁

适用于 Debian 10

v2ray

安装

1
2
3
4
5
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh

sudo chmod u+x install-release.sh

sudo bash install-release.sh

配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"inbounds": [
{
"port": 10809,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "UUID",
"level": 0,
"email": "email"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"path": "/path"
}
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
}
],
"outbounds": [
{
"tag": "default",
"protocol": "freedom"
}
]
}

重启、开机自启

1
2
3
sudo service v2ray restart

sudo systemctl enable v2ray

caddy

安装

1
2
3
4
5
6
7
8
9
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list

sudo apt update

sudo apt install caddy

配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
www.your_domain.com
{
log {
output file /var/log/caddy/caddy.log
}
tls email@gmail.com
root * /home/user/web
try_files /home/user/web/index.html
@websockets {
header Connection Upgrade
header Upgrade websocket
}
reverse_proxy @websockets localhost:10809
}

wgcf

安装

1
2
3
4
5
6
7
wget https://github.com/ViRb3/wgcf/releases/tag/v2.2.17

tar -zcvf wgcf_2.2.17_linux_amd64

sudo mv wgcf_2.2.17 /user/local/bin/wgcf

sudo chmod u+x /user/local/bin/wgcf

注册

1
wgcf register

The new account will be saved under wgcf-account.toml

生成wireguard配置文件

1
wgcf generate

The WireGuard profile will be saved under wgcf-profile.conf.

WireGuard

参考

升级debian内核

1
2
3
4
5
6
7
8
echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list

apt update
apt -t buster-backports install linux-image-amd64
apt -t buster-backports install linux-headers-amd64
update-grub

shutdown -r now

卸载旧内核

1
2
3
4
5
6
uname -r

dpkg --list | grep linux-image
apt -y remove --purge $(dpkg -l | grep linux-image | awk '{print$2}' | grep -v $(uname -r))

dpkg --list | grep linux-headers

安装

1
2
3
4
echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list
sudo apt update

sudo apt install wireguard

配置文件wgcf-profile.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[Interface]
PrivateKey = XXXXXXXX
Address = 172.16.0.2/32
Address = XXXX:XXXX:XXXX:XXXX/128
PostUp = ip rule add from xx.xx.xx.xx(vps主网卡的ipv4)lookup main # v4 機器要雙棧接管的話要加上這行规则
PostDown = ip rule del from xx.xx.xx.xx(vps主网卡的ipv4)lookup main # v4 機器要雙棧接管的話要加上這行规则
PostUp = ip rule add from xx.xx.xx.xx(vps主网卡的ipv6)lookup main # v6 機器要雙棧接管的話要加上這行规则
PostDown = ip rule del from xx.xx.xx.xx(vps主网卡的ipv6)lookup main # v6 機器要雙棧接管的話要加上這行规则
DNS = 1.1.1.1
MTU = 1280
[Peer]
PublicKey = XXXXXXXX
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
EndPoint = engage.cloudflareclient.com:2408
#EndPoint = 162.159.192.1:2408
#EndPoint = 2606:4700:d0::a29f:c001:2408

根据不同的需求,有不同的地方需要修改 - IPv4 Only VPS

接管出口 VPS IP AllowedIPs Endpoint PostUp/PostDown
v4 v4 刪掉 ::/0 改成 v4 地址 加 v4 規則
v6 v4 刪掉 0.0.0.0/0 改成 v4 地址 不用加
v4+v6 v4 不用刪 改成 v4 地址 加 v4 規則

根據不同的需求,有不同的地方需要修改 - IPv6 Only VPS

接管出口 VPS IP AllowIPs Endpoint PostUp/PostDown
v4 v6 刪掉 ::/0 改成 v6 地址 不用加
v6 v6 刪掉 0.0.0.0/0 改成 v6 地址 加 v6 規則
v4+v6 v6 不用刪 改成 v6 地址 加 v6 規則

根據不同的需求,有不同的地方需要修改 - IPv4/IPv6 Dual Stack VPS

接管出口 VPS IP AllowedIPs Endpoint PostUp/PostDown
v4 v4+v6 刪掉 ::/0 不用改 加 v4 規則
v6 v4+v6 刪掉 0.0.0.0/0 不用改 加 v6 規則
v4+v6 v4+v6 不用刪 不用改 加 v4/v6 規則

复制配置文件并重启

1
2
3
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
sudo systemctl enable wg-quick@wgcf
sudo systemctl start wg-quick@wgcf

测试

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