(三)Ping程序和Traceroute程序

1. Ping

Ping程序,目的是为了测试另一台主机是否可达。该程序发送一份ICMP回显请求报文,并等待回显应答。

一般来说,如果不能Ping到某台主机,那么就不能Telnet或者FTP到那台主机,可用Ping程序来确定问题出在哪里。
Ping程序还能测出到这台主机的往返时间,以表明该主机离我们有多远。

[root@thor bin]# ping 10.12.5.16 -R   
PING 10.12.5.16 (10.12.5.16) 56(124) bytes of data.
64 bytes from 10.12.5.16: icmp_seq=1 ttl=60 time=6.70 ms
RR:     10.66.91.11
        10.0.0.138
        10.1.3.14
        10.0.13.17
        10.12.5.254
        10.12.5.16
        10.12.5.16
        10.0.13.18
        10.1.3.13

64 bytes from 10.12.5.16: icmp_seq=2 ttl=60 time=8.40 ms        (same route)
64 bytes from 10.12.5.16: icmp_seq=3 ttl=60 time=19.9 ms        (same route)
64 bytes from 10.12.5.16: icmp_seq=4 ttl=60 time=38.4 ms        (same route)
64 bytes from 10.12.5.16: icmp_seq=5 ttl=60 time=6.71 ms        (same route)
^C
--- 10.12.5.16 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 6.708/16.057/38.488/12.263 ms

IP记录路由选项 ping -R 提供了查看IP记录路由(RR)选项的机会。

小结:Ping程序是对连个TCP/IP系统连通性进行测试的基本工具。它只利用ICMP回显请求-应答报文,而不用经过传输层(TCP/UDP)。Ping服务器一般在内核中实现ICMP的功能。

2. Traceroute

Traceroute程序,可以让我们看到IP数据报从一台主机传到另一台主机所经过的路由。

[root@thor bin]# traceroute 10.12.5.16
traceroute to 10.12.5.16 (10.12.5.16), 30 hops max, 60 byte packets
 1  10.66.91.254 (10.66.91.254)  0.516 ms  0.721 ms  0.915 ms
 2  10.0.0.137 (10.0.0.137)  1.074 ms  1.253 ms  1.398 ms
 3  10.1.3.13 (10.1.3.13)  1.195 ms  1.369 ms  1.514 ms
 4  10.0.13.18 (10.0.13.18)  2.377 ms  1.859 ms  2.796 ms
 5  10.12.5.16 (10.12.5.16)  0.358 ms  0.364 ms  0.352 ms
原文地址:https://www.cnblogs.com/walkinginthesun/p/9632846.html