chika0801 / sing-box-examples

sing-box 配置示例
https://github.com/SagerNet/sing-box
1.8k stars 299 forks source link

Tuic Unable to connect #47

Closed Ley-VN closed 1 year ago

Ley-VN commented 1 year ago

This is my configuration { "log": { "level": "info", "timestamp": true }, "inbounds": [ { "type": "tuic", "listen": "test.ley.vn", "listen_port": 443, "users": [ { "uuid": "2a1f8889-cd2b-4d7f-863e-b151eabdabc7", "password": "88b0d030-9b09-4f4b-be9f-7bd8f3a42390" } ], "congestion_control": "bbr", "tls": { "enabled": true, "alpn": [ "h3" ], "certificate_path": "/root/fullchain.cer", "key_path": "/root/Private.key" } } ], "outbounds": [ { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" } ] }


{ "log": { "disabled": true }, "dns": { "servers": [ { "tag": "dns_proxy", "address": "76.76.2.42", "address_resolver": "dns_direct", "strategy": "ipv4_only", "detour": "proxy" }, { "tag": "dns_direct", "address": "local", "strategy": "ipv4_only", "detour": "direct" } ], "rules": [ { "outbound": "any", "server": "dns_direct" } ], "strategy": "ipv4_only" }, "inbounds": [ { "type": "tun", "tag": "tun-in", "mtu": 9000, "inet4_address": "172.19.0.1/30", "auto_route": true, "strict_route": true, "stack": "gvisor", "sniff": true } ], "outbounds": [ { "type": "tuic", "tag": "proxy", "server": "test.ley.vn", "server_port": 443, "uuid": "2a1f8889-cd2b-4d7f-863e-b151eabdabc7", "password": "88b0d030-9b09-4f4b-be9f-7bd8f3a42390", "congestion_control": "bbr", "tls": { "enabled": true, "server_name": "dl.kgvn.garenanow.com", "alpn": "h3" } }, { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" }, { "type": "dns", "tag": "dns-out" } ], "route": { "rules": [ { "protocol": "dns", "outbound": "dns-out" }, { "network": "udp", "port": [ 443, 80 ], "outbound": "block" } ], "auto_detect_interface": true }, "experimental": { "clash_api": { "external_controller": "127.0.0.1:9090", "external_ui": "../files/yacd", "cache_file": "../cache/clash.db" } } }

chika0801 commented 1 year ago

I checked your config files and they are fine. You need to add more information so maybe I can help you.

Ley-VN commented 1 year ago

Tôi đã kiểm tra các tập tin cấu hình của bạn và chúng vẫn ổn. Bạn cần thêm thông tin để có thể tôi có thể giúp bạn.

What information do you need? I will provide

chika0801 commented 1 year ago

What information do you need? I will provide

My debugging process is:

1 On VPS, upload sing-box file, upload SSL certificate, upload config file, start sing-box, check if sing-box status is normal.

2 Check the network side, my line to the VPS is normal, the port (IP) of the VPS is not blocked by my regional firewall.

3 Using sing-box.exe, and the already prepared client configuration, launch it. The configuration file may start by providing an HTTP/Socks proxy port. Let your browser use this port, and test on your browser to see if you can open the blocked site.

Since you only have the configuration, I don't know the rest of your situation. I suggest you follow some of the most simplistic processes for troubleshooting.

Can your client connect, no matter what protocol you are using and what is the reason for troubleshooting the failure, the possible factors are these.

That's why you're asking questions about content in such a way that no one else can effectively help you.

Ley-VN commented 1 year ago

Yes. I haven't found the cause yet. Am using perfect trojan configuration Configure wifi transmitter? I configured the wifi receiver to be 127.0.0.1 and the port is 10809. Cannot connect. Use 5G

chika0801 commented 1 year ago

You can start by trying the simplest network environment. For example, use a PC computer. The PC is connected to a router using a network cable.

Ley-VN commented 1 year ago

Found the reason tuic cannot connect In the tun section. "auto_route": true, "strict_route": true DNS works normally Repair into "auto_route": false, "strict_route": false Connection successful. DNS not working.

chika0801 commented 1 year ago
"auto_route": false,
"strict_route": false

These 2 parameters, they are recommended to be turned on when you use sing-box's TUN mode, for details you go to sing-box's documentation site.

Ley-VN commented 1 year ago

My friend Thank you I changed dns to proxy, works perfectly TUIC Protocol Great But the server I am using is bbr2 I see sing-box is only supporting bbr I corrected it : "congestion_control": "bbr2" Is that Okay?

chika0801 commented 1 year ago

Can't. You have to understand that you are talking about bbr2 for linux systems.

The bbr in the tuic protocol is only a parameter specified by the author of this protocol himself, using the word there.

You should check the sing-box website where the singbox author wrote that position, which some parameters can be used.

Ley-VN commented 1 year ago

I'm wondering "udp_relay_mode": "native" And "udp_over_stream": true Someone said "udp_over_stream": true Better

chika0801 commented 1 year ago

https://github.com/EAimTY/tuic/issues/221#issuecomment-1683862012

You want to research this, read this one link first.

If you don't want to read it, it is recommended to use the default value native given by the author of tuic.

As for the unique option udp over tcp added by the sing-box author. The meaning of this one is that first you make sure you want to liberalize quic usage and you want to proxy quic's transfer data with the tuic protocol. If you directly use the tuic protocol to proxy quic data speed is not fast. After you use the udp over tcp option provided by the sing-box author, it may be faster. (Most direct test method youtube play video)

Also make sure that your client server configuration does not block the quic protocol in routing rules or block port udp443 to ensure that quic can be established properly, this is a prerequisite for testing.

You can think of this option as a demonstration of the sing-box author's skills.

Ley-VN commented 1 year ago

Thank you my friend Configuring my domain shows a DNS error. Do you have a sample configuration for the domain to use tun?

chika0801 commented 1 year ago

https://github.com/chika0801/sing-box-examples/tree/main/Tun