返回列表 發帖

Configuration samples of multiple vmess and shadowsocks accounts for V2Ray server

本帖最後由 角色 於 2019-2-5 16:22 編輯

一般安装,系统给你一套新的settings如port number和UUID (user and password一体化)。如果一个人,那么什么都不用set就可以用,只要把port number和UUID记下来就可以。

不过很快,你会开accounts给亲友用,怎样开呢?下面是一个configuration sample,你可以通过它加加减减。

官网:https://v2ray.com/

格式:https://v2ray.com/chapter_02/01_overview.html

Android mobile phone 用 BifrsotV (大部分功能都能实现)
iPhone 用shadowrocket (很多功能还没有支持)

Listing 1:V2Ray version:4.13+
  1. {
  2.   "log": {},
  3.   "api": {},
  4.   "dns": {},
  5.   "stats": {},
  6.   "routing": {},
  7.   "policy": {},
  8.   "reverse": {},
  9.   "inbounds": [],
  10.   "outbounds": [],
  11.   "transport": {}
  12. }
複製代碼
.

Listing 2: 第一次安装V2ray后的结果 Link 一个vmess account
Listing 3: V2Ray default server settings Link 一个vmess account

回復 1# 角色


    不好意思,我不太懂Linux, 如果在搬瓦工安装了V2Ray , 怎样access 及修改那个 config file? 是否好像以前 MS DOS  系统一样, 按 cd  /etc/v2ray/config.json 就可以进入这个 directory ? 可不可以先用 notepad 修改后 copy and paste 呢?

我看过 Linux 有个 Vim command, 是否要先学习 Liunx 才能玩 安装 V2Ray呢?

谢谢

TOP

回復 2# vpn-learner

不需要的,就是那几个指令。你不会vi,vim,你可以用nano,跟普通的notepad一样。

第一安装V2ray,成功后已经一set settings可以用,每次都不一样的。

TOP

回復 1# 角色

刚刚根据师兄以上的Scripts 在自己的 V2ray config.json file 修改,希望加上一个SS 的账号, 但是不成功,更令到我本来的V2ray 也 连不上了,我post我的scripts 如下图, 希望师兄们能告诉我那里出了问题:

   


谢谢!
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

本帖最後由 角色 於 2019-2-4 22:15 編輯

我发现有两个问题:

1. 第一行,有个“^g"
2. Shadowsocks the 加密有问题。你在v2ray确认一下spelling。

在下面网页:
https://www.v2ray.com/chapter_02/protocols/shadowsocks.html

里面说只有下面加密方式:

加密方式(其中 AEAD 加密方式在 V2Ray 3.0 中加入):
aes-256-cfb
aes-128-cfb
chacha20
chacha20-ietf
aes-256-gcm
aes-128-gcm
chacha20-poly1305 或称 chacha20-ietf-poly1305

TOP

回復 5# 角色

谢谢师兄,
    我用的是 chacha20-ietf , 不明你所指的加密有问题是什么意思? spelling 用问题是在哪里?

我试下删掉那^g  再试试,容后报告!

TOP

chacha20-ietf 不等于下面:

chacha20-poly1305 或称 chacha20-ietf-poly1305

还有你要打/usr/bin/v2ray/v2ray 看看error的位置。

TOP

本帖最後由 vpn-learner 於 2019-2-4 23:45 編輯

回復 7# 角色

打了 usr/bin/v2ray/v2ray  的command 后, 出了一讯息, 但仍不明白哪里出错?



line 14,invalid character, {  ??
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

本帖最後由 角色 於 2019-2-5 00:30 編輯

你看看,你漏了一个”}“,你数一下就知道了。

你跟Listing 1对比一下就会发现少了哪一个?

TOP

本帖最後由 角色 於 2019-2-5 16:37 編輯

第一次安装V2ray后的结果

