Xray-core: iperf3: error - control socket has closed unexpectedly - when testing with xray
what is the issue?
I would like to test and measure VPNs speed with iperf3, and have tested many
- ocserv
- SoftEther
tinc- hysteria 2
- etc
but with xray or singbox (as client) protocols vless-grpc/tcp the tests fail with this error
iperf3: error - control socket has closed unexpectedly
I already have seen badO1a5A90/Performance tests and the method mentioned there
A,iperf client+Xray inbound(dokodemo-door),outbound(freedom with TLS) <–B,inbound(dokodemo-door),outbound(various protocol combinations) <–C,inbound(various protocol combinations) ,outbound(freedom) <–D,Xray inbound(dokodemo-door with TLS),outbound(freedom)+iperf server
but was not clear and did not provide enough details of how to run tests
why I ask the question here ?
Because that repo is not active and there is one asked with no answer Can you send me the test configuration?
how did I conduct the test (worked with hysteria 2)
First
Because xray or hy2 does not have built-in tun interface (at both side) I have created two tun interfaces both sides with iproute2 e.g
### client side
ip tuntap add dev tun77 mode tun
ip addr add 192.168.77.2/30 brd + dev tun77
### server side
ip tuntap add dev tun77 mode tun
ip addr add 192.168.77.1/30 brd + dev tun77
Second connecting the client (xray or singbox) to the server
Third Testing with curl if socks5 inbound works
curl --socks5-hostname 127.0.0.1:2080 api.ipify.org; echo
Fourth Running tun2socks at client side
./tun2socks -device tun77 -proxy socks5://127.0.0.1:2080
Fifth
Running iperf3 at client side
iperf3 --client 192.168.77.1 --port 1234 --reverse
result
with hysteria 2 , it runs as expected but xray / singbox (as client) gives the mentioned error
additional contexts
- both hy2 and xray socks5 with no pass used
- the tunnel from client to the server is a “split tunnel” not a “full tunnel”
- xray versions are the same
Xray 1.8.7 (Xray, Penetrates Everything.) 3f0bc13 (go1.21.5 linux/amd64) - xray config client [ inbound(socks5) => outbound (vless/tcp) ] —> server [ inbound(vless-tcp) => outbound(direct) ]
what could be the cause ?
I doubt the way I configured the xary be the cause Please let me know if anyone knows the right solution to test Regards
configs
client config for xray
{
"log": {
"loglevel": "debug",
"access": "./xray-debug.log"
},
"dns": {
"hosts": {
"domain:googleapis.cn": "googleapis.com"
},
"servers": [
"1.1.1.1"
]
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 2080,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 8
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true
},
"tag": "socks"
},
{
"listen": "127.0.0.1",
"port": 10809,
"protocol": "http",
"settings": {
"userLevel": 8
},
"tag": "http"
}
],
"log": {
"loglevel": "warning"
},
"outbounds": [
{
"mux": {
"concurrency": -1,
"enabled": false,
"xudpConcurrency": 8,
"xudpProxyUDP443": ""
},
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "1.2.3.4",
"port": 1234,
"users": [
{
"encryption": "none",
"flow": "",
"id": "993a90e4-3778-44c6-b6d8-ea983d7a0fc5",
"level": 8,
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "none",
"tcpSettings": {
"header": {
"type": "none"
}
}
},
"tag": "proxy"
},
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
},
{
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
},
"tag": "block"
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"ip": [
"1.1.1.1"
],
"outboundTag": "proxy",
"port": "53",
"type": "field"
}
]
}
}
logs debug
cat xray-debug.log
### curl test okay
2024/05/15 11:57:32 tcp:127.0.0.1:47614 accepted tcp:api.ipify.org:80 [socks >> proxy]
### ipef3 test error
2024/05/15 11:57:46 tcp:127.0.0.1:35546 accepted tcp:192.168.77.1:10123 [socks >> proxy]
### iperf3 error
2024/05/15 11:58:21 tcp:127.0.0.1:49678 accepted tcp:192.168.77.1:10123 [socks >> proxy]
### curl okay
2024/05/15 11:58:34 tcp:127.0.0.1:55514 accepted tcp:api.ipify.org:80 [socks >> proxy]
### ipef3 error
2024/05/15 11:58:37 tcp:127.0.0.1:55526 accepted tcp:192.168.77.1:10123 [socks >> proxy]
### curl okay
2024/05/15 11:59:26 tcp:127.0.0.1:34476 accepted tcp:api.ipify.org:80 [socks >> proxy]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (9 by maintainers)
Well, you can add this in your config
This will let xray listen on your client‘s port 5210 and forward all traffic to 192.168.77.1:5210(according to the info your provided, it should be an iperf3 server) Speaking of which, I noticed that many default xray configuration files block connections sent to private IP range (like 192.168. x.x), maybe the problem lies here