v2ray / v2ray-core

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

[Error]KCP|Dialer: Failed to dial to dest: dial udp #415

Closed wenjinlibug closed 6 years ago

wenjinlibug commented 7 years ago

提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 Please read the instruction and answer the following questions before submitting your issue. Thank you.

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) What version of V2Ray are you using (If you deploy different version on server and client, please explicitly point out)?

V2Ray v2.20.2 (One for all) 20170306

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 What's your scenario of using V2Ray? E.g., Watching YouTube videos in Chrome via Socks/VMess proxy.

Chrome Socks/VMess

3) 你看到的不正常的现象是什么? What did you see?

[Error]KCP|Dialer: Failed to dial to dest: dial udp x.x.x.x:端口: operation was canceled 2017/03/12 14:34:45 [Warning]Proxyman|OutboundHandler: Failed to process outbound traffic. > > VMess|Outbound: Failed to find an available destination. > > [dial udp x.x.x.x:端口: operation was canceled] > > Retry: All retry attempts failed.

4) 你期待看到的正确表现是怎样的? What's your expectation?

5) 请附上你的配置文件(提交 Issue 前请隐藏服务器端IP地址)。 Please attach your configuration file (Mask IP addresses before submit this issue).

Server Configuration File(服务器端配置文件):
```javascript
// 在这里附上服务器端配置文件
// Please attach your server configuration file here.
```

"
{ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbound": { "port": xx, "protocol": "vmess", "settings": { "clients": [ { "id": "xxx", "level": 1, "alterId": 64 } ] }, "streamSettings": { "network": "kcp" }, "detour": { "to": "detour" } }, "inboundDetour": [ { "protocol": "vmess", "port": "x-x", "tag": "detour", "settings": { "clients": [ { "id": "xxx", "level": 1, "alterId": 64 } ] }, "allocate": { "strategy": "random", "concurrency": 2, "refresh": 5 }, "streamSettings": { "network": "kcp" } } ], "dns": { "servers": [ "x.x.x.x", "localhost" ] }, "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" } ] } }, "transport": { "kcpSettings": { "uplinkCapacity": 2, "downlinkCapacity": 1, "header": { "type": "srtp" } } } }

"

Client Configuration File(客户端配置文件):
```javascript
// 在这里附上客户端配置文件
// Please attach your client configuration file here.
```

" { "log": { "loglevel": "warning" }, "inbound": { "port": x, "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", "udp": true, "ip": "127.0.0.1" } }, "outbound": { "protocol": "vmess", "settings": { "vnext": [ { "address": "x.x.x.x", "port": xx, "users": [ { "id": "xx", "level": 1, "alterId": 64, "security": "chacha20-poly1305" } ] } ] }, "streamSettings": { "network": "kcp" } }, "outboundDetour": [ { "protocol": "freedom", "settings": { "vnext": [ { "address": "x.x.x.x", "port": xx, "users": [ { "id": "xx", "level": 1, "alterId": 64, "security": "chacha20-poly1305" } ] } ] }, "tag": "direct" } ], "dns": { "servers": [ "x.x.x.x", "localhost" ] }, "routing": { "strategy": "rules", "settings": { "domainStrategy": "IPIfNonMatch", "rules": [ { "type": "chinasites", "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" }, { "type": "chinaip", "outboundTag": "direct" } ] } }, "transport": { "kcpSettings": { "uplinkCapacity": 1, "downlinkCapacity": 2, "header": { "type": "srtp" } } } } " 6) 请附上出错时软件输出的日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。 Please attach the log file, especially the bottom lines if the file is large. Log file is usually /var/log/v2ray/error.log on Linux.

Server Log File(服务器端日志):
```
// 在这里附上服务器端日志
// Please attach your server log here.
```

Client Log File(客户端日志):
```
// 在这里附上客户端日志
// Please attach your client log here.
```

