-1

So I was wondering why windows is prefering my crappy wifi connection over my ethernet and it had nothing to do with interface metric. It turns out that my ethernet doesn't support IPv6 but my Wifi does, therefore windows deemed it the right network to use.

However, even if wifi supports IPv6 it still sucks, can I force windows to prefer the ethernet connection and only use the wifi connection when IPv6 is needed? Again, I tried messing with the interface metric but it doesn't work because windows still prefers the one with the IPv6 connection despite the ethernet (no IPv6) having a lower metric.

I knew this because once I turned off IPv6 for my Wifi, Windows prefers my ethernet connection. So in summary, or tldr:

  • Wifi sucks, but supports both IP versions, Windows like this
  • Ethernet blazing fast, but doesn't support IPv6, Windows does not prefer this
  • How to force windows to use ethernet and only Wifi when IPv6 comes to play? (interface metric doesn't work)
3
  • Based on your comments, it sounds like you have two ISPs, and what you actually mean is that the ISP on your Wifi connection has bad IPv6 support, rather than Wifi itself? Jun 10, 2021 at 15:43
  • There is no reason for you to use IPv6 inside your local network, and turning it off will solve the problem. There are no situations in a small local network for IPv6 to be really needed.
    – harrymc
    Jun 10, 2021 at 17:13
  • @harrymc But with IPv6 turned off, I cant access some IPv6 sites such as loopsofzen.uk
    – VJZ
    Jun 10, 2021 at 17:45

2 Answers 2

0

IPv6 does not inherently make for a bad wireless connection and should generally not be removed from a modern Windows system.

If your wireless is connected to a router using IPv4 internally (192.168.1.x) then it is already using IPv4.

Some cellular connections are now IPv6.

Get a newer, updated driver for your Windows machine, uninstall Wireless, restart the computer, install the newer driver and then test to see if it is better.

Check the firmware in your wireless router to see if it needs updating.

Then if you have both Ethernet and Wireless and wish to defer to Ethernet, make sure the Metric (advanced TCP/IP properties in Network Connections) is set to Automatic.

You may wish to restart after doing all the above.

9
  • I am not saying that IPv6 is bad, but I am saying that my Wifi Connection is bad, yet only that connection supports IPv6, therefore Windows prefers IPv6 connection, but the signal for the Wifi is bad.
    – VJZ
    Jun 10, 2021 at 15:03
  • Make sure your Wireless and Wired are both set to Automatic Metric so the Wired will take precedence. 3 machines here, all automatic and Wired always takes precedence.
    – John
    Jun 10, 2021 at 15:06
  • I have set it to automatic metric and windows still prefers Wireless. Only when I turn IPv6 off for wireless does Windows prefer wired.
    – VJZ
    Jun 10, 2021 at 15:07
  • Is Wifi supplied by the same router as the ethernet? I think you need to explain how your local LAN is setup, because it sounds like you have a weird non-standard setup.
    – Tonny
    Jun 10, 2021 at 15:09
  • That means something is wrong. Try running DISM and SFC. Open an Admin Command Prompt, run dism.exe /online /cleanup-image /restorehealth then SFC /SCANNOW and restart when done. If then only way is to remove IPv6 then do that.
    – John
    Jun 10, 2021 at 15:10
0

This is a more complex question because it's not always Windows that makes this decision, so it's not always Windows that must be forced to prefer one vs the other (short of disabling IPv6 entirely, that is).

In Windows, when a hostname lookup returns multiple addresses, the OS uses an "address label" or "prefix policy" mechanism to sort them. For example, the "6to4" and "site-local" IPv6 address ranges are prioritized below IPv4, but the rest of IPv6 is above IPv4. (Unless the only address that your computer has is also a 6to4 one. The "matching labels" part adds some complexity.)

On Windows you can use netsh or Get-NetPrefixPolicy to see the precedence list (on Linux the file /etc/gai.conf has the same function).

netsh interface ipv6 show prefixpolicies

To prioritize IPv4 over IPv6, you can add a higher precedence to the ::ffff:0:0/96 prefix (which represents IPv6-mapped IPv4 addresses):

netsh interface ipv6 add prefixpolicy prefix=::ffff:0:0/96 precedence=100 label=4

It will now have a higher priority than the catch-all ::/0 entry representing the entirety of IPv6 & IPv4. (The original precedence for this prefix was 35, whereas ::/0 has precedence 40.)

However, not all programs use the OS-provided order. Browsers, in particular, use a so-called "Happy Eyeballs" algorithm (of which there are a few versions), simultaneously starting an IPv4 and IPv6 connection and using whichever one is the first to establish. Depending on version, the connections may be started at the same time, or IPv6 might be given a head start, often ignoring the "prefix policy" order in either case.

If the program implements its own address ordering, you may be out of luck.

If you only need IPv6 for specific destinations, then there is a heavy duty option of removing the "default route" for IPv6, and statically configuring routes only for those destinations. (This assumes that your gateway IP address won't change, which is hopefully the case with most routers.)

netsh interface ipv6 set interface "Wi-Fi" ignoredefaultroutes=enable
route -6 del ::/0
route -6 -p add 2001:db8::/48 fe80::<gateway_address> if <wifi_interface_index>

(But note that the absence of a default route may cause some programs, such as Chrome, to completely avoid using IPv6 – even for destinations that you do have specific routes for.)

Finally, you could just disable IPv6 for all your interfaces, as there are no popular services so far that'd be IPv6-only; so unless you need IPv6 for a specific destination, you mainly just lose the benefit of inbound connections. (This is assuming that both of your ISPs provide IPv4 in the normal way, and not via NAT64 or similar mechanisms.)

0

Not the answer you're looking for? Browse other questions tagged .