How to configurate router prefer IPv4 over IPv6?

Follow the guide below, I can make my PC prefer IPv4 over IPv6 by modifying the registry key.

Guidance for configuring IPv6 in Windows for advanced users

Now I want to implement the same function on the router to let all the devices in the LAN prefer IPv4 over IPv6.

This topic shown how to forbid DNS to return IPv6 AAAA records, but I cannot access to IPv6 domain anymore.

The easiest way is probably to use ULAs instead of global IPv6 addresses since many devices prefer IPv4 over IPv6 ULA.

If you want to use global IPv6 address on the device then I think it requires support for RFC7078.

https://tools.ietf.org/html/rfc7078

1 Like

The IP address (family) is chosen by the individual clients, the router is not involved in that step and can't simply rewrite IPv6 addresses as IPv4 for your network. The typical implementation on operating system resolvers prefers IPv6 over IPv4, according to the standards - this is normal and shouldn't be a problem, if it is, the underlying causes need to be fixed anyways.

5 Likes

I'd like to double down on @slh's answer. If you are getting broken IPv6 from your ISP then disable it at the WAN side (and consider getting yourself a working tunnel)... If you are getting working IPv6 you should be preferring it.

3 Likes

Short answer. Don't!

The better question for all of us interested, why do you want to prefer IPv4 over IPv6? As mentioned above, if something is wrong with IPv6, fix the underlying problem, rather than working around it. Short of removing any IPv6 connectivity from a client, forcing IPv4 will be a fun game that not all clients will even honour either, which at this point we have to ask, why?!

with ipv6 global address we can cross ISP's multi level C class network, ex. we have no public ipv4 adress in china, only 100.83.xxx.xxx .

but like pan.baidu.com, dns return both ipv6 and ipv4, the bad news is that the ipv6 cant work like normal, prefer ipv4 then ok.
there is something wrong at the server not me, but i also need to access it.