電訊茶室's Archiver

角色 發表於 2019-2-22 22:23

V2Ray使用教程——基础概念1

[i=s] 本帖最後由 角色 於 2019-3-1 18:52 編輯 [/i]

基本概念1——Single inbound and single outbound V2Ray node (SI-SO-VN)

我知道这里有不少人都使用过V2Ray,但是对于一名新丁来说,都不知道V2Ray是什么,怎样用?

[attach]4291[/attach]

如果我们在中国大陆,需要科学上网看看一些资料和朋友联系,我们一般都是通过浏览器上网登入。但是很多时候很多外国网页都打不开,因为中间有一面互联网的墙挡住了,中断了我们要去的网站,那么我们怎样办呢?

在一般情况下我们用传统的VPN都能解决问题,但是很多VPN的握手都有一定的特征,如果阿爷看到这样的特征就会把数据掐掉,导致很多VPN技术都不能用!就这个情况下,因为要科学上学学习需要,在中国大陆有些大神研发出Shadowsocks,但是早期的Shadowsocks技术没有更新,阿爷侦测到后,导致开发者被要求去喝茶,从那个时候开始,那位开发者再没有出现了,但是他的源码已经流入民间,于是出现SSR等等Proxy client-server。

后面再有高人把整个科学上网概念作全新的演绎,建立出V2Ray(Project V)。

角色 發表於 2019-2-22 22:36

在学习V2Ray,第一个网站一定要去看是官网:[url]https://www.v2ray.com[/url]。

还有白话文:[url]https://toutyrater.github.io[/url]

还有作者的blog:[url]https://steemit.com/@v2ray[/url]

角色 發表於 2019-2-22 22:43

[i=s] 本帖最後由 角色 於 2019-2-24 13:19 編輯 [/i]

安装V2Ray,client和server的program都是一样,它们不同的地方就是它们的configuration file——config.json,所以学好怎样configure是非常关键。

在[1],你可以看到configuration file的总貌:[code]
{
  "log": {},
  "api": {},
  "dns": {},
  "stats": {},
  "routing": {},
  "policy": {},
  "reverse": {},
  "inbounds": [],
  "outbounds": [],
  "transport": {}
}
[/code].

一般的settings,我们用inbounds,outbounds和routing比较多。[code]
{
  "routing": {},
  "inbounds": [],
  "outbounds": []
}
[/code].

在某些情况,我们都可以把routing省略,变成:[code]
{
  "inbounds": [],
  "outbounds": []
}
[/code].

在最前的列表项数会随着时间而增加。

怎样安装V2Ray,大家可以看官网和白话文就可以。

References:
[1] [url]https://v2ray.com/chapter_02/01_overview.html[/url]

角色 發表於 2019-2-22 22:57

在学习V2Ray时,我们要安装两个V2Ray软件(V2Ray node,简化VN),最左手边的PC接入第一V2Ray Node (VN1),然后VN1接去自由世界的V2Ray Node (VN2),VN2接入所需要看的网站。

[attach]4292[/attach]

角色 發表於 2019-2-22 23:07

为了简化后面的说话,我把VN1和VN2画出来,如下图:

[attach]4293[/attach]

上面每一个node(节点)一分为二,左手边是inbound,而右手边是outbound。简单来说,

PC ---> VN1 inbound ---> VN1 outbound ---> VN2 inbound ---> VN2 outbound ---> websites

角色 發表於 2019-2-22 23:11

根据上面的信息和文件格式[1], 我们有下面两个config.json files

VN1 configuration file config.json[code]
{
  "inbounds": [],
  "outbounds": [],
}
[/code],

VN2 configuration file config.json[code]
{
  "inbounds": [],
  "outbounds": [],
}
[/code]References:
[1] [url]http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&ptid=7370&pid=46295[/url]

角色 發表於 2019-2-22 23:13

VN1 configuration file config.json[code]
{
  "inbounds": [
    {
      "port": 1081,  
      "protocol": "socks"
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "VN2 IP address or hostname",
            "port": 10086,
            "users": [
              {"id": "UUID" }
            ]
          }
        ]
      }
    }
  ]
}
[/code]

角色 發表於 2019-2-22 23:15

VN2 configuration file config.json contains[code]
{
  "inbounds": [
    {
      "port": 10086,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "UUID",
            "level": 1,
            "alterId": 64
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}
[/code]

角色 發表於 2019-2-22 23:22

[i=s] 本帖最後由 角色 於 2019-2-23 09:01 編輯 [/i]

测试结果:

1、能科学上网,还有resolve hostname会VN2的name servers。
2、因为VN1中间没有routing,inbound --> direct connect (without routing) ---> outboud, 所以上CCTV5和爱奇艺都用中国大陆地区以外的IP看,画面会显示你不在服务器内看。要解决这个问题,VN1必须加routing,把大陆的hostname and IP都不经VN2走,直接走local就可以,怎样做?留待下一个tutorial。

Remarks:
1、你的DNS server IP需要设为8.8.8.8,如果你用114.114.114.114,VN1会先送到外面,再从外面再回来中国大陆,还有解出来的IP分分钟有污染。

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.