Linux

traceroute 一直打印 * * * , 但是 ping baidu.com 没有问题

ping baidu.com

[kami@localhost ~]$ ping baidu.com
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=128 time=17.6 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=3 ttl=128 time=7.69 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=4 ttl=128 time=17.5 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=5 ttl=128 time=17.0 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=6 ttl=128 time=14.9 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=7 ttl=128 time=19.0 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=8 ttl=128 time=7.17 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=9 ttl=128 time=19.2 ms
^C
--- baidu.com ping statistics ---
9 packets transmitted, 8 received, 11.1111% packet loss, time 60ms
rtt min/avg/max/mdev = 7.167/15.022/19.162/4.552 ms

traceroute www.baidu.com

[kami@localhost ~]$ sudo traceroute www.baidu.com
traceroute to www.baidu.com (182.61.200.6), 30 hops max, 60 byte packets
 1  _gateway (192.168.72.2)  3.827 ms  3.627 ms  3.524 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
....

traceroute -I www.baidu.com

[kami@localhost ~]$ sudo traceroute -I www.baidu.com
traceroute to www.baidu.com (182.61.200.7), 30 hops max, 60 byte packets
 1  _gateway (192.168.72.2)  3.072 ms  2.583 ms  2.477 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  182.61.200.7 (182.61.200.7)  15.992 ms  16.142 ms  17.976 ms

默认, traceroute 使用 UDP 端口 查找 主机, 然而 有时 防火墙 屏蔽 了这些 UDP 端口.

命令中使用 -I

例如 

traceroute -I www.google.com

使用 ICMP 代替 UDP 追踪 主机.

By default, traceroute uses high UDP ports for tracing hosts. However, sometime firewalls block these UDP ports.

Try to add the "-I" (uppercase i) parameter to the command line, eg:

traceroute -I www.google.it

This will use ICMP instead of UDP for tracing hosts.

原文地址:https://www.cnblogs.com/firestar277/p/14661752.html