-
安装V2Ray:
- Linux:运行安装脚本:
bash <(curl -fsSL https://raw.githubusercontent.com/v2ray/v2ray-install/master/v2ray-install-linux.sh)
- Windows:下载并运行安装包,通常是v2ray-win-64bit.exe。
- Linux:运行安装脚本:
-
启动V2Ray服务:
- 启动服务并确保它在后台运行:
systemctl start v2ray@v2ray systemctl enable v2ray@v2ray
- 启动服务并确保它在后台运行:
-
配置DNS解析:
- 打开V2Ray的配置文件,通常位于
/etc/v2ray/dnsmasq.conf。 - 根据需求选择DNS类型:
- DNS64(访问国内网站):
[domain] 114.114.114.114 180.76.76.76
- DNS-over-HTTPS/DNS-over-TCP(访问国际网站):
[domain] 8.8.8.8 8.8.4.4
- DNS64(访问国内网站):
- 打开V2Ray的配置文件,通常位于
-
设置网络路由:
- 在
/etc/v2ray/router.json中添加路由规则:{ "domain": "baidu.com", "ip": "114.114.114.114", "mask": 32, "tag": "Baidu" }, { "domain": "qq.com", "ip": "180.76.76.76", "mask": 32, "tag": "QQ" }
- 在
-
启用socks代理(可选):
- 在配置文件中启用socks:
[socks] enable: true name: V2Ray port: 108 listen: 0...
- 在配置文件中启用socks:
-
重新启动V2Ray服务:
systemctl restart v2ray@v2ray
-
测试配置:
- 使用浏览器访问被封锁网站,如https://baidu.com或https://qq.com。
- 检查socks代理是否正常工作,例如使用socks客户端访问国内网站。
通过以上步骤,您可以根据需求配置V2Ray来绕过网络限制,确保顺利访问所需网站或服务。