Listing 2: Initial settings
  1. root@raspberrypi:/# bash <(curl -L -s https://install.direct/go.sh)
  2. Installing V2Ray v4.14.0 on armv7l
  3. Downloading V2Ray.
  4.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  5.                                  Dload  Upload   Total   Spent    Left  Speed
  6. 100   609    0   609    0     0    627      0 --:--:-- --:--:-- --:--:--   627
  7. 100 20.1M  100 20.1M    0     0   555k      0  0:00:37  0:00:37 --:--:--  871k
  8. Extracting V2Ray package to /tmp/v2ray.
  9. Archive:  /tmp/v2ray/v2ray.zip
  10.   inflating: /tmp/v2ray/config.json  
  11.    creating: /tmp/v2ray/doc/
  12.   inflating: /tmp/v2ray/doc/readme.md  
  13.   inflating: /tmp/v2ray/geoip.dat   
  14.   inflating: /tmp/v2ray/geosite.dat  
  15.    creating: /tmp/v2ray/systemd/
  16.   inflating: /tmp/v2ray/systemd/v2ray.service  
  17.    creating: /tmp/v2ray/systemv/
  18.   inflating: /tmp/v2ray/systemv/v2ray  
  19.   inflating: /tmp/v2ray/v2ctl        
  20. extracting: /tmp/v2ray/v2ctl.sig   
  21.   inflating: /tmp/v2ray/v2ctl_armv7  
  22. extracting: /tmp/v2ray/v2ctl_armv7.sig  
  23.   inflating: /tmp/v2ray/v2ray        
  24. extracting: /tmp/v2ray/v2ray.sig   
  25.   inflating: /tmp/v2ray/v2ray_armv7  
  26. extracting: /tmp/v2ray/v2ray_armv7.sig  
  27.   inflating: /tmp/v2ray/vpoint_socks_vmess.json  
  28.   inflating: /tmp/v2ray/vpoint_vmess_freedom.json  
  29. PORT:23965
  30. UUID:f7054950-653f-4df9-afb5-782341cd6bbd
  31. V2Ray v4.14.0 is installed.
複製代碼
每次安装上面的PORT number和UUID都不一样。

还有V2Ray的defualt account是vmess protocol, 而这个code,这个port number和UUID可以多人使用都没有问题。

TOP

本帖最後由 角色 於 2019-2-5 16:35 編輯

V2Ray default settings

在Listing 2, 已经有port number和UUID,那么你不用看server config也可以用。如果你要看的话,可以用cat command
  1. cat /etc/v2ray/config.json
複製代碼
Listing 3: Default V2Ray Settings (/etc/v2ray/config.json)
  1. {
  2.   "inbounds": [{
  3.     "port": 23965,
  4.     "protocol": "vmess",
  5.     "settings": {
  6.       "clients": [
  7.         {
  8.           "id": "f7054950-653f-4df9-afb5-782341cd6bbd",
  9.           "level": 1,
  10.           "alterId": 64
  11.         }
  12.       ]
  13.     }
  14.   }],
  15.   "outbounds": [{
  16.     "protocol": "freedom",
  17.     "settings": {}
  18.   },{
  19.     "protocol": "blackhole",
  20.     "settings": {},
  21.     "tag": "blocked"
  22.   }],
  23.   "routing": {
  24.     "rules": [
  25.       {
  26.         "type": "field",
  27.         "ip": ["geoip:private"],
  28.         "outboundTag": "blocked"
  29.       }
  30.     ]
  31.   }
  32. }
複製代碼
.

TOP

本帖最後由 vpn-learner 於 2019-2-5 18:33 編輯

谢谢师兄!
今次学习了 VPS 有几个commands 对 setting V2ray 有需要:
1.  cd /etc/v2ray  #用来去V2ray的 directory(文件夹)去修改 config.json file
2.  systemctl start v2ray  #设定/修改 config.json 后 要最新启动V2ray。
3.  cat config.json   #查看config.json 的内容,方便纵览修改。
4.  systemctl status v2ray  #检查V2ray 的运行状态。
5.  /usr/bin/v2ray/v2ray  # 类似 debug , 帮你查出config.json 哪里出了问题。
6.  nano config.json   #类似wordstar 的editor, 用来修改 config.json.

7.  cp config.json backup.json  # 用来backup 多一个备份,以备不时之需
其他的希望师兄们能补充一下。

