Linux科学代理
官方文档: https://v2raya.org/docs/prologue/quick-start/ 安装v2ray内核,使用镜像脚本(不通过添加软件源安装)
# v2rayA 提供的镜像脚本
curl -Ls https://mirrors.v2raya.org/go.sh | sudo bash
# 安装后可以关掉服务,因为 v2rayA 不依赖于该 systemd 服务
sudo systemctl disable v2ray --now
1. 安装
1.1 Fedora
# 添加 copr 源
sudo dnf copr enable zhullyb/v2rayA
# 安装 V2Ray 内核
sudo dnf install v2ray-core
# 安装 v2rayA
sudo dnf install v2raya
# 启动
sudo systemctl start v2raya.service
# 设置开机自启
sudo systemctl enable v2raya.service
1.2 Debian
请先通过顶上的方法安装v2ray内核
# 添加公钥
wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/v2raya.asc
# 添加 V2RayA 软件源
echo "deb https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list
sudo apt update
# 安装 V2RayA
sudo apt install v2raya
# 启动
sudo systemctl start v2raya.service
# 设置开机自启
sudo systemctl enable v2raya.service
切换 iptables 为 iptables-nft 对于 Debian11 用户来说,iptables 已被弃用。使用 nftables 作为 iptables 的后端以进行适配
update-alternatives --set iptables /usr/sbin/iptables-nft
update-alternatives --set ip6tables /usr/sbin/ip6tables-nft
update-alternatives --set arptables /usr/sbin/arptables-nft
update-alternatives --set ebtables /usr/sbin/ebtables-nft
如果你想切换回 legacy 版本
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
update-alternatives --set arptables /usr/sbin/arptables-legacy
update-alternatives --set ebtables /usr/sbin/ebtables-legacy
切换后重启即可
2. 使用
通过 2017 端口 如 http://localhost:2017 访问 UI 界面 记得调整防火墙
2.1 创建管理员账号
2.2 导入节点
vmess://ew0KICAidiI6ICIyIiwNCiAgInBzIjogIlZtZXNzIiwNCiAgImFkZCI6ICJwYW4uZ29zc2lwLnRrIiwNCiAgInBvcnQiOiAiNDQzIiwNCiAgImlkIjogIjcyNTQ0Nzk0LTRhYWUtNGVmNy1jMmRhLTUxOTRjN2RkOGI4NSIsDQogICJhaWQiOiAiMCIsDQogICJzY3kiOiAiYXV0byIsDQogICJuZXQiOiAid3MiLA0KICAidHlwZSI6ICJub25lIiwNCiAgImhvc3QiOiAicGFuLmdvc3NpcC50ayIsDQogICJwYXRoIjogIi9nb2ZpYyIsDQogICJ0bHMiOiAidGxzIiwNCiAgInNuaSI6ICIiLA0KICAiYWxwbiI6ICIiDQp9
2.3 启动
2.4 设置
2.5 开放代理端口
2.6 设置Linux代理
export ALL_PROXY=socks5://127.0.0.1:20170
# 取消代理
unset ALL_PROXY
2.7 使用proxychains设置代理(推荐)
安装
# Fedora
sudo dnf install proxychains-ng
# Debian
sudo apt install proxychains-ng
配置
vim /etc/proxychains.conf
socks5 127.0.0.1 20170
测试一下
[root@fedora ~]# proxychains curl cip.cc
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib64/proxychains-ng/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] Strict chain ... 127.0.0.1:20170 ... cip.cc:80 ... OK
IP : 198.23.149.5
地址 : 美国 华盛顿州 西雅图
运营商 : colocrossing.com
数据二 : 美国 | 纽约州伊利县威廉斯维尔村ColoCrossing有限公司
数据三 : 美国华盛顿西雅图
URL : http://www.cip.cc/198.23.149.5
简化使用命令
echo "alias pc='proxychains'" >> ~/.bashrc
source ~/.bashrc
[root@fedora ~]# pc curl cip.cc
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib64/proxychains-ng/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] Strict chain ... 192.168.211.99:20170 ... 122.51.162.249:80 ... OK
IP : 198.23.149.5
地址 : 美国 华盛顿州 西雅图
运营商 : colocrossing.com
数据二 : 美国 | 纽约州伊利县威廉斯维尔村ColoCrossing有限公司
数据三 : 美国华盛顿西雅图
URL : http://www.cip.cc/198.23.149.5
2.8 设置局域网使用
3. 浏览器代理
SwitchyOmega 等浏览器插件可为浏览器提供代理服务。