到www.2ccc.com下载一个indy的demo程序,里面有个DNSResolver,这是www.sohu.com.cn的结果 ======================== Query Result : IP address of www.sohu.com.cn : IP address = 61.135.133.104 IP address = 61.135.133.103 Name Server = ns2.sohu.com Name Server = dns.sohu.com Name Server = ns1.sohu.com IP address = 61.135.131.86 Query Result : IP address of www.sohu.com.cn : IP address = 61.135.133.104 IP address = 61.135.133.103 Name Server = ns2.sohu.com Name Server = dns.sohu.com Name Server = ns1.sohu.com IP address = 61.135.131.86 IP address = 61.135.131.1 IP address = 61.135.132.1========================IP address = 61.135.131.1 IP address = 61.135.132.1========================
ping不通和域名解析没有关系,即使ping不通,也会显示ip地址并显示超时。如果DNS出错,比如ping一个不存在的域名,他会告诉你未知主机的。 C:\Documents and Settings\Administrator>ping www.sohu.comPinging pagegrp1.sohu.com [61.135.150.65] with 32 bytes of data:Request timed out. Request timed out. Request timed out. Request timed out.Ping statistics for 61.135.150.65: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0msC:\Documents and Settings\Administrator>ping wwww.aa.com Unknown host wwww.aa.com.
我觉得ping不通,其它命令是得不到ip的我试了下,还真能得到,我用nbtstat -r
我觉得ping不通,其它命令是得不到ip的
PING不通,是因为与那个IP绑定的设备(可能是台防火墙)将ICMP包给屏蔽了,PING命令发过去的ICMP包得不到返回包,显示的结果就是PING不通。而一个域名(比如www.sohu.com)所对应的IP地址是通过DNS服务来查询的,它与PING通不通无关。另外,在PING程序中,其实是先通过DNS服务将域名转换成IP后,才向这个IP发送ICMP数据包的。也就是说,PING www.sohu.com 和PING 61.135.132.80这两条命令的执行过程是不同的。
========================
Query Result : IP address of www.sohu.com.cn : IP address = 61.135.133.104
IP address = 61.135.133.103
Name Server = ns2.sohu.com
Name Server = dns.sohu.com
Name Server = ns1.sohu.com
IP address = 61.135.131.86
Query Result : IP address of www.sohu.com.cn : IP address = 61.135.133.104
IP address = 61.135.133.103
Name Server = ns2.sohu.com
Name Server = dns.sohu.com
Name Server = ns1.sohu.com
IP address = 61.135.131.86
IP address = 61.135.131.1
IP address = 61.135.132.1========================IP address = 61.135.131.1
IP address = 61.135.132.1========================
C:\Documents and Settings\Administrator>ping www.sohu.comPinging pagegrp1.sohu.com [61.135.150.65] with 32 bytes of data:Request timed out.
Request timed out.
Request timed out.
Request timed out.Ping statistics for 61.135.150.65:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0msC:\Documents and Settings\Administrator>ping wwww.aa.com
Unknown host wwww.aa.com.