TOP

本帖最後由 角色 於 2019-2-5 17:36 編輯

如果大家能用上default的setting是进行科学上网,那么心情应该非常激动,很快想加accounts,例如多加vmess或者shadowsocks accunts。

在还没有加accounts时,希望大家对V2Ray的 configuration file "config.json"进行了解。在V2Ray术语里用节点 node去描述, 就是一个node,有input (inbunbds) 和 output(outbounds)。手机就是里的V2Ray是一个node A,而远方的服务为又是另外一个node B。整个data flow是这样,手机的App,介入node A的inbounds, 然后通过手机的outbounds接去远方的node B的inbounds,然后通过outbounds出去free world!(回来的路径就倒过来到手机APP)

我把default settings简化一点,让大家看到整理的外形:
  1. {
  2.   "inbounds": [],
  3.   "outbounds": [],
  4.   "routing": {}
  5. }
複製代碼
上面的简化版是否跟Listing 1非常接近,只不过有些没有用上。

我门加accounts,主要在 "inbounds": [],里,其他暂时不用理会。

TOP

本帖最後由 角色 於 2019-2-5 20:25 編輯

我把inounds,整段copy下来,
  1.   "inbounds": [{
  2.     "port": 23965,
  3.     "protocol": "vmess",
  4.     "settings": {
  5.       "clients": [
  6.         {
  7.           "id": "f7054950-653f-4df9-afb5-782341cd6bbd",
  8.           "level": 1,
  9.           "alterId": 64
  10.         }
  11.       ]
  12.     }
  13.   }],
複製代碼
然后我再整理一下:
  1.   "inbounds": [
  2.     {
  3.       "port": 23965,
  4.       "protocol": "vmess",
  5.       "settings": {
  6.         "clients": [
  7.           {
  8.             "id": "f7054950-653f-4df9-afb5-782341cd6bbd",
  9.             "level": 1,
  10.             "alterId": 64
  11.           }
  12.         ]
  13.       }
  14.     }
  15.   ],
複製代碼
继续整理一下
  1.   "inbounds": [
  2.     {
  3.       "port": 23965,
  4.       "protocol": "vmess",
  5.       .
  6.     }
  7.   ],
複製代碼
做到这里,我们再继续简化如下:
  1.   "inbounds": [
  2.     {
  3.       "protocol": "vmess",
  4.     }
  5.   ],
複製代碼
如果我们多加一个vmess,怎样加呢?
  1. "inbounds": [   
  2.     {
  3.       "protocol": "vmess",  #first vmess account
  4.     },    #这里要加一个comma,识别protocol还没有完,继续有second protocol:vmess
  5.     {
  6.       "protocol": "vmess", #second vmess account
  7.     }
  8. ],
複製代碼

TOP

本帖最後由 角色 於 2019-2-5 20:31 編輯

一个vmess account + 1个Shadowsocks account是怎样加,

我们先了解第14楼的帖子Link,那么我们第14楼的inbounds再整理一下如下:
  1. "inbounds": [   
  2.     {
  3.       "protocol": "vmess",  #first vmess account
  4.     },    #这里要加一个comma,识别protocol还没有完,继续有second protocol:vmess
  5.     {
  6.       "protocol": "shadownsocks", #first shadowsocks account
  7.     }
  8. ],
複製代碼
完整的inbounds
  1.   "inbounds": [
  2.     {
  3.       "port": 23965,
  4.       "protocol": "vmess",
  5.       "settings": {
  6.         "clients": [
  7.           {
  8.             "id": "f7054950-653f-4df9-afb5-782341cd6bbd",
  9.             "level": 1,
  10.             "alterId": 64
  11.           }
  12.         ]
  13.       }
  14.     },
  15.     {
  16.       "protocol": "shadowsocks",
  17.       "port": 10081,   #modified for a new one
  18.       "settings": {
  19.         "method": "chacha20-ietf-poly1305",
  20.         "password": “password-for-1st-ss-act",
  21.         "level": 1
  22.       }
  23.     }
  24.   ],
複製代碼

TOP

返回列表