v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.07k stars 8.94k forks source link

我的v2ray服务端与客户端不能连接 #814

Closed wjz2001 closed 5 years ago

wjz2001 commented 6 years ago

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) v3.6 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 使用Chrome 通过VMess翻墙 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 其他都正常,但服务端无日志,服务器可以ping通,上面搭建的ss也能正常翻墙 4) 你期待看到的正确表现是怎样的? 正常的上google 5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:
   {
 "log":{
    "loglevel": "debug",
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log"
  },
    "inbound": {
    "port": 57418,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "fe2648ee-b59f-4877-9471-5c97525d1365",
          "level": 1,
          "alterId": 64
        }
      ]
    }
  },
  "streamSettings":{
      "network":"kcp",
      "kcpSettings": {
        "mtu": 1460,
        "tti": 20,
        "uplinkCapacity": 20,
        "downlinkCapacity": 100,
        "congestion": true,
        "readBufferSize": 1,
        "writeBufferSize": 1,
        "header": {
          "type": "wechat-video"
        }
      }
    },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "outboundDetour": [
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "strategy": "rules",
    "settings": {
      "rules": [
        {
          "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": "blocked"
        }
      ]
    }
  }
}
客户端配置:
{
  "log": {
    "error": "D:\\v2ray\\error.log",
    "loglevel": "debug"
  },
  "inbound": {
    "port": 10810,
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.0.1"
    }
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [{
        "address": "",
        "port": 57418,
        "users": [{ "id": "fe2648ee-b59f-4877-9471-5c97525d1365",
        "security": "chacha20-poly1305",
        "level": 1,
        "alterId": 64   }]
      }]
    },
    "streamSettings":{
      "network":"kcp",
      "kcpSettings": {
        "mtu": 1460,
        "tti": 20,
        "uplinkCapacity": 6,
        "downlinkCapacity": 100,
        "congestion": true,
        "readBufferSize": 1,
        "writeBufferSize": 1,
        "header": {
          "type": "wechat-video"
        }
      }
    },
    "mux": {"enabled": true,
            "concurrency": 8
  }
  },

  "outboundDetour": [{
    "protocol": "freedom",
    "tag": "direct",
    "settings": {}
  }],
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
        {
          "type": "chinasites",
          "outboundTag": "direct"
        },
        {
          "type": "chinaip",
          "outboundTag": "direct"
        }
      ]
    }
  }
}

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

服务器端错误日志:
2018/01/14 07:18:53 [Warning]: Core: V2Ray started
   2018/01/16 08:11:34 [Debug]: App|Proxyman|Inbound: creating stream worker on 0.0.0.0:57418
  2018/01/16 08:11:34 [Info]: Transport|Internet|TCP: listening TCP on 0.0.0.0:57418
  2018/01/16 08:11:34 [Warning]: Core: V2Ray started
客户端错误日志:
2018/01/16 21:02:54 [Debug]: App|Proxyman|Inbound: creating stream worker on 127.0.0.1:1081
2018/01/16 21:02:54 [Info]: Transport|Internet|TCP: listening TCP on 127.0.0.1:1081
2018/01/16 21:02:54 [Info]: Transport|Internet|UDP: listening UDP on 127.0.0.1:1081
2018/01/16 21:02:54 [Warning]: Core: V2Ray started
2018/01/16 21:03:13 [Info]: Proxy|Socks: TCP Connect request to tcp:inbox.google.com:443
2018/01/16 21:03:13 [Info]: App|Router: looking for IP for domain: inbox.google.com
2018/01/16 21:03:13 [Info]: Proxy|Socks: TCP Connect request to tcp:apis.google.com:443
2018/01/16 21:03:13 [Info]: App|Router: looking for IP for domain: apis.google.com
2018/01/16 21:03:13 [Info]: App|Dispatcher: default route for tcp:apis.google.com:443
2018/01/16 21:03:13 [Info]: App|Proxyman|Mux: dispatching request to tcp:apis.google.com:443
2018/01/16 21:03:13 [Info]: Transport|Internet|mKCP: dialing mKCP to udp:66.112.219.153:57418
2018/01/16 21:03:13 [Info]: Transport|Internet|mKCP: #12932 creating connection to 66.112.219.153:57418
2018/01/16 21:03:13 [Info]: Proxy|VMess|Outbound: tunneling request to tcp:v1.mux.cool:9527 via tcp:66.112.219.153:57418
2018/01/16 21:03:13 [Info]: Proxy|Socks: TCP Connect request to tcp:www.google.com:443
2018/01/16 21:03:13 [Info]: App|Router: looking for IP for domain: www.google.com
2018/01/16 21:03:14 [Info]: App|Dispatcher: default route for tcp:www.google.com:443
2018/01/16 21:03:14 [Info]: App|Proxyman|Mux: dispatching request to tcp:www.google.com:443
2018/01/16 21:03:14 [Info]: Proxy|Socks: TCP Connect request to tcp:www.gstatic.com:443
2018/01/16 21:03:14 [Info]: Proxy|Socks: TCP Connect request to tcp:ssl.gstatic.com:443
2018/01/16 21:03:14 [Info]: App|Router: looking for IP for domain: www.gstatic.com
2018/01/16 21:03:14 [Info]: App|Router: looking for IP for domain: ssl.gstatic.com
2018/01/16 21:03:14 [Info]: App|Dispatcher: taking detour [direct] for [tcp:www.gstatic.com:443]
2018/01/16 21:03:14 [Info]: Proxy|Freedom: opening connection to tcp:www.gstatic.com:443
2018/01/16 21:03:14 [Info]: Transport|Internet|TCP: dialing TCP to tcp:www.gstatic.com:443
2018/01/16 21:03:14 [Info]: App|Dispatcher: taking detour [direct] for [tcp:ssl.gstatic.com:443]
2018/01/16 21:03:14 [Info]: Proxy|Freedom: opening connection to tcp:ssl.gstatic.com:443
2018/01/16 21:03:14 [Info]: Transport|Internet|TCP: dialing TCP to tcp:ssl.gstatic.com:443
2018/01/16 21:03:14 [Info]: Proxy|Socks: TCP Connect request to tcp:lh6.googleusercontent.com:443
2018/01/16 21:03:14 [Info]: App|Router: looking for IP for domain: lh6.googleusercontent.com
2018/01/16 21:03:14 [Info]: Proxy|Socks: TCP Connect request to tcp:ci5.googleusercontent.com:443
2018/01/16 21:03:14 [Info]: App|Router: looking for IP for domain: ci5.googleusercontent.com
2018/01/16 21:03:14 [Info]: App|Dispatcher: default route for tcp:ci5.googleusercontent.com:443
2018/01/16 21:03:14 [Info]: App|Proxyman|Mux: dispatching request to tcp:ci5.googleusercontent.com:443

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。

