shadowsocks / shadowsocks-windows

A C# port of shadowsocks
Other
58.09k stars 16.4k forks source link

Prefer IPv6. #3359

Closed fernvenue closed 1 year ago

fernvenue commented 1 year ago

Is your feature request related to a problem? Please describe. Sometimes we may wanna connect to the server's IPv6 address first, but shadowsocks-windows always choose IPv4 first.

Describe the solution you'd like Add an option to make shadowsocks-windows use IPv6 first.

Describe alternatives you've considered Yes, I do tried to use IPv6 only address, but we do need IPv4 as a fallback right?

Additional context By the way, this is the client side behavior, I already set "ipv6_first": true on the server side :)

chenshaoju commented 1 year ago

please try: https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/configure-ipv6-in-windows

fernvenue commented 1 year ago

Hi @chenshaoju, firstly, thanks for your reply. And yes, I already tried this way, but it doesn't work, I tried again when you post it for me, and I got the same result. But I found out that, my other devices will prefer IPv6 when both IPv4 and IPv6 available, just as that article said:

By default, Windows favors IPv6 global unicast addresses over IPv4 addresses.

So, I think maybe something wrong with this single device, because I use WireGuard to get IPv6 connection on it, not like other devices has IPv6 connection by themselves, and maybe that's why Windows doesn't prefer IPv6.

Fortunately, now I figured it out, and here's my solution, in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dnscache\Parameters adding a DWORD value: AddrConfigControl = 0, then Windows will prefer IPv6 even when I use WireGuard to get IPv6 connection.

Thanks again for your help, hope this will help other people who have the same problem, now I'm gonna close this issue :)