服务器:v3.6
客户端:v3.5(V2RayX macOS 0.9.1)
使用 V2RayX 的 PAC 模式,然后使用 Safari 尝试访问 Google。
现象:Safari 浏览器提示“无法与服务器建立安全的连接”。
自己排查故障:服务器使用的是 WebSocket 模式。查看服务器 Nginx 的日志之后确定流量可以正常分流到 V2Ray,然后我开启 V2Ray 的日志功能,发现日志里面一直提示:rejected Proxy|VMess|Encoding: invalid user,反复修改服务器与客户端的加密方式以及 UUID 均无效。
可以正确浏览 Google 等网站。
服务器端配置:
{
"log": {
"loglevel": "debug",
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log"
},
"inbound": {
"port": 1086,
"listen":"127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "d8f8b495-601f-4626-951c-c7455902c032",
"alterId": 32,
"security": "chacha20-poly1305",
"level": 0
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/bea5f650-3827-4acc-85bc-d7671deddba5"
},
"headers": {
"Host": "domain.com"
}
}
},
"outbound": {
"protocol": "freedom",
"settings": {
}
}
}
客户端配置(注:Mac 版本配置文件在 ~/Library/Application Support/V2RayX/config.json):
{
"policy" : {
"levels" : {
"0" : {
"uplinkOnly" : 0
}
}
},
"dns" : {
"servers" : [
"8.8.8.8",
"8.8.4.4"
]
},
"outboundDetour" : [
{
"protocol" : "freedom",
"tag" : "direct",
"settings" : {
}
}
],
"inbound" : {
"listen" : "0.0.0.0",
"port" : 1080,
"protocol" : "socks",
"settings" : {
"auth" : "noauth",
"udp" : false,
"ip" : "127.0.0.1"
}
},
"inboundDetour" : [
{
"listen" : "0.0.0.0",
"allocate" : {
"strategy" : "always",
"refresh" : 5,
"concurrency" : 3
},
"port" : 1090,
"protocol" : "http",
"tag" : "httpDetour",
"domainOverride" : [
"http",
"tls"
],
"streamSettings" : {
},
"settings" : {
"timeout" : 0
}
}
],
"log" : {
"error" : "\/var\/folders\/1g\/wkgqmntx22a11b3t6lsv8kjm0000z8\/T\/cenmrev.v2rayx.log.DB266685-6537-404D-8099-FF6462DF630E\/error.log",
"loglevel" : "debug",
"access" : "\/var\/folders\/1g\/wkgqmntx22a11b3t6lsv8kjm0000z8\/T\/cenmrev.v2rayx.log.DB266685-6537-404D-8099-FF6462DF630E\/access.log"
},
"routing" : {
"strategy" : "rules",
"settings" : {
"domainStrategy" : "IPIfNonMatch",
"rules" : [
{
"port" : "1-52",
"type" : "field",
"outboundTag" : "direct"
},
{
"port" : "54-79",
"type" : "field",
"outboundTag" : "direct"
},
{
"port" : "81-442",
"type" : "field",
"outboundTag" : "direct"
},
{
"port" : "444-65535",
"type" : "field",
"outboundTag" : "direct"
},
{
"type" : "field",
"ip" : [
"0.0.0.0\/8",
"10.0.0.0\/8",
"100.64.0.0\/10",
"127.0.0.0\/8",
"169.254.0.0\/16",
"172.16.0.0\/12",
"192.0.0.0\/24",
"192.0.2.0\/24",
"192.168.0.0\/16",
"198.18.0.0\/15",
"198.51.100.0\/24",
"203.0.113.0\/24",
"::1\/128",
"fc00::\/7",
"fe80::\/10"
],
"outboundTag" : "direct"
}
]
}
},
"outbound" : {
"sendThrough" : "0.0.0.0",
"mux" : {
"enabled" : false,
"concurrency" : 8
},
"protocol" : "vmess",
"settings" : {
"vnext" : [
{
"address" : "domain.com",
"port" : 443,
"users" : [
{
"id" : "d8f8b495-601f-4626-951c-c7455902c032",
"alterId" : 32,
"security" : "chacha20-poly1305",
"level" : 0
}
],
"remark" : "Vultr VPS"
}
]
},
"streamSettings" : {
"network" : "ws",
"tcpSettings" : {
"header" : {
"type" : "none"
},
"connectionReuse" : false
},
"kcpSettings" : {
"header" : {
"type" : "none"
},
"mtu" : 1350,
"congestion" : false,
"tti" : 20,
"uplinkCapacity" : 5,
"writeBufferSize" : 1,
"readBufferSize" : 1,
"downlinkCapacity" : 20
},
"security" : "tls",
"tlsSettings" : {
"serverName" : "domain.com",
"allowInsecure" : false
},
"wsSettings" : {
"path" : "\/bea5f650-3827-4acc-85bc-d7671deddba5",
"connectionReuse" : false
}
}
}
}
/var/log/v2ray/error.log 文件中。服务器端错误日志:
...
2018/02/07 20:18:34 [Info]: Proxy|VMess|Inbound: invalid request from x.x.x.x:44360: Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:34 [Info]: App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
2018/02/07 20:19:08 [Info]: Proxy|VMess|Inbound: invalid request from x.x.x.x:45383: Proxy|VMess|Encoding: invalid user
2018/02/07 20:19:08 [Info]: App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
2018/02/07 20:19:09 [Info]: Proxy|VMess|Inbound: invalid request from x.x.x.x:45407: Proxy|VMess|Encoding: invalid user
2018/02/07 20:19:09 [Info]: App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
2018/02/07 20:19:10 [Info]: Proxy|VMess|Inbound: invalid request from x.x.x.x:45437: Proxy|VMess|Encoding: invalid user
2018/02/07 20:19:10 [Info]: App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
...
客户端错误日志:
...
2018/02/07 20:48:14 [Warning]: App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: failed to find an available destination > Retry: [Transport|Internet|WebSocket: failed to dial WebSocket > Transport|Internet|WebSocket: failed to dial to (wss://domain.com/bea5f650-3827-4acc-85bc-d7671deddba5): 502 Bad Gateway > websocket: bad handshake Transport|Internet|WebSocket: failed to dial WebSocket > Transport|Internet|WebSocket: failed to dial to (wss://domain.com/bea5f650-3827-4acc-85bc-d7671deddba5): > dial tcp: operation was canceled] > Retry: all retry attempts failed
...
/var/log/v2ray/access.log 文件中。...
2018/02/07 20:17:57 x.x.x.x:43338 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:02 x.x.x.x:43433 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:04 x.x.x.x:43490 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:07 x.x.x.x:43551 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:11 x.x.x.x:43642 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:13 x.x.x.x:43689 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:16 x.x.x.x:43745 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:20 x.x.x.x:43835 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:22 x.x.x.x:43877 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:25 x.x.x.x:43935 rejected Proxy|VMess|Encoding: invalid user
2018/02/07 20:18:29 x.x.x.x:44031 rejected Proxy|VMess|Encoding: invalid user
...
8) 其它相关的配置文件(如 Nginx)和相关日志。
我感觉 Nginx 工作正常,由于我 Nginx 放了一个博客,配置文件比较复杂。需要的话我再整理补充。
服务器时间不对?必要的话用 ntp 同步一下。
https://www.howtogeek.com/tips/how-to-sync-your-linux-server-time-with-network-time-servers-ntp/
看了一下,相差十几分钟。使用 ntpdate 更新提示 Permission denied。我的云主机是 OpenVZ 的,是不是无解了?
不能用 root 运行 ntp 吗?
哦,看上去 OpenVZ 有一些奇怪的设定,大概需要给 VPS 商提一个 ticket 之类的。
是这样的:
[root@vps ~]# ntpdate time.apple.com
7 Feb 21:57:10 ntpdate[2318]: step-systime: Operation not permitted
应该是 VPS 的问题,实在不行就换一个。还有请问一下客户端与服务器的时间差最大是多少?建议在文档中说明一下。
V2Ray 的部分功能依赖于系统时间,请确保使用 V2Ray 的系统 UTC 时间误差在两分钟之内,时区无关。@yuzenan888
非常感谢!关 issue!
服务器时间不对?必要的话用 ntp 同步一下。
https://www.howtogeek.com/tips/how-to-sync-your-linux-server-time-with-network-time-servers-ntp/
有用!
Most helpful comment
服务器时间不对?必要的话用 ntp 同步一下。
https://www.howtogeek.com/tips/how-to-sync-your-linux-server-time-with-network-time-servers-ntp/