" V2Ray v2.20.2 (One for all) 20170306 An unified platform for anti-censorship. 2017/03/12 14:34:31 [Debug]Proxyman|DefaultInboundHandler: creating tcp worker on 127.0.0.1:端口 2017/03/12 14:34:31 [Info]TCP|Listener: Listening on 127.0.0.1:端口 2017/03/12 14:34:31 [Info]UDP|Hub: Listening on 127.0.0.1:端口 2017/03/12 14:34:31 [Warning]V2Ray started. 2017/03/12 14:34:43 [Error]KCP|Dialer: Failed to dial to dest: dial udp ip:端口: operation was canceled 2017/03/12 14:34:43 [Error]KCP|Dialer: Failed to dial to dest: dial udp ip:端口: operation was canceled 2017/03/12 14:34:44 [Error]KCP|Dialer: Failed to dial to dest: dial udp ip:端口: operation was canceled 2017/03/12 14:34:44 [Error]KCP|Dialer: Failed to dial to dest: dial udp ip:端口: operation was canceled 2017/03/12 14:34:45 [Error]KCP|Dialer: Failed to dial to dest: dial udp ip:端口: operation was canceled 2017/03/12 14:34:45 [Warning]Proxyman|OutboundHandler: Failed to process outbound traffic. > > VMess|Outbound: Failed to find an available destination. > > [dial udp ip:端口: operation was canceled] > > Retry: All retry attempts failed. "

oing9179 commented 7 years ago
  1. 请将配置文件内的IP地址省去后,直接上传上来。
  2. 请把服务器上 V2Ray 的日志也贴出来。
v2ray commented 7 years ago

猜测是服务器端没有收到任何数据,请检查防火墙和端口设置。

dcliubing commented 7 years ago

检查系统时间与服务器是否一致

wenjinlibug commented 7 years ago

root@v:~# iptables -vnL Chain INPUT (policy ACCEPT 3709 packets, 341K bytes) pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 1983 packets, 445K bytes) pkts bytes target prot opt in out source destination

wenjinlibug commented 7 years ago

已经同步过时间,服务器端error.log没有任何异常。 017/03/15 14:57:00 [Warning]V2Ray started. 2017/03/15 14:57:50 [Warning]V2Ray started. 2017/03/15 23:56:34 [Warning]V2Ray started. 2017/03/16 01:02:30 [Warning]V2Ray started.

而且这时候代理其实可以用的,只是速度较慢。 证明端口及uuid没有设置错误,也没有被防火墙阻挡。

oing9179 commented 7 years ago

请把服务器的日志等级 loglevelwarning 改成 info,然后再尝试重现你的问题,然后再贴一下服务器端的日志。

wenjinlibug commented 7 years ago

errorlog.txt

wenjinlibug commented 7 years ago

@oing9179 @v2ray 终于查明真相,在有ipv6的服务器上运行会自动监听ipv6的端口,却不会监听ipv4的,即使有“listen”: 0.0.0.0项也一样。 v2ray

Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07)

yloveyy commented 7 years ago

@wenjinlibug 最后解决了吗?

wenjinlibug commented 7 years ago

@chnt7305 无法解决,不知到什么原因造成的,试着换回2.20版本问题依旧。神奇的是同一vps下shadowsocks,unbound,dnscrypt,ftp,transmission等全部正常。 在网上游荡了一会,发现kcptun也遇到同样问题。 https://github.com/xtaci/kcptun/issues/173 有人想到了解决方法不过那是kcp-go的。 https://github.com/xtaci/kcp-go/pull/26 由于对go语言完全一窍不通,只能等大佬来修改了。

lewisec commented 7 years ago

经你提醒,我发现我也是这样。报错都一样。同服务器换ss是好的。好奇怪。

public15 commented 7 years ago

同样遇到这个问题,有没有哪位解决了?

yangchengwork commented 6 years ago

同样遇到这个问题,有没有哪位解决了?

Arcadia822 commented 6 years ago

日志情况完全一致,tcp(tcp6)可以正常连接,kcp(udp6)不行

FTAndy commented 6 years ago

在服务器配置上加上"listen": "xxx.xxx.xxx.xxx"就不会默认使用tcp6了,但是我这边还是不能解决客户端all retry attempts failed的error

DarienRaymond commented 6 years ago

猜测是某种路由转发机制导致了mkcp工作不正常,mkcp对于每个连接要求来源IP:Port是固定值,否则转发会失败。目前发现iptables会导致这类的失效,是否有其它程序或路由也有同样问题还不清楚。

flyinging commented 5 years ago

同样的问题,我是只有mac不能用,Windows和Android都能用。解决办法有两种:一是将outbounds中tlsSettings的allowInsecure改为false;二是打开UDP模式。