发新话题
打印

Windows禁用IPv6或设置IPv4优先

Windows禁用IPv6或设置IPv4优先

一、Windows禁用IPv6
To disable IPv6 on IBM Softlayer:

Open the registry editor. Press Windows key + R. In the Run dialog box, type regedit and click OK.
In the Registry editor, navigate to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > TCPIP6 > Parameters.
Create a new DWORD.
Right-click on Parameters, select New, then DWORD (32-bit).
Set the name to DisabledComponents and press Enter.
Right-click on the new entry and select Modify. Set the Hex value to FFFFFFFF and click OK.
Reboot the client.

原文:
https://www.ibm.com/docs/en/cfm/2.0.0.3?topic=client-disabling-ipv6


二、设置ipv4优于ipv6:
Method 1: Registry Entry
You will need to reboot for the change to take effect.

Login to your computer as an administrator
Run the registry editor (regedt32.exe)
Add a registry key per the screenshot below then reboot for the change to take effect. To undo this change, simply delete the registry entry, then reboot again.

Location: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters
Key: DisabledComponents
Type: REG_DWORD
Value: 0x20

Method 2: Modify IPv6 Prefix Policies
1)查看当前设置
netsh interface ipv6 show prefixpolicies

优先顺序    标签   前缀
----------  -----  --------------------------------
        50      0  ::1/128
        40      1  ::/0
        35      4  ::ffff:0:0/96     (代表IPv4,优先级35,标签值 4)
        30      2  2002::/16
         5      5  2001::/32
         3     13  fc00::/7
         1     11  fec0::/10
         1     12  3ffe::/16
         1      3  ::/96

其中 ::ffff:0:0/96 代表 ipv4,最左边数值代表优先级,越大越高级,第2列是标签值 4

2)修改当前设置,把35改成51,提升到最高
netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 51 4

3)再次查看当前设置
netsh interface ipv6 show prefixpolicies

优先顺序    标签   前缀
----------  -----  --------------------------------
        51      4  ::ffff:0:0/96
        50      0  ::1/128
        40      1  ::/0
        30      2  2002::/16
         5      5  2001::/32
         3     13  fc00::/7
         1     11  fec0::/10
         1     12  3ffe::/16
         1      3  ::/96

4)测试
ping localhost
如果是 127.0.0.1 就是ipv4优先,否则是::1,表示ipv6优先

参考:
https://kb.firedaemon.com/support/solutions/articles/4000160803-prioritising-ipv4-over-ipv6-on-windows-10-and-11
https://www.vwnet.jp/windows/w7/IPv4/IPv4PriorityUP.html


参考:
安卓系统禁用IPv6:http://trustcomputing.com.cn/bbs/viewthread.php?tid=1885
Linux禁用IPv6或设置IPv4优先:http://www.trustcomputing.com.cn/bbs/viewthread.php?tid=1897
Windows停用、启用网卡bat批处理:http://www.trustcomputing.com.cn/bbs/viewthread.php?tid=1927

Proxifier的IPv6代理相关
https://blog.rhilip.info/archives/670/

[ 本帖最后由 linda 于 2023-12-12 11:33 编辑 ]

TOP

发新话题