无法在 Windows 7 中按名称 ping 本地计算机

aar*_*rkk 14 networking windows-7 wireless-networking home-networking ip

我在按名称 ping 网络上的本地机器时遇到了一个奇怪的(并且持续存在的!)问题。我相信我的机器(Windows 7 64 位)是唯一有此问题的机器。这是通过无线连接。

例如,请考虑我网络上名为 的设备WDTVLiveHub。这是一个西部数据直播中心(惊喜!)。如果我在浏览器中访问路由器的 DHCP 客户端表(我的路由器是 WRT400N),我会看到以下条目:

WDTVLiveHub 192.168.1.101
Run Code Online (Sandbox Code Playgroud)

伟大的。所以我尝试ping那个IP地址:

ping 192.168.1.101

Pinging 192.168.1.101 with 32 bytes of data:
Reply from 192.168.1.101: bytes=32 time=9ms TTL=64
Reply from 192.168.1.101: bytes=32 time=16ms TTL=64
Reply from 192.168.1.101: bytes=32 time=16ms TTL=64
Reply from 192.168.1.101: bytes=32 time=16ms TTL=64

Ping statistics for 192.168.1.101:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 9ms, Maximum = 16ms, Average = 14ms
Run Code Online (Sandbox Code Playgroud)

好吧,看起来还是不错的。现在我尝试按名称 ping 它:

ping WDTVLiveHub

Ping request could not find host WDTVLiveHub. Please check the name and try again.
Run Code Online (Sandbox Code Playgroud)

根据我的阅读,这意味着 DNS 服务器和主机名查找存在问题。有趣的是,如果我输入以下内容:

pathping 192.168.1.101

我得到这个输出:

Tracing route to WDTVLIVEHUB [192.168.1.101]
over a maximum of 30 hops:
  0  Scotty [192.168.1.103]
  1  WDTVLIVEHUB [192.168.1.101]

Computing statistics for 25 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0                                           Scotty [192.168.1.103]
                                1/ 100 =  1%   |
  1   12ms     1/ 100 =  1%     0/ 100 =  0%  WDTVLIVEHUB [192.168.1.101]

Trace complete.
Run Code Online (Sandbox Code Playgroud)

Scotty 显然是我本地机器的名字。所以当我这样做时它能够以某种方式找到名字......

ipconfig /all 在 DNS 服务器下显示以下内容:

   DNS Servers . . . . . . . . . . . : 192.168.1.1
                                       ***.***.***.***
                                       ***.***.***.***
Run Code Online (Sandbox Code Playgroud)

其中 * 表示通过 Internet 在 DNS 1 和 DNS 2 下显示在我的路由器中的相同 DNS 服务器。

为了完整起见,这里是整个输出ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : Scotty
   Primary Dns Suffix  . . . . . . . : 
   Node Type . . . . . . . . . . . . : Peer-Peer
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Dell Wireless 1397 WLAN Mini-Card
   Physical Address. . . . . . . . . : 0C-EE-E6-D1-07-E8
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv6 Address. . . . . . . . . . . : 2002:d83a:31e5:1234:5592:398e:8968:43d1(Preferred) 
   Temporary IPv6 Address. . . . . . : 2002:d83a:31e5:1234:ecce:2f79:72a5:5273(Preferred) 
   Link-local IPv6 Address . . . . . : fe80::5592:398e:8968:43d1%26(Preferred) 
   IPv4 Address. . . . . . . . . . . : 192.168.1.103(Preferred) 
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : September-17-12 11:05:57 PM
   Lease Expires . . . . . . . . . . : September-18-12 11:05:57 PM
   Default Gateway . . . . . . . . . : fe80::200:ff:fe00:0%26
                                       192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 537718502
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-12-80-3D-D7-00-26-B9-0D-08-70
   DNS Servers . . . . . . . . . . . : 192.168.1.1
                                       ***.***.***.***
                                       ***.***.***.***
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : 08-00-27-00-98-9A
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::b48a:916b:c0f:fb29%23(Preferred) 
   Autoconfiguration IPv4 Address. . : 169.254.251.41(Preferred) 
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . : 
   DHCPv6 IAID . . . . . . . . . . . : 570949671
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-12-80-3D-D7-00-26-B9-0D-08-70
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter Local Area Connection* 15:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{55899375-C31D-4173-A529-4427D63FD28B}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{64B8F35F-A6AB-4D6B-B1D5-DD95F57B1458}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
Run Code Online (Sandbox Code Playgroud)

