V2ray配置前置代理/代理链/链式代理转发

最近需要配置长连接跳板主机。大概的topology是这样的:

主要原因就是防火墙右侧主机设置了白名单,而左侧的服务器创建加密信道穿过防火墙,符合右侧服务器的白名单机制。

VPN配置很麻烦,而且很多国内地区禁用了VPN服务。

所以,用V2ray会简单很多。

V2ray的原理如下:

大概就是,用户主机通过SSR类型的前置代理链接左侧服务器,然后左侧服务器将流量通过VMess协议转发给防火墙右侧服务器。

配置如下:

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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
"inbounds": [
{
"tag": "local_socks5",
"port": 8000,
"protocol": "socks",
"settings": {
"auth": "noauth",
"timeout": 0
}
},
{
"tag": "dokodemo",
"listen": "127.0.0.1",
"port": 8888,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"address": "server2",
"port": 443
}
}
],
"outbounds": [
{
"tag": "s2-v2raymess",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "127.0.0.1",
"port": 8888,
"users": [
{
"id": "xxxx-xxxx-xxx-xxx",
"alterId": 64,
"email": "t@t.tt",
"security": "aes-128-gcm"
}
]
}
],
"servers": null,
"response": null
},
"streamSettings": {
"network": "ws",
"security": "tls",
"tlsSettings": {
"allowInsecure": true,
"serverName": "server2"
},
"tcpSettings": null,
"kcpSettings": null,
"wsSettings": {
"connectionReuse": true,
"path": "/data",
"headers": {
"Host": "server2"
}
},
"httpSettings": null,
"quicSettings": null
}
},
{
"tag": "ssr",
"protocol": "shadowsocks",
"settings": {
"vnext": null,
"servers": [
{
"email": null,
"address": "server1",
"method": "aes-256-cfb",
"ota": false,
"password": "pass",
"port": 29528,
"level": 1,
"users": null
}
],
"response": null
},
"streamSettings": {
"network": "tcp",
"security": null,
"tlsSettings": null,
"tcpSettings": null,
"kcpSettings": null,
"wsSettings": null,
"httpSettings": null,
"quicSettings": null
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"routing": {
"domainStrategy": "rules",
"rules": [
{
"type": "field",
"inboundTag": [
"local_socks5"
],
"outboundTag": "s2-v2raymess"
},
{
"type": "field",
"inboundTag": [
"dokodemo"
],
"outboundTag": "ssr"
}
]
}
}