DarienRaymond commented 6 years ago

看log像是服务器完全没有收到数据,请确认防火墙、IP、端口配置正确。

wjz2001 commented 6 years ago

@DarienRaymond ip,端口配置正确,没有防火墙

kulongwangzhi85 commented 6 years ago

使用telnet命令,检查客户端是否能与服务端正常连接?

wjz2001 commented 6 years ago

@kulongwangzhi85 可以正常连接

vincenlai commented 6 years ago

mtu 改成 1350.

wjz2001 commented 6 years ago

已经改了mtu为1350 这是服务端access日志:

2018/01/19 08:07:27 60.220.127.101:47397 rejected  Proxy|VMess|Encoding: failed to read re    quest header > read tcp 66.112.219.153:57418->60.220.127.101:47397: i/o timeout
  2 2018/01/19 08:29:00 60.220.127.101:46096 rejected  Proxy|VMess|Encoding: failed to read re    quest header > read tcp 66.112.219.153:57418->60.220.127.101:46096: i/o timeout
  3 2018/01/19 08:29:06 60.220.127.101:46103 rejected  Proxy|VMess|Encoding: failed to read re    quest header > read tcp 66.112.219.153:57418->60.220.127.101:46103: i/o timeout
  4 2018/01/19 08:29:15 60.220.127.101:46109 rejected  Proxy|VMess|Encoding: failed to read re    quest header > read tcp 66.112.219.153:57418->60.220.127.101:46109: i/o timeout
  5 2018/01/23 07:06:38 106.83.55.198:50327 rejected  Proxy|VMess|Encoding: invalid user
  6 2018/01/23 07:06:39 106.83.55.198:1609 rejected  Proxy|VMess|Encoding: invalid user
  7 2018/01/25 09:04:13 1.165.116.20:52860 rejected  Proxy|VMess|Encoding: invalid user
  8 2018/01/25 09:04:16 1.165.116.20:52916 rejected  Proxy|VMess|Encoding: invalid user
  9 2018/01/25 09:04:18 1.165.116.20:52990 rejected  Proxy|VMess|Encoding: invalid user
 10 2018/02/08 04:28:47 1.165.119.51:57133 rejected  Proxy|VMess|Encoding: invalid user
 11 2018/02/08 04:28:49 1.165.119.51:57180 rejected  Proxy|VMess|Encoding: invalid user
 12 2018/02/08 04:28:51 1.165.119.51:57238 rejected  Proxy|VMess|Encoding: invalid user

这是客户端access日志:

