NaiveProxy 和 V2Ray 共存 Naive 流量走 Socks5 代理进 V2Ray 墙内 CN 域名和 IP 路由到黑洞 blackhole 或 WARP
需求
如果共享
所以需要把 墙内
而
思路
NaiveProxy
NaiveProxy 服务端 (Caddy)
upstream 参数可以指定流量的下一步出口
V2Ray 设置 inbound 和路由
参考
建立一个
具体实践
1. 先把 V2Ray 和 NaiveProxy 都搭好
V2Ray
Naive
2. Naive 服务端 (Caddy) 增加 Socks5 出口
修改
upstream socks5://127.0.0.1:1080
3. V2Ray 添加 Socks5 入口 inbound
编辑文件
注意跟在原有的这段后面要加个英文逗号,再写
{"listen": "127.0.0.1","port": 1080,"protocol": "socks","sniffing": {"enabled": true,"destOverride": ["http","tls"]},"settings": {"auth": "noauth","udp": false}}
检查一下
/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json --test
像这样显示 Configuration OK. 说明格式是正确的。
4. 重启 Naive 服务端 (Caddy) 和 V2Ray
service caddy restart
service v2ray restart
当通过
5. 修改 V2Ray 的路由设置
这里的修改方法就和其它教程里
我只举我自己的例子,让墙内
{"type": "field","outboundTag": "socks5-warp","domain": ["geosite:cn"]},{"type": "field","outboundTag": "socks5-warp","ip": ["geoip:cn"]},
重启
后记
第
--------
第
--------
开
config.json 文件示例
{"log": {"access": "/var/log/v2ray/access.log","error": "/var/log/v2ray/error.log","loglevel": "warning"},"inbounds": [{"listen": "127.0.0.1","port": 9877,"protocol": "vless","settings": {"clients": [{"id": "05b02aa-faa-447-bdd-06863aa8b84","level": 1,"alterId": 0}],"decryption": "none"},"streamSettings": {"network": "ws"},"sniffing": {"enabled": true,"destOverride": ["http","tls"]}},{"tag": "socks_proxy","port": 1080,"listen": "127.0.0.1","protocol": "socks","sniffing": {"enabled": true,"destOverride": ["http","tls"]},"settings": {"auth": "noauth","udp": false}}],"outbounds": [{"protocol": "freedom","settings": {"domainStrategy": "UseIP"},"tag": "direct"},{"protocol": "freedom","settings": {"domainStrategy": "UseIPv4"},"tag": "force-ipv4"},{"protocol": "freedom","settings": {"domainStrategy": "UseIPv6"},"tag": "force-ipv6"},{"protocol": "socks","settings": {"servers": [{"address": "127.0.0.1","port": 40000}]},"tag": "socks5-warp"},{"protocol": "blackhole","settings": {},"tag": "blocked"}],"dns": {"servers": ["https+local://8.8.8.8/dns-query","8.8.8.8","1.1.1.1","localhost"]},"routing": {"domainStrategy": "IPOnDemand","rules": [{"type": "field","ip": ["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.2.0/24","192.168.0.0/16","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","::1/128","fc00::/7","fe80::/10"],"outboundTag": "blocked"},{"type": "field","outboundTag": "socks5-warp","domain": ["geosite:cn"]},{"type": "field","outboundTag": "socks5-warp","ip": ["geoip:cn"]},{"type": "field","protocol": ["bittorrent"],"outboundTag": "blocked"}]}}
你好,文中的配置文件能全发一下吗?我目前配置 outbounds 出了点问题
回复删除你好。我更新了配置文件示例在文末。建议你先测试 json 文件格式无误事再查逻辑问题。
/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json --test
感谢您的分享,这解决了我的问题。谢谢。
删除不客气,很高兴帮到你!:)
删除