Windows 记住旧的 DNS 后缀

car*_*ett 6 windows dhcp

我只是改变了我的本地网络的DNS域从home.localmydomain.local,购买后mydomain.com。我在我的 BIND 和 DHCP 服务器中进行了所有必要的更改,网络上的 linux 客户端现在已经domain mydomain.local在它们中/etc/resolv.conf并且似乎按预期工作。

然而,Windows 机器(Win 8.1,未加入域)似乎仍然挂home.local在它的 DNS 后缀搜索列表中的域上。我已经释放了我的租约,删除了网络配置文件,扫描了注册表,grep:ed 整个 dns/dhcp 服务器以查找旧域的出现,重新启动一切......仍然,windows 机器继续搜索home.local

ipconfig /all受影响机器上的输出:

Windows IP Configuration

  Host Name . . . . . . . . . . . . : MY-MACHINE
  Primary Dns Suffix  . . . . . . . :
  Node Type . . . . . . . . . . . . : Hybrid
  IP Routing Enabled. . . . . . . . : No
  WINS Proxy Enabled. . . . . . . . : No
  DNS Suffix Search List. . . . . . : home.local

Ethernet adapter Ethernet:

  Connection-specific DNS Suffix  . : mydomain.local
  Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
  Physical Address. . . . . . . . . : 00-11-22-33-44-55
  DHCP Enabled. . . . . . . . . . . : Yes
  Autoconfiguration Enabled . . . . : Yes
  Link-local IPv6 Address . . . . . : fe80::1234:1234:1234:1234%3(Preferred)
  IPv4 Address. . . . . . . . . . . : 192.168.0.97(Preferred)
  Subnet Mask . . . . . . . . . . . : 255.255.255.0
  Lease Obtained. . . . . . . . . . : den 24 januari 2015 19:42:25
  Lease Expires . . . . . . . . . . : den 25 januari 2015 19:43:27
  Default Gateway . . . . . . . . . : fe80::1111:2222:3333:4444%3
                                      192.168.0.1
  DHCP Server . . . . . . . . . . . : 192.168.0.10
  DHCPv6 IAID . . . . . . . . . . . : 12312312
  DHCPv6 Client DUID. . . . . . . . : 00-11-22-33-44-55-66-77-88-99-AA-BB-CC-DD

  DNS Servers . . . . . . . . . . . : 192.168.0.10
  NetBIOS over Tcpip. . . . . . . . : Enabled
  Connection-specific DNS Suffix Search List :
                                      home.local
Run Code Online (Sandbox Code Playgroud)

编辑

注意连接特定的DNS后缀是正确的,但是后缀搜索列表是错误的,连接特定的和通用的IP配置。

WMI 查询显示相同 - 连接的后缀是正确的,但它没有添加到搜索列表中,它似乎重复使用了与以前相同的后缀。可能它会根据服务器记住这一点?

Jos*_*efZ 3

听起来像是DNS缓存问题。要解决此问题,请cmd以管理员身份运行并执行

ipconfig /flushdns
Run Code Online (Sandbox Code Playgroud)

甚至(尽管/allcompartments开关似乎过多)

ipconfig /allcompartments /flushdns
Run Code Online (Sandbox Code Playgroud)

进一步提示:ipconfig /?

清除ARP缓存也可能有帮助:

arp -d
Run Code Online (Sandbox Code Playgroud)

根据其他人的建议进行编辑:组策略可以作为下一个注册表项中的DNS Suffix Search List值找到:SearchList

HKLM\Software\Policies\Microsoft\Windows NT\DNSClient
Run Code Online (Sandbox Code Playgroud)

编辑 2下一个 CLI 命令的输出是什么?是否列出了不需要的 DNS 后缀?

wmic path Win32_NetworkAdapterConfiguration get caption, DNSDomainSuffixSearchOrder
wmic path Win32_NetworkAdapterConfiguration get caption, DNSDomain
Run Code Online (Sandbox Code Playgroud)

编辑 3检查值NameServerSearchList在下一个注册表项中:

 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Run Code Online (Sandbox Code Playgroud)

并在下一个注册表项下(即在每个与接口相关的子项中):

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\Parameters\Interfaces
Run Code Online (Sandbox Code Playgroud)

要使更改生效:重新启动计算机。


编辑4检查下一个模式的所有键中的所有NameServerList类型值REG_MULTI_SZ

HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_{interface_CLSID}
Run Code Online (Sandbox Code Playgroud)

接下来的PowerShell代码应该设置 DNS 后缀搜索顺序。由于本人PS不熟练,所以盗用的。

#First store the suffixes to set in a variable
$suffixes = 'mydomain.local'

#Since this is a static method, get a class object and then call the method. 
$class = [wmiclass]'Win32_NetworkAdapterConfiguration'
$class.SetDNSSuffixSearchOrder($suffixes)
Run Code Online (Sandbox Code Playgroud)

作为最后的手段:禁用系统还原,重新启动,检查wmic 上面提到的......