全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2841|回复: 19

[疑问] v2ray的路由功能真好用

[复制链接]
发表于 2019-12-8 10:51:33 | 显示全部楼层 |阅读模式
本帖最后由 zdszf 于 2019-12-8 16:38 编辑

花了一上午来看v2ray的说明,一点点的写配置,终于懂了个大概。尝试了动态端口+mkcp和ws+tls+web+cdn。ws套CDN速度和以前gost -L=ss+ohttp速度齐平,KCP速度和gost开kcp也没明显区别。

目前觉得最让我喜欢的是路由功能,比如从服务端屏蔽网站,转发特殊访问(比如把看NF的请求转发到原生VPS上)。

还有啥骚操作,大佬们指点下吧


美国VPS综合讨论: v2ray官方一键脚本支持小内存VPS安装的alpine吗? 试试先.

配置例子:
  1. # Usage:
  2. #   v2ray.server


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

  5. ############# server config #############
  6. vi /etc/v2ray/config.json
  7. {
  8.     "sniffing": {"enabled": true,"destOverride": ["http","tls"]},
  9.    
  10.     "inbounds":
  11.     [
  12.         {
  13.         "port": 1289,
  14.         "protocol": "vmess",
  15.         "settings": {"clients": [{ "id": "UUID","alterId": 32}]},
  16.         "detour": {"to": "dynamicPort"},
  17.         "streamSettings": {"network": "mkcp","kcpSettings": {"uplinkCapacity": 25,"downlinkCapacity": 100,"congestion": true,"header": {"type": "utp"}}}
  18.         },
  19.         
  20.         {
  21.         "port": "10000-20000",
  22.         "protocol": "vmess",
  23.         "tag": "dynamicPort",      
  24.         "settings": {"default": {"alterId": 32}},
  25.         "allocate": {"strategy": "random","concurrency": 3,"refresh": 5},
  26.         "streamSettings": {"network": "mkcp","kcpSettings": {"uplinkCapacity": 25,"downlinkCapacity": 100,"congestion": true,"header": {"type": "utp"}}}
  27.         }
  28.     ],
  29.    
  30.     "outbounds":
  31.     [
  32.         {
  33.         "protocol": "freedom",
  34.         "settings": {}
  35.         },
  36.         
  37.         {
  38.         "protocol": "blackhole",
  39.         "settings": {},
  40.         "tag": "block"
  41.         }
  42.     ],
  43.    
  44.     "routing":
  45.     {
  46.         "domainStrategy": "AsIs",
  47.         "rules":
  48.         [
  49.             {"type": "field","outboundTag": "block","protocol": ["bittorrent"]},
  50.             {"type": "field","outboundTag": "block","ip": ["geoip:private"]},
  51.             {"type": "field","outboundTag": "block","domain": ["geosite:qihoo360"]}
  52.         ]
  53.     }
  54. }
  55. ############# server config #############

  56. # active
  57. service v2ray restart

  58. ############# client config #############
  59. {
  60.     "inbounds":
  61.     [
  62.         {
  63.             "port": 1087,
  64.             "listen": "127.0.0.1",
  65.             "protocol": "socks",
  66.             "settings": {"udp": true}
  67.         },
  68.         
  69.         {
  70.         "port": 1089,
  71.         "listen": "0.0.0.0",
  72.         "protocol": "shadowsocks",
  73.         "settings": {"method": "chacha20","password": "123456","network": "tcp,udp"}
  74.         }
  75.     ],
  76.    
  77.     "outbounds":
  78.     [
  79.         {
  80.             "protocol": "vmess",
  81.             "settings": {
  82.                 "vnext":
  83.                 [
  84.                     {
  85.                         "address": "127.178.127.228",
  86.                         //"address": "277.185.613.314",
  87.                         "port": 1289,
  88.                         "users": [{"id": "UUID","alterId": 2}]
  89.                     }
  90.                 ]
  91.             },
  92.         
  93.             "mux": {"enabled": true,"concurrency": 128},
  94.         
  95.             "streamSettings": {"network": "mkcp","kcpSettings": {"uplinkCapacity": 5,"downlinkCapacity": 100,"congestion": true,"header": {"type": "utp"}}}
  96.         },
  97.    
  98.         {
  99.             "protocol": "freedom",
  100.             "tag": "direct",
  101.             "settings": {}
  102.         }
  103.     ],
  104.    
  105.     "dns": {
  106.         "servers":
  107.         [
  108.                         "8.8.8.8",
  109.             {"address": "223.5.5.5","port": 53,"domains": ["geosite:cn"],"expectIPs": ["geoip:cn"]},
  110.             "8.8.4.4",
  111.             "localhost"
  112.         ]
  113.     },
  114.    
  115.     "routing":
  116.     {
  117.         "domainStrategy": "IPIfNonMatch",
  118.         "rules":
  119.         [
  120.             {"type": "field","outboundTag": "direct","domain": ["geosite:cn"]},
  121.             {"type": "field","outboundTag": "direct","ip": ["geoip:cn","geoip:private"]}
  122.         ]
  123.     }
  124. }
  125. ############# client config #############
  126. 自己按需修改
复制代码
发表于 2019-12-8 11:06:38 | 显示全部楼层
路由还可以实现dns分流,国内走国内dns,国外用国外dns,还可以自定义规则等等,神器
发表于 2019-12-8 10:54:00 | 显示全部楼层
能教教咋用不
发表于 2019-12-8 10:55:37 | 显示全部楼层
用了之后腰也不疼了
发表于 2019-12-8 10:56:12 来自手机 | 显示全部楼层
配置发出来试试
发表于 2019-12-8 10:56:52 | 显示全部楼层
我试了下,感觉和55没什么差别啊
发表于 2019-12-8 11:03:59 来自手机 | 显示全部楼层
不知道说的什么,好像根本就用不上的样子
 楼主| 发表于 2019-12-8 11:04:24 | 显示全部楼层
wangjy 发表于 2019-12-8 10:56
我试了下,感觉和55没什么差别啊

所以我目前觉得最好用的是路由功能啊,SS没有
发表于 2019-12-8 11:05:06 来自手机 | 显示全部楼层
反向代理,类似frp
发表于 2019-12-8 11:07:35 | 显示全部楼层
一颗赛艇 发表于 2019-12-8 11:06
路由还可以实现dns分流,国内走国内dns,国外用国外dns,还可以自定义规则等等,神器 ...

这个在客户端实现挺好的吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-27 04:32 , Processed in 0.074786 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表