Windows 10 或 11 中配置 DNS 优先解析为 IPv6 地址

 

 

Windows 10 或 11 中配置 DNS 优先解析为 IPv6 地址


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters]
"AddrConfigControl"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]
"DisabledComponents"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters]
"AddrConfigControl"=dword:00000000
"MaxCacheTtl"=dword:0000003C
"MaxNegativeCacheTtl"=dword:0000000A

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]
"DisabledComponents"=dword:00000000
"IPEnableRouter"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"DisableDynamicUpdate"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters]
"AddrConfigControl"=dword:00000000
"MaxCacheTtl"=dword:0000003C
"MaxNegativeCacheTtl"=dword:0000000A

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]
"DisabledComponents"=dword:00000000 ; 确保未禁用 IPv6
"IPEnableRouter"=dword:00000000      ; 不启用路由器功能

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"DisableDynamicUpdate"=dword:00000000 ; 确保动态更新未禁用

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"NameResolutionPolicy"=dword:00000001 ; 启用名称解析策略

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters]
"AddrConfigControl"=dword:00000000
"MaxCacheTtl"=dword:0000003C
"MaxNegativeCacheTtl"=dword:0000000A

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]
"DisabledComponents"=dword:00000000 ; 确保未禁用 IPv6
"IPEnableRouter"=dword:00000000      ; 不启用路由器功能
"UseTemporaryAddresses"=dword:00000001 ; 启用临时地址

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"DisableDynamicUpdate"=dword:00000000 ; 确保动态更新未禁用
"NameResolutionPolicy"=dword:00000001  ; 启用名称解析策略
"DhcpNameProtection"=dword:00000001     ; 启用 DHCP 名称保护

 


Windows 上设置 IPv6 优先的批处理,可以使用以下命令:

@echo off

rem 禁用 IPv4
netsh interface ipv4 uninstall

rem 启用 IPv6
netsh interface ipv6 install

rem 设置 IPv6 为首选
netsh interface ipv6 set prefixpolicy ::/0 2 1

rem 重启网络适配器
netsh interface set interface "以太网" admin=disable
netsh interface set interface "以太网" admin=enable

echo IPv6 优先设置完成!
pause
请注意,上述批处理命令需要以管理员权限运行。另外,“以太网”是网络适配器的名称,你需要根据你的网络适配器名称进行修改。

你可以将上述命令保存到一个文本文件中,将文件后缀名改为 .bat,然后以管理员身份运行该批处理文件。执行完毕后,IPv6 将被设置为首选协议。


 

posted @ 2023-06-29 17:10  suv789  阅读(710)  评论(0编辑  收藏  举报