例如,ping 到 192.168.1.1 上的我的路由器或 google.com 都没有问题,但 ping 到 127.0.0.1、localhost 或 ::1 则会导致:
C:\>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
General failure.
General failure.
General failure.
General failure.
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
我已激活 Windows 防火墙丢弃数据包日志。结果如下:
#Fields: date time action protocol src-ip dst-ip src-port dst-port size tcpflags tcpsyn tcpack tcpwin icmptype icmpcode info path
2012-10-08 16:36:55 DROP TCP 127.0.0.1 127.0.0.1 4383 443 48 S 1694698661 0 8192 - - - RECEIVE
2012-10-08 16:37:07 DROP TCP 127.0.0.1 127.0.0.1 4389 80 52 S 3914643729 0 8192 - - - RECEIVE
2012-10-08 16:34:49 DROP UDP 127.0.0.1 127.0.0.1 51995 51996 30 - - - - - - - RECEIVE
2012-10-08 16:34:49 DROP UDP 127.0.0.1 127.0.0.1 51997 51998 30 - - - - - - - RECEIVE
2012-10-08 16:34:49 DROP UDP 127.0.0.1 127.0.0.1 51999 52000 30 - - - - - - - RECEIVE
2012-10-08 16:34:56 DROP ICMP 127.0.0.1 127.0.0.1 - - 60 - - - - 8 0 - RECEIVE
2012-10-08 16:34:57 DROP ICMP 127.0.0.1 127.0.0.1 - - 60 - - - - 8 0 - RECEIVE
2012-10-08 16:34:58 DROP ICMP 127.0.0.1 127.0.0.1 - - 60 - - - - 8 0 - RECEIVE
好像所有传入的数据包都被丢弃了。但我可以浏览、编写和接收电子邮件等。
我已经尝试通过以下方式重置 IP/TCP 堆栈:
- netsh int ip 重置
- netsh winsock 重置
- 路线/f
- ipconfig /重置,ipconfig /更新
如果我禁用防火墙,ping 结果不会改变。
答案1
Ping 是系统可以实现或不实现的一项服务(事实上,一些路由器和系统不会回复 ping 消息,以避免被发现扫描网络内的计算机)。
看来需要按照说明在 Windows-7 中启用此功能这里。
以机智:
Control Panel --> System and security --> Windows Firewall --> Advanced settings -->
Inbound rules --> New rule --> custom rule
in Protocol and ports: Protocol: ICMPv4
on the same panel go to customize, choose "Specific ICMP types",
check the box "echo request"