请教一个计算机网络的问题,为什么 traceroute 看不到路由信息

2021-08-05 18:38:22 +08:00
 magic3584

起因

公司里,A 电脑使用有线连接,本机使用 wifi 连接。本机 ping A 电脑能 ping 通,但是 traceroute 找不到路由信息

相关截图

疑问

想请问各位大佬:

为什么 traceroute 返回都是 * 并且看不到路由信息(如果能详细就最好了,我学习以后再来加深理解)

感觉计算机网络还得再学一学。。。

1814 次点击
所在节点   计算机
17 条回复
learningman
2021-08-05 19:37:08 +08:00
trackroute 的原理是发送 TTL 递增的 ICMP 包
privil
2021-08-05 19:40:10 +08:00
可以用 mtr
Tianao
2021-08-05 19:47:29 +08:00
有些路由器不返回 ICMP 报文告知源主机 TTL 过期。
freelancher
2021-08-05 22:29:20 +08:00
二楼说的应该是正确的。
weyou
2021-08-05 23:02:35 +08:00
@learningman 并不是! traceroute 默认发送的是 UDP 包
magic3584
2021-08-05 23:08:45 +08:00
@learningman #1

@weyou #5

大佬能否详细说说
weyou
2021-08-05 23:11:18 +08:00
显示*号就是这个节点没有任何回应呗,可能是防火墙挡掉了,可以换用不用的 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.
magic3584
2021-08-05 23:19:45 +08:00
@Tianao #3
用 TCP 和 UDP 也不返回吗?
如果没收到 ICMP 报文或者 TTL 过期,就自动 TTL+1 发下一个报文吗?
第一个图里为什么两次 traceroute 跳数不一致呢?
magic3584
2021-08-05 23:22:38 +08:00
@weyou #7
大佬麻烦看下上图里为什么跳数不一致呢?
另附言里 3 种协议都试了,均无反应
hahasong
2021-08-06 00:02:52 +08:00
这 Ping 它干啥,已知 AB 的 IP 和子网,分属不同的子网,能 ping 通说明两个子网相连,要通的话肯定第一跳是你的网关,最后一跳是 B 的网关
Samuelcc
2021-08-06 03:02:43 +08:00
很多商业路由不会响应 traceroute,防止针对攻击。
Tianao
2021-08-06 08:09:53 +08:00
@magic3584 #8 那就是源主机期望中间路由器返回一个 ICMP 目的不可达但路由器不一定返回,返不返回是可以配置的,与技术原理 /厂商实现没有必然关系。
AllenHua
2021-08-06 08:41:23 +08:00
Linux 下使用 traceroute 出现星号,一般原因是 linux 的 traceroute 默认使用 tcp 或 udp,强制使用 ICMP 就行了。https://hellodk.cn/post/19
AllenHua
2021-08-06 09:07:26 +08:00
```
# 大写的 I,指定 ICMP protocol
$ traceroute -I example.com
```

https://www.computerhope.com/unix/utracero.htm
magic3584
2021-08-06 10:14:37 +08:00
@hahasong #10
主要是刚又看了点网络的东西,就试着分析一下,结果跟我想的不太对。。。
magic3584
2021-08-06 10:15:44 +08:00
@AllenHua #13
附言里都使用了,结果差不多。。。
magic3584
2021-08-06 10:30:03 +08:00
@privil #2
已附言,看来结果都一样

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/793913

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX