公司里,A 电脑使用有线连接,本机使用 wifi 连接。本机 ping A 电脑能 ping 通,但是 traceroute 找不到路由信息
想请问各位大佬:
为什么 traceroute 返回都是 * 并且看不到路由信息(如果能详细就最好了,我学习以后再来加深理解)
感觉计算机网络还得再学一学。。。
➜ ~ traceroute -P TCP 172.16.107.38
traceroute to 172.16.107.38 (172.16.107.38), 64 hops max, 64 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 *^Z
[10] + 787 suspended traceroute -P TCP 172.16.107.38
➜ ~ traceroute -P UDP 172.16.107.38
traceroute to 172.16.107.38 (172.16.107.38), 64 hops max, 52 byte packets
1 * * *
2 172.16.107.38 (172.16.107.38) 25.092 ms 18.907 ms 5.527 ms
➜ ~ traceroute -P ICMP 172.16.107.38
traceroute to 172.16.107.38 (172.16.107.38), 64 hops max, 72 byte packets
1 * * *
2 172.16.107.38 (172.16.107.38) 9.580 ms 4.589 ms 5.172 ms
My traceroute [v0.94]
MacBook-Pro.local (172.16.101.60) -> 172.16.107.38 2021-08-06T10:28:13+0800
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. (waiting for reply)
2. 172.16.107.38 0.0% 51 6.1 43.8 3.4 350.9 82.5
1
learningman 2021-08-05 19:37:08 +08:00 via Android 1
trackroute 的原理是发送 TTL 递增的 ICMP 包
|
2
privil 2021-08-05 19:40:10 +08:00 1
可以用 mtr
|
3
Tianao 2021-08-05 19:47:29 +08:00 via iPhone 1
有些路由器不返回 ICMP 报文告知源主机 TTL 过期。
|
4
freelancher 2021-08-05 22:29:20 +08:00
二楼说的应该是正确的。
|
5
weyou 2021-08-05 23:02:35 +08:00 via Android
@learningman 并不是! traceroute 默认发送的是 UDP 包
|
6
magic3584 OP |
7
weyou 2021-08-05 23:11:18 +08:00 via Android 1
显示*号就是这个节点没有任何回应呗,可能是防火墙挡掉了,可以换用不用的 probe 方式,比如-I 或者-T 试试
From `man traceroute`: This program attempts to trace the route an IP packet would follow to some internet host by launching probe packets with a small ttl (time to live) then listening for an ICMP "time exceeded" reply from a gateway. We start our probes with a ttl of one and increase by one until we get an ICMP "port unreachable" (or TCP reset), which means we got to the "host", or hit a max (which defaults to 30 hops). Three probes (by default) are sent at each ttl setting and a line is printed showing the ttl, address of the gateway and round trip time of each probe. The address can be followed by addi‐ tional information when requested. If the probe answers come from different gateways, the address of each responding system will be printed. If there is no response within a certain timeout, an "*" (asterisk) is printed for that probe. |
8
magic3584 OP |
10
hahasong 2021-08-06 00:02:52 +08:00 1
这 Ping 它干啥,已知 AB 的 IP 和子网,分属不同的子网,能 ping 通说明两个子网相连,要通的话肯定第一跳是你的网关,最后一跳是 B 的网关
|
11
Samuelcc 2021-08-06 03:02:43 +08:00 via Android 1
很多商业路由不会响应 traceroute,防止针对攻击。
|
12
Tianao 2021-08-06 08:09:53 +08:00 via iPhone
@magic3584 #8 那就是源主机期望中间路由器返回一个 ICMP 目的不可达但路由器不一定返回,返不返回是可以配置的,与技术原理 /厂商实现没有必然关系。
|
13
AllenHua 2021-08-06 08:41:23 +08:00 via iPhone
Linux 下使用 traceroute 出现星号,一般原因是 linux 的 traceroute 默认使用 tcp 或 udp,强制使用 ICMP 就行了。https://hellodk.cn/post/19
|
14
AllenHua 2021-08-06 09:07:26 +08:00 1
```
# 大写的 I,指定 ICMP protocol $ traceroute -I example.com ``` https://www.computerhope.com/unix/utracero.htm |