不确定如何准确诊断正在发生的事情......但这个问题真的很令人沮丧!最大的问题是我映射的网络驱动器必须通过 IP 来完成,然后每当路由器为这些设备分配新的 IP 地址时,我的所有网络共享都会再次中断。臭!

希望对可能的解决方案提供一些帮助。我已经尝试了所有这些netsh目录重置,但似乎根本没有解决任何问题。也希望能解释一下出了什么问题,而不是盲目地重置!

更新:我运行 Wireshark 1.8.2 以查看运行ping请求时发生了什么。Wireshark 立即LLMNR向我认为正确的多播目的地显示了四个请求。其中两个是 IPv4,另外两个是 IPv6。我没有看到任何 ICMP 数据包?LLMNR 应该独立工作吗?

更新 2:我可以按名称 ping 网络上的另一台机器(Windows Vista)。这与 LLMNR 仅在较新的 Windows 机器上受支持,而在我网络上的其他设备上不受支持的想法一致。我在另一台机器上安装了 WireShark ,发现从那里 ping 时,它还发出 NBNS 数据包——NetBIOS Name Service。这意味着不知何故我的机器由于某种原因没有发送 NBNS 查询。还在挖...

更新 3:似乎无法发送 NetBIOS 数据包。我认为这是根本原因。我尝试通过组策略禁用 LLMNR,希望 NetBIOS 能够神奇地启动,但没有运气。ipconfig显示 TCP/IP 上的 NetBIOS 已启用,但 WireShark 未显示发送任何 NetBIOS 名称解析数据包。我试过禁用然后重新启用它。我还尝试了nbtstat winsock reset catalog和的两个经典命令nbtstat int ip reset reset.log,但它们根本没有解决 NetBIOS 问题。希望得到一些指导......

解决了!非常感谢 wmz。他或她确实准确地指出了问题所在:无论出于何种原因,我的 TCP/IP 上的 NetBIOS 已将自身设置为以对等模式运行。经过一些研究,结果证明点对点模式仅在您设置了 WINS 服务器时才有效(我绝对没有!)。我深入注册表,在 NodeType 下没有发现任何条目,但确实有一个 DhcpNodeType 条目,其(恐怖的恐怖!)值为 0x00000002。值为 1 是广播(本来很好),2 是点对点(需要 WINS 服务器!Ack!),4 次尝试 WINS 服务器然后广播,8 次尝试广播然后 WINS 服务器(称为“混合”模式)。删除 DhcpNodeType 条目并重新启动后,我发现ipconfig /all现在显示混合模式。所以看起来这是 Windows 7 Ultimate 64 位的默认设置。我尝试了 ping wdtvlivehub,并立即感受到了成功的甜蜜滋味。非常感谢大家的各种回答。我很高兴在没有重新安装 Windows 或一些疯狂的事情的情况下解决了这个问题。我仍然不知道这个值是如何改变的......但至少它是另一件需要寻找的东西,希望这些信息可以帮助其他人处理令人沮丧的网络问题!解决这个问题的感觉真好!赏金好赚!

谢谢!

wmz*_*wmz 15

您的发现似乎指向 netbios 解析器,这反过来又使此条目成为可疑对象:
Node Type . . . . . . . . . . . . : Peer-Peer

Netbios 节点类型 p(2) - 通常仅用于 Wins 服务器(我假设您没有) - 有效地禁用任何 netbios 名称解析广播。

这篇文章描述了与您的问题非常相似的问题,并且还链接到Msoft technet 文章,详细介绍了如何将节点类型重置为更合理的内容:

要解决此问题,请执行以下步骤:

Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBt\Parameters
In the right pane of Registry Editor, delete the following values if they are present:
    NodeType
    DhcpNodeType
Run Code Online (Sandbox Code Playgroud)

注意 如果存在 NodeType 值,该值将覆盖 DhcpNodeType 值。如果两个子项都不存在并且没有为客户端配置 WINS 服务器,则计算机使用 b 节点模式。如果至少配置了一台 WINS 服务器,则计算机使用 h 节点模式。退出注册表编辑器。重新启动计算机。再次尝试查看网络上的工作组计算机。