v2ray / v2ray-core

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

中转服务器-无法开启UDP支持 内附配置和日志 #820

Closed wulongji2016 closed 6 years ago

wulongji2016 commented 6 years ago

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) 3.6 客户端 (中转服务器使用) 3.5 服务端 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 电脑浏览器直接socks连接中转服务器。 手机安装socks代理软件,连接中转服务器。 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 苹果手机通过brook的socks正常连接到V2ray。但是安卓无法连接,提示需要UDP支持,我开通了UDP,可能配置不正确,无法正常使用SOCKS。 4) 你期待看到的正确表现是怎样的? 希望v2ray 开通UDP 。 5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:
 {
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "udp": true,
    "port": 50999,
    "protocol": "vmess",
    "settings": {
        "clients": [
        {
          "id": "12*****",  //  
          "alterId": 64
        }
      ]

    }
  },
  "outbound": {
    "udp": true,   
    "protocol": "freedom",
    "settings": {
客户端配置:
 {
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "debug"
  },
  "inbound": {
    "port": 51777,
    "listen": "0.0.0.0",
    "udp": true,
    "protocol": "socks",
    "settings": {
      "auth": "noauth"

    }
  },
  "outbound": {
    "udp": true,
    "protocol": "vmess",
    "settings": {

"vnext": [
        {
          "address": " *****", //  
          "port": 50999,  //  
          "users": [
            {
              "id": "*****",  //  
              "alterId": 64 //  
            }
          ]
        }
      ]

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

服务器端错误日志:
    // 在这里附上服务器端日志
客户端错误日志:
2018/01/19 03:43:07 [Debug]: App|Proxyman|Inbound: creating stream worker on 0.0.0.0:51777
2018/01/19 03:43:07 [Info]: Transport|Internet|TCP: listening TCP on 0.0.0.0:51777 (为什么没有开启UDP的监听端口?)
2018/01/19 03:43:07 [Warning]: Core: V2Ray started
2018/01/19 03:43:39 [Info]: Proxy|Socks: TCP Connect request to tcp: -----:443
2018/01/19 03:43:39 [Info]: App|Dispatcher: default route for tcp:-----:443
2018/01/19 03:43:39 [Info]: Transport|Internet|TCP: dialing TCP to tcp:-------*****:50999
2018/01/19 03:43:39 [Info]: Proxy|VMess|Outbound: tunneling request to tcp:149.154.163.81:443 via tcp:****:50999
2018/01/19 03:43:44 [Info]: Proxy|Socks: TCP Connect request to tcp:149.154.163.81:443
2018/01/19 03:43:44 [Info]: App|Dispatcher: default route for tcp:149.154.163.81:443
2018/01/19 03:43:44 [Info]: Transport|Internet|TCP: dialing TCP to tcp:8*****:50999
2018/01/19 03:43:44 [Info]: Proxy|Socks: TCP Connect request to tcp:149.154.163.81:443
2018/01/19 03:43:44 [Info]: App|Dispatcher: default route for tcp:149.154.163.81:443
2018/01/19 03:43:44 [Info]: Transport|Internet|TCP: dialing TCP to tcp:*****:50999
2018/01/19 03:43:44 [Info]: Proxy|Socks: TCP Connect request to tcp:149.154.163.81:443
2018/01/19 03:43:44 [Info]: App|Dispatcher: default route for tcp:149.154.163.81:443
2018/01/19 03:43:44 [Info]: Transport|Internet|TCP: dialing TCP to tcp:*****:50999
2018/01/19 03:43:44 [Info]: Proxy|VMess|Outbound: tunneling request to tcp:149.154.163.81:443 via tcp:*****:50999

2018/01/19 03:43:59 [Info]: App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > Proxy|Socks: failed to transport all TCP response > write tcp 172.17.0.2:51777->117.179.240.129:22588: write: broken pipe
2018/01/19 03:43:59 [Info]: App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: connection ends > context canceled
2018/01/19 03:44:25 [Info]: App|Proxyman|Inbound: connection ends > Proxy|Socks: failed to read request > Proxy|Socks: unsupported command: 3

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

    // 在这里附上客户端 (中转服务器的日志)
2018/01/19 03:43:39 tcp:.179.240.129:22576 accepted tcp:149.154.163.81:443 
2018/01/19 03:43:44 tcp:.179.240.129:22588 accepted tcp:149.154.163.81:443 
2018/01/19 03:44:25 tcp:.179.240.129:22638 rejected  Proxy|Socks: unsupported command: 3
2018/01/19 03:44:25 tcp:.179.240.129:22639 rejected  Proxy|Socks: unsupported command: 3

2018/01/19 03:44:26 tcp:.179.240.129:22649 accepted tcp:172.217.27.141:443 

8) 其它相关的配置文件(如 Nginx)和相关日志。


补充: 用docker配置的,服务器端和中转作用的V2ray都是 显示TCP和UDP (在宿主机子上)已经开通端口监听。但是好像v2ray 本身没有开启UDP端口监听。

IbarakiKasen commented 6 years ago

Try this:

  "inbound": {
    "port": 51777,
    "listen": "0.0.0.0",
-   "udp": true,
    "protocol": "socks",
    "settings": {
-     "auth": "noauth"
+     "auth": "noauth",
+     "udp": true,
+     "ip": "<public IP of the server>"
    }
  },
wulongji2016 commented 6 years ago

十分感谢,按照2楼的参数,该UDP问题已经解决。