2018/02/11 10:09:28 tcp:127.0.0.1:53243 accepted tcp:www.v2ray.com:443 
2018/02/11 10:09:30 tcp:127.0.0.1:53244 accepted tcp:www.google.com:443 
2018/02/11 10:09:30 tcp:127.0.0.1:53245 accepted tcp:searchexclus.com:443 
2018/02/11 10:09:30 tcp:127.0.0.1:53246 accepted tcp:api.infinitynewtab.com:443 
2018/02/11 10:09:30 tcp:127.0.0.1:53247 accepted tcp:infinity-api.infinitynewtab.com:443 
2018/02/11 10:09:31 tcp:127.0.0.1:53250 accepted tcp:img.infinitynewtab.com:443 
2018/02/11 10:09:31 tcp:127.0.0.1:53252 accepted tcp:query.yahooapis.com:80 
2018/02/11 10:09:31 tcp:127.0.0.1:53253 accepted tcp:query.yahooapis.com:80 
2018/02/11 10:09:31 tcp:127.0.0.1:53254 accepted tcp:suggestion.baidu.com:80 
2018/02/11 10:09:31 tcp:127.0.0.1:53256 accepted tcp:www.google-analytics.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53259 accepted tcp:lh3.googleusercontent.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53258 accepted tcp:www.gstatic.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53260 accepted tcp:ci6.googleusercontent.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53261 accepted tcp:apis.google.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53262 accepted tcp:ssl.gstatic.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53264 accepted tcp:lh6.googleusercontent.com:443 
2018/02/11 10:09:32 tcp:127.0.0.1:53266 accepted tcp:inbox.google.com:443 
2018/02/11 10:09:58 tcp:127.0.0.1:53274 accepted tcp:clients4.google.com:443 
2018/02/11 10:10:02 tcp:127.0.0.1:53277 accepted tcp:inbox.google.com:443 
2018/02/11 10:10:03 tcp:127.0.0.1:53278 accepted tcp:inbox.google.com:443 
2018/02/11 10:10:08 tcp:127.0.0.1:53283 accepted tcp:clients4.google.com:443 
2018/02/11 10:10:56 tcp:127.0.0.1:53297 accepted tcp:notifications.google.com:443 
2018/02/11 10:10:58 tcp:127.0.0.1:53299 accepted tcp:play.google.com:443 
2018/02/11 10:11:15 tcp:127.0.0.1:53301 accepted tcp:github.com:443 
2018/02/11 10:11:23 tcp:127.0.0.1:53305 accepted tcp:clients4.google.com:443 
2018/02/11 10:11:26 tcp:127.0.0.1:53306 accepted tcp:beacons.gcp.gvt2.com:443 
2018/02/11 10:11:26 tcp:127.0.0.1:53307 accepted tcp:google.com:443 
2018/02/11 10:11:27 tcp:127.0.0.1:53311 accepted tcp:notifications.google.com:443 
2018/02/11 10:11:28 tcp:127.0.0.1:53312 accepted tcp:notifications.google.com:443 
2018/02/11 10:11:29 tcp:127.0.0.1:53313 accepted tcp:notifications.google.com:443 
2018/02/11 10:11:36 tcp:127.0.0.1:53315 accepted tcp:github.com:443 
2018/02/11 10:11:36 tcp:127.0.0.1:53316 accepted tcp:clients4.google.com:443 
2018/02/11 10:12:06 tcp:127.0.0.1:53322 accepted tcp:api.github.com:443 
2018/02/11 10:12:06 tcp:127.0.0.1:53323 accepted tcp:api.github.com:443 
2018/02/11 10:12:43 tcp:127.0.0.1:53334 accepted tcp:api.github.com:443 
2018/02/11 10:12:51 tcp:127.0.0.1:53338 accepted tcp:ssl.gstatic.com:443 
2018/02/11 10:12:52 tcp:127.0.0.1:53340 accepted tcp:docs.google.com:443 
2018/02/11 10:13:12 tcp:127.0.0.1:53344 accepted tcp:docs.google.com:443 
2018/02/11 10:13:13 tcp:127.0.0.1:53345 accepted tcp:google.com:443 
2018/02/11 10:13:14 tcp:127.0.0.1:53346 accepted tcp:clients4.google.com:443 
2018/02/11 10:13:22 tcp:127.0.0.1:53347 accepted tcp:docs.google.com:443 
2018/02/11 10:13:23 tcp:127.0.0.1:53348 accepted tcp:docs.google.com:443 
vincenlai commented 6 years ago

时间一致吗? 从服务端日志看到是用户验证失败,时间、ID、alterId 都必须要一致。 另外可在这里参考一下模板。

taikulawo commented 6 years ago

看这样就是服务器没有接收到数据,许多的云服务商都有自带的防火墙,不知道你用的是哪家的服务,如果有防火墙的话可以检查一下作为参考

wjz2001 commented 6 years ago

没有防火墙

6shell commented 5 years ago

这个看上去就是时间没有校准的问题

xwzjzyj commented 4 years ago

楼上正解!我就是服务器id和客户端id不一致(UUID),报错信息一样,可以检查一下另外几个,服务器时间可以使用ntp同步。

时间一致吗? 从服务端日志看到是用户验证失败,时间、ID、alterId 都必须要一致。 另外可在这里参考一下模板。