我的博客

配置 v2ray

目录
  1. 配置服务器
  2. 启动服务器程序
  3. 客户端

v2ray 下载地址:

https://github.com/v2ray/v2ray-core/releases

windows 客户端:

https://github.com/2dust/v2rayN

linux 客户端:

https://github.com/zghcxq/v2ray-linux-64

配置服务器

先在服务器上下载 v2ray

写配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"inbounds": [{
"port": 23581,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "ceb793e6-49cf-25d8-e4de-ae542e62748e",
"level": 1,
"alterId": 64
}
]
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}

启动服务器程序

启动命令 ./v2ray -config config.json

客户端

可以使用图形化客户端,很方便。

也可以使用官方客户端。

如果使用官方客户端,需要写配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
"log": {
"loglevel": "info"
},
"inbounds": [
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"udp": true // 开启 UDP 协议支持
}
},
{
"port": 8080,
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"tag": "proxy-vmess",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "8.8.8.8", // 服务器的 IP
"port": 443, // 服务器的端口
"users": [
{
// id 就是 UUID,相当于用户密码
"id": "7d4c4078-e129-416b-a483-cf5713a96a66",
"alterId": 4
}
]
}
]
}
},
{
"tag": "direct",
"settings": {},
"protocol": "freedom"
}
],
"dns": {
"server": [
"8.8.8.8",
"1.1.1.1"
],
// 你的 IP 地址,用于 DNS 解析离你最快的 CDN
"clientIp": "203.208.40.63"
},
// 配置路由功能,绕过局域网和中国大陆地址
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{
"type": "field",
"domain": [
// 默认跳过国内网站,如果想要代理某个国内网站可以添加到下列列表中
"cnblogs.com"
],
"outboundTag": "proxy-vmess"
},
{
"type": "field",
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
},
{
"type": "field",
"outboundTag": "direct",
"ip": [
"geoip:cn",
"geoip:private"
]
}
]
}
}

对于 linux 客户端,可以使用浏览器插件控制特定网站走代理

https://github.com/FelisCatus/SwitchyOmega/releases

参考:

https://tlanyan.me/v2ray-tutorial/

https://www.4spaces.org/digitalocean-build-v2ray-0-1/

https://yuan.ga/v2ray-complete-tutorial/

https://bainesing.wordpress.com/2019/10/25/linux%E9%85%8D%E7%BD%AEv2ray%E5%AE%A2%E6%88%B7%E7%AB%AF/

评论无需登录,可以匿名,欢迎评论!