用 traceroute 讲故事:它是如何工作的?

Telling a story with traceroute: how does it work?

如果您在 bad.horse 上执行跟踪路由,您会得到这个惊人的结果:

⚘ traceroute bad.horse                                                                                                                                                                                                                                                               10:46:24
traceroute to bad.horse (162.252.205.157), 30 hops max, 60 byte packets
 1  gateway (192.168.42.1)  0.382 ms  0.690 ms  0.795 ms
 2  10.52.192.1 (10.52.192.1)  8.594 ms  13.533 ms  14.438 ms
 3  70.183.68.108 (70.183.68.108)  14.525 ms  14.620 ms  14.643 ms
 4  70.183.71.92 (70.183.71.92)  23.323 ms  24.356 ms  24.219 ms
 5  dalsbprj01-ae1.0.rd.dl.cox.net (68.1.2.109)  119.445 ms  120.277 ms  62.337 ms
 6  10ge6-9.core1.dal1.he.net (184.105.16.77)  70.903 ms  57.131 ms  67.526 ms
 7  10ge12-6.core1.chi1.he.net (184.105.213.118)  43.732 ms  42.770 ms  43.774 ms
 8  100ge10-1.core1.msp1.he.net (184.105.223.178)  59.138 ms  60.040 ms  60.115 ms
 9  ip-house.gigabitethernet3-6.core1.msp1.he.net (216.66.78.110)  55.395 ms  54.378 ms  55.345 ms
10  c4500-1.mpls.iphouse.net (216.250.189.170)  55.412 ms  48.480 ms  53.559 ms
11  egw-iphouse.mplsc1.mn.us.sn11.net (209.240.64.149)  52.298 ms  53.225 ms  53.372 ms
12  sandwichnet.dmarc.lga1.atlanticmetro.net (208.68.168.214)  84.848 ms  83.666 ms  84.504 ms
13  bad.horse (162.252.205.130)  84.768 ms  85.393 ms  87.570 ms
14  bad.horse (162.252.205.131)  86.527 ms  90.848 ms  83.121 ms
15  bad.horse (162.252.205.132)  91.399 ms  91.158 ms  91.256 ms
16  bad.horse (162.252.205.133)  97.087 ms  96.865 ms  96.914 ms
17  he.rides.across.the.nation (162.252.205.134)  104.836 ms  104.955 ms  104.670 ms
18  the.thoroughbred.of.sin (162.252.205.135)  108.286 ms  107.884 ms  107.020 ms
19  he.got.the.application (162.252.205.136)  109.024 ms  110.304 ms  111.553 ms
20  that.you.just.sent.in (162.252.205.137)  117.034 ms  113.230 ms  115.878 ms
21  it.needs.evaluation (162.252.205.138)  123.398 ms  122.680 ms  120.805 ms
22  so.let.the.games.begin (162.252.205.139)  129.908 ms  126.529 ms  130.947 ms
23  a.heinous.crime (162.252.205.140)  131.899 ms  132.798 ms  131.009 ms
24  a.show.of.force (162.252.205.141)  136.237 ms  136.104 ms  135.543 ms
25  a.murder.would.be.nice.of.course (162.252.205.142)  140.381 ms  141.924 ms  142.517 ms
26  bad.horse (162.252.205.143)  145.723 ms  142.737 ms  148.146 ms
27  bad.horse (162.252.205.144)  152.364 ms  152.251 ms  150.875 ms
28  bad.horse (162.252.205.145)  155.535 ms  155.014 ms  152.655 ms
29  he-s.bad (162.252.205.146)  163.286 ms  161.130 ms  163.883 ms
30  the.evil.league.of.evil (162.252.205.147)  165.159 ms  167.220 ms  164.500 ms
31  is.watching.so.beware (162.252.205.148)  170.873 ms  173.487 ms  171.568 ms
32  the.grade.that.you.receive (162.252.205.149)  176.218 ms  175.204 ms  174.433 ms
33  will.be.your.last.we.swear (162.252.205.150)  182.528 ms  184.565 ms  182.459 ms
34  so.make.the.bad.horse.gleeful (162.252.205.151)  182.353 ms  187.004 ms  188.215 ms
35  or.he-ll.make.you.his.mare (162.252.205.152)  193.428 ms  190.271 ms  192.049 ms
36  o_o (162.252.205.153)  196.362 ms  196.326 ms  196.022 ms
37  you-re.saddled.up (162.252.205.154)  201.828 ms  201.184 ms  201.339 ms
38  there-s.no.recourse (162.252.205.155)  205.054 ms  207.239 ms  205.630 ms
39  it-s.hi-ho.silver (162.252.205.156)  212.140 ms  211.960 ms  212.158 ms
40  signed.bad.horse (162.252.205.157)  211.620 ms  209.723 ms  212.074 ms

这是如何运作的?如何设置网络,使 traceroute 给你这样的结果?

呵呵呵呵不错!

这是因为 笑话的作者拥有 162.252.204.0/22(可能是 Sandwich.Net LLC 或他们的客户之一),因此他们有一个 DNS 服务器 (162.252.205.157) 对该范围内所有 PTR 查询 的回复具有权威性。

现在,他们需要为路由器分配与他们想要显示的句子数量一样多的 IP(或者还将这些 IP 分配给同一物理路由器内的虚拟实例,或者在 SVI 之间进行策略路由等。 ).

然后,他们需要在他们的自治系统 AS62512 中为 bad.horse 主机 (162.252.205.157) 定义一个入口点(路由器)(即,使用来自第一个路由器的 BGP 通告 162.252.205.157路径)。

从这个入口点开始,他们需要在指向下一个路由器的所有其他路由器上建立路由,直到 bad.horse(即定义路由器的路径,数据包进入其网络的目标 IP 为bad.horse 将跟随);换句话说是这样的:

[Internet]-->Router0 (IP x.x.x.1)-->Router1 (IP x.x.x.2)-->Router3 (IP x.x.x.3)-->[bad.horse host]

最后,在DNS服务器中,他们将路径中的IP映射为一个字符串,也就是你得到的那句话。 来自上面的例子:

x.x.x.1 -> hello.you

x.x.x.2 -> how.are.you

x.x.x.3 -> etc...

这样,当您的 traceroute 软件将从路径中的每个路由器(按顺序)接收到超时时,它会尝试通过到达其 DNS 服务器将 IP 解析为名称,接收语句(按顺序) DNS 名称的形式)他们配置。