0%

树莓派配置v2ray客户端

git用起来太慢了, 几乎不能用 , ss又经常被封端口, 并不是很稳, 使用最近很流行的v2ray试试

下载安装

使用一键安装脚本安装,参考v2ray官方教程-下载安装

1
2

bash <(curl -L -s https://install.direct/go.sh)

需要从github下载安装包, 可能会出现网络错误, 可能先从v2ray-core/releases将安装包v2ray-linux-arm.zip下载到树莓派, 使用--local参数从本地安装

1
2
3
wget -O v2ray_install.sh  https://install.direct/go.sh
chmod +x v2ray_install.sh
sudo ./v2ray_install.sh --local v2ray-linux-arm.zip

配置v2ray客户端

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
37
38
sudo su - root
cat > /etc/v2ray/config.json << EOF
{
"inbounds": [{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
}
}],
"outbounds": [{
"protocol": "vmess",
"settings": {
"vnext": [{
"address": "server ip",
"port": 10086,
"users": [{ "id": "b831381d-6324-4d53-ad4f-8cda48b30811" }]
}]
}
},{
"protocol": "freedom",
"tag": "direct",
"settings": {}
}],
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "direct"
}]
}
}
EOF

exit
# address改为服务端ip, port改为服务端端口, id改为服务端用户ID

开启v2ray服务

1
2
3
sudo systemctl start v2ray
pi@raspberrypi:~ $ ps -ef|grep v2ray
root 18007 1 0 14:20 ? 00:00:00 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json

使用ProxyChains-NG配置全局代理

切换到root用户编译安装proxychains-ng

1
2
3
4
5
git clone https://github.com/rofl0r/proxychains-ng.git
sudo su - root
cd /home/pi/proxychains-ng-master/
./configure
make && make install

添加配置:

1
2
3
4
5
6
7
cp ./src/proxychains.conf /etc/proxychains.conf

vim /etc/proxychains.conf

# 将最后的 socks4 127.0.0.1 9095 改为 socks5 127.0.0.1 1080

exit # 退出root用户

在需要使用代理的命令前面加上proxychains4, 如下

1
2
3
4
5
6
7
8
pi@raspberrypi:~/proxychains-ng-master $ curl ip.sb
113.xxx.xxx.xxx
pi@raspberrypi:~/proxychains-ng-master $ proxychains4 curl ip.sb
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/local/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain ... 127.0.0.1:1080 ... ip.sb:80 ... OK
34.92.xxx.xxx