对话 UNIX: TCP/IP 内幕
2008-11-11 08:12:45 来源:WEB开发网以下示例证实我能够连接到 Google.com 的 IP 地址 64.233.167.99:
ping 64.233.167.99
PING 64.233.167.99: (64.233.167.99): 56 data bytes
64 bytes from 64.233.167.99: icmp_seq=0 ttl=240 time=40 ms
64 bytes from 64.233.167.99: icmp_seq=1 ttl=240 time=41 ms
64 bytes from 64.233.167.99: icmp_seq=2 ttl=240 time=48 ms
64 bytes from 64.233.167.99: icmp_seq=3 ttl=240 time=40 ms
^C
----64.233.167.99 PING Statistics----
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 40/42/48 ms
但有些时候,ping 不能作为确认能够连接到服务器的唯一工具,因为服务器可能通过防火墙阻止了 ICMP 请求。以下示例显示 ICMP 被阻止并模拟无法连接到 IBM.com 的 IP 地址 129.42.18.103 的情况:
ping 129.42.18.103
PING 129.42.18.103: (129.42.18.103): 56 data bytes
^C
----129.42.18.103 PING Statistics----
6 packets transmitted, 0 packets received, 100% packet loss
到目前为止,我仅尝试了 ping IP 地址。在已确认了第一个故障诊断步骤之后,您应该尝试 ping 通过 DNS 解析的实际主机名:
ping google.com
PING google.com: (64.233.167.99): 56 data bytes
64 bytes from 64.233.167.99: icmp_seq=0 ttl=240 time=40 ms
64 bytes from 64.233.167.99: icmp_seq=1 ttl=240 time=43 ms
^C
----google.com PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 40/41/43 ms
更多精彩
赞助商链接