traceroute命令结果分析

1. 基本原理

客户端发送的数据包,服务器在收到这个数据包的时候会返回1个端口不可达的ICMP错误信息,客户端通过判断收到的错误信息是TTL超时还是端口不可达来判断数据包是否到达目标主机,具体的流程:

  1. 客户端发送⼀个TTL为1的数据包,到达第1站路由器之后TTL被减去1,返回了1个超时的ICMP数据包,客户端得到第1跳路由器的地址。
  2. 客户端发送⼀个TTL为2的数据包,在第2跳的路由器节点处超时,得到第2跳路由器的地址。
  3. 客户端发送⼀个TTL为3的数据包,数据包成功到达目标主机,返回1个端口不可达错误,traceroute结束。

traceroute工作原理图

注:当路由节点或者目标主机不反馈任何响应时,从命令结果上可以看到“*”号超时信息。

通常在实现的时候,会有两种报文构造方式:UDPICMP

  • 从理论的角度ICMP属于L3,而UDP属于L4,且ICMP属于IP管理报文,因而ICMP属于网络管理报文,而UDP更偏向应用报文。越高层的应用被墙的可能越高,因此得不到相应的追踪结果就可想而知。
  • 从应用的角度来说,TCP/UDP都是同一个级别的应用层报文,如果服务不需要支持UDP,可以把UDP协议给封掉(比如:HTTP/HTTPS服务器)。

这里我们只是help下命令,接下去我们需要从实际的角度去看下这两种报文对于结果分析的影响。

$ traceroute --help
Usage:
  traceroute [ -46dFITnreAUDV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w MAX,HERE,NEAR ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] [ --fwmark=num ] host [ packetlen ]
Options:
  -4                          Use IPv4
  -6                          Use IPv6
  -d  --debug                 Enable socket level debugging
  -F  --dont-fragment         Do not fragment packets
  -f first_ttl  --first=first_ttl
                              Start from the first_ttl hop (instead from 1)
  -g gate,...  --gateway=gate,...
                              Route packets through the specified gateway
                              (maximum 8 for IPv4 and 127 for IPv6)
  -I  --icmp                  Use ICMP ECHO for tracerouting
  -T  --tcp                   Use TCP SYN for tracerouting (default port is 80)
  -i device  --interface=device
                              Specify a network interface to operate with
  -m max_ttl  --max-hops=max_ttl
                              Set the max number of hops (max TTL to be
                              reached). Default is 30
  -N squeries  --sim-queries=squeries
                              Set the number of probes to be tried
                              simultaneously (default is 16)
  -n                          Do not resolve IP addresses to their domain names
  -p port  --port=port        Set the destination port to use. It is either
                              initial udp port value for "default" method
                              (incremented by each probe, default is 33434), or
                              initial seq for "icmp" (incremented as well,
                              default from 1), or some constant destination
                              port for other methods (with default of 80 for
                              "tcp", 53 for "udp", etc.)
  -t tos  --tos=tos           Set the TOS (IPv4 type of service) or TC (IPv6
                              traffic class) value for outgoing packets
  -l flow_label  --flowlabel=flow_label
                              Use specified flow_label for IPv6 packets
  -w MAX,HERE,NEAR  --wait=MAX,HERE,NEAR
                              Wait for a probe no more than HERE (default 3)
                              times longer than a response from the same hop,
                              or no more than NEAR (default 10) times than some
                              next hop, or MAX (default 5.0) seconds (float
                              point values allowed too)
  -q nqueries  --queries=nqueries
                              Set the number of probes per each hop. Default is
                              3
  -r                          Bypass the normal routing and send directly to a
                              host on an attached network
  -s src_addr  --source=src_addr
                              Use source src_addr for outgoing packets
  -z sendwait  --sendwait=sendwait
                              Minimal time interval between probes (default 0).
                              If the value is more than 10, then it specifies a
                              number in milliseconds, else it is a number of
                              seconds (float point values allowed too)
  -e  --extensions            Show ICMP extensions (if present), including MPLS
  -A  --as-path-lookups       Perform AS path lookups in routing registries and
                              print results directly after the corresponding
                              addresses
  -M name  --module=name      Use specified module (either builtin or external)
                              for traceroute operations. Most methods have
                              their shortcuts (`-I' means `-M icmp' etc.)
  -O OPTS,...  --options=OPTS,...
                              Use module-specific option OPTS for the
                              traceroute module. Several OPTS allowed,
                              separated by comma. If OPTS is "help", print info
                              about available options
  --sport=num                 Use source port num for outgoing packets. Implies
                              `-N 1'
  --fwmark=num                Set firewall mark for outgoing packets
  -U  --udp                   Use UDP to particular port for tracerouting
                              (instead of increasing the port per each probe),
                              default port is 53
  -UL                         Use UDPLITE for tracerouting (default dest port
                              is 53)
  -D  --dccp                  Use DCCP Request for tracerouting (default port
                              is 33434)
  -P prot  --protocol=prot    Use raw packet of protocol prot for tracerouting
  --mtu                       Discover MTU along the path being traced. Implies
                              `-F -N 1'
  --back                      Guess the number of hops in the backward path and
                              print if it differs
  -V  --version               Print version info and exit
  --help                      Read this help and exit

Arguments:
+     host          The host to traceroute to
      packetlen     The full packet length (default is the length of an IP
                    header plus 40). Can be ignored or increased to a minimal
                    allowed value

2. IP地址种类

2.1 A类IP地址

A类地址的表示范围为:0.0.0.0~126.255.255.255,默认网络掩码为:255.0.0.0,A类网络用第一组数字表示网络本身的地址,后面三组数字作为连接于网络上的主机的地址,即高端位0,接下来7位表示网络ID,其余24位表示宿主机ID。A类地址分配给具有大量主机(直接个人用户)而局域网络个数较少的型网络。例如IBM公司的网络。

A类地址适合于网络较少而节点较多的情况,网络数为128个,每一网向络的节点数为1600个。

2.2 B类IP地址

B类地址的表示范围为:128.0.0.0~223.255.255.255,默认网络掩码为:255.0.0.0。B类地址分配给一般的中型网络。B类网络用第一、二组数字表示网络的地址,后面两组数字代表网络上的主机地址,即高端位10,接下来14位表示网络ID,其余16位表示宿主机ID。

B类地址适合于网络数和节点数适中的情况,网络数为16000个,每一网络的节点数为64000个。

2.3 C类IP地址

C类地址的表示范围为:192.0.0.0.~223.255.255.255,默认网络掩码为:255.255.255.0;C类地址分配给小型网络,如一般的局域网和校园网,它可连接的主机数量是最少的,采用所属的用户分为若干的网段进行管理。C类网络用前三组数字表示网络的地址,最后一组数字作为网络上的主机地址,即高端位110,接下来的21位表示网络ID,其余8位表示宿主机ID。

C类地址适合于网络数较多而节点较少的情况,网络数为2百万个,每个网络的节点数为256个。

2.4 D类地址用于多点广播(Multicast)。

D类IP地址第一个字节以“lll0”开始,它是一个专门保留的地址。它并不指向特定的网络,目前这一类地址被用在多点广播(Multicast)中。多点广播地址用来一次寻址一组计算机,它标识共享同一协议的一组计算机。

2.5 E类IP地址

以“llll0”开始,为将来使用保留。 全零(“0.0.0.0”)地址对应于当前主机。全“1”的IP地址(“255.255.255.255”)是当前子网的广播地址。

3. 测试

注1:两次测试间隔10分钟;每次测试两个命令顺序执行。
注2:命令反馈结果第一行显示跟踪目标地址,跳跃数(30),以及报文大小。

3.1 第一次

$ traceroute www.taobao.com
traceroute to www.taobao.com (111.3.86.235), 30 hops max, 60 byte packets
 1  192.168.68.1 (192.168.68.1)      0.278 ms  0.325 ms  0.368 ms
 2  192.168.1.1 (192.168.1.1)        1.411 ms  1.524 ms  1.536 ms
 3  10.105.0.1 (10.105.0.1)          4.352 ms  4.567 ms  4.683 ms
 4  111.0.94.77 (111.0.94.77)        4.500 ms  5.054 ms  5.023 ms
 5  183.248.154.69 (183.248.154.69)  9.122 ms  211.138.114.177 (211.138.114.177)  6.865 ms 183.248.154.61 (183.248.154.61)  16.148 ms
 6  112.11.232.210 (112.11.232.210)  9.169 ms  6.408 ms  120.199.239.98 (120.199.239.98)    7.845 ms
 7  111.0.36.182 (111.0.36.182)      8.210 ms  111.3.81.238 (111.3.81.238)         7.701 ms 111.0.36.154 (111.0.36.154)  7.605 ms
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
$ traceroute -I www.taobao.com
traceroute to www.taobao.com (111.3.86.234), 30 hops max, 60 byte packets
 1  192.168.68.1 (192.168.68.1)      0.241 ms  0.306 ms  0.342 ms
 2  192.168.1.1 (192.168.1.1)        0.990 ms  1.102 ms  1.418 ms
 3  10.105.0.1 (10.105.0.1)          4.671 ms  4.764 ms  4.804 ms
 4  111.0.94.73 (111.0.94.73)        6.610 ms  6.625 ms  6.621 ms
 5  117.148.181.29 (117.148.181.29)  6.435 ms  6.423 ms  6.437 ms
 6  112.15.224.74 (112.15.224.74)    9.931 ms  7.048 ms  7.534 ms
 7  111.0.36.154 (111.0.36.154)      9.137 ms  8.817 ms  9.016 ms
 8  192.168.11.10 (192.168.11.10)    8.990 ms  9.101 ms  8.963 ms
 9  10.120.120.6 (10.120.120.6)      9.181 ms  8.235 ms  8.474 ms
10  111.3.86.234 (111.3.86.234)      8.100 ms  8.237 ms  8.375 ms

3.2 第二次

$ traceroute www.taobao.com
traceroute to www.taobao.com (111.3.86.235), 30 hops max, 60 byte packets
 1  192.168.68.1 (192.168.68.1)        0.598 ms  0.547 ms  0.522 ms
 2  192.168.1.1 (192.168.1.1)          1.403 ms  1.526 ms  1.495 ms
 3  10.105.0.1 (10.105.0.1)            4.463 ms  5.138 ms  5.386 ms
 4  111.0.94.77 (111.0.94.77)          5.163 ms  5.132 ms  5.209 ms
 5  112.11.232.49 (112.11.232.49)      11.981 ms 120.199.246.237 (120.199.246.237)  9.461 ms 117.148.181.13 (117.148.181.13)    6.458 ms
 6  120.199.239.114 (120.199.239.114)  10.846 ms 112.15.224.54 (112.15.224.54)      6.480 ms 183.248.154.242 (183.248.154.242)  8.207 ms
 7  111.0.36.154 (111.0.36.154)        8.221 ms  111.0.36.178 (111.0.36.178)        8.809 ms 111.0.36.174 (111.0.36.174)        8.211 ms
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
$ traceroute -I www.taobao.com
traceroute to www.taobao.com (111.3.86.235), 30 hops max, 60 byte packets
 1  192.168.68.1 (192.168.68.1)        0.222 ms  0.259 ms  0.305 ms
 2  192.168.1.1 (192.168.1.1)          0.936 ms  1.066 ms  1.237 ms
 3  10.105.0.1 (10.105.0.1)            4.427 ms  4.738 ms  4.877 ms
 4  111.0.94.77 (111.0.94.77)          4.593 ms  4.988 ms  5.064 ms
 5  183.248.154.69 (183.248.154.69)    9.011 ms  9.519 ms  9.508 ms
 6  183.248.154.246 (183.248.154.246)  9.904 ms  7.145 ms  7.526 ms
 7  111.0.36.186 (111.0.36.186)        9.717 ms  9.403 ms  9.364 ms
 8  192.168.11.54 (192.168.11.54)      8.532 ms  8.707 ms  9.090 ms
 9  10.120.120.1 (10.120.120.1)        9.075 ms  9.063 ms  9.051 ms
10  111.3.86.235 (111.3.86.235)        9.036 ms  8.130 ms  8.150 ms

4. 总结

  1. 第一层C类地址(192.168.68.1) 我的本地路由器(防火墙)
  2. 第二层C类地址(192.168.1.1) 运营商接入光纤猫
  3. 第三层A类地址(10.105.0.1) 运营商小区光纤路由器
  4. 第四层A类地址(111.0.94.73/77) 猜测运营商内部网络
  5. 第五层
  • 第一次:UDP-B类地址(183.248.154.69、211.138.114.177、183.248.154.61)、ICMP-A类地址(117.148.181.29)
  • 第二次:UDP-A类地址(112.11.232.49、120.199.246.237、117.148.181.13)、ICMP-B类地址(183.248.154.69)
  1. 第六层: 可能存在UDP打洞的情况
  • 第一次:UDP-A类地址(112.11.232.210、120.199.239.98)、ICMP-A类地址(112.15.224.74)
  • 第二次:UDP-A/B类地址(120.199.239.114、112.15.224.54、183.248.154.242)、ICMP-B类地址(183.248.154.246)
  1. 第七层 猜测淘宝服务器关联网外地址(CDN节点或者什么的)
  • 第一次:UDP-A类地址(111.0.36.182、111.3.81.238、111.0.36.154)、ICMP-A类地址(111.0.36.154)
  • 第二次:UDP-A类地址(111.0.36.154、111.0.36.178、111.0.36.174)、ICMP-A类地址(111.0.36.186)
  1. 第八层C类地址(192.168.11.10/54) // 内部网络IP
  2. 第九层A类地址(10.120.120.6/1) // 内部网络IP
  3. 第十层A类地址(111.3.86.234/235)

5. 补充 github.com访问

分析:2022-11-02【异常】 vs 2022-11-09 【正常】数据,【浙江省杭州市 移动】切换了【浙江省舟山市 移动】,一切就正常了。

github20221102

5.1 2022-11-02【异常】

当前github.com的IP地址查询,从traceroute的角度

  1. ICMP确实出去了
  2. 使用随机的任何大于 32768 的端口地址作为目标设备的接受报文端口也出去了
  3. 使用TCP 443(https)目标端口到达了github服务器
  4. 使用UDP443(https)目标端口到达了美国节点服务器

所以,到底是哪里的问题???国内屏蔽?加拿大那边阻挡了?还是美国那边阻挡了??

注:前端时间实际上我们访问GitHub是正常的,国家并没有在工程技术这块搞得这么严格。可是最近发现持续一周都无法访问了。

5.1.1 ICMP 跟踪

$ traceroute -I www.github.com
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  [光猫路由器]192.168.1.1 (192.168.1.1)  0.830 ms  0.610 ms  0.711 ms
 2  [移动局域网 IP]10.105.0.1 (10.105.0.1)  3.230 ms  3.645 ms  3.682 ms
 3  [浙江省杭州市 移动]111.0.94.85 (111.0.94.85)  3.520 ms  3.555 ms  3.913 ms
 4  [浙江省杭州市 移动]211.138.119.153 (211.138.119.153)  5.189 ms *  5.665 ms
 5  * * *
 6  * * *
 7  [中国 移动]111.24.10.169 (111.24.10.169)  5.364 ms  5.369 ms  5.599 ms
 8  [海南省海口市 移动]221.183.111.214 (221.183.111.214)  32.629 ms  32.560 ms  32.743 ms
 9  [中国 移动]111.24.5.178 (111.24.5.178)  116.905 ms  31.698 ms  31.923 ms
10  * * *
11  [广东省广州市 中国移动骨干网广东省节点(AS9808)]221.183.25.117 (221.183.25.117)  32.122 ms  32.336 ms 221.183.25.121 (221.183.25.121)  32.666 ms
12  [广东省广州市 中国移动骨干网广东省节点(AS9808)]221.183.55.81 (221.183.55.81)  36.046 ms  36.011 ms  35.767 ms
13  * * *
14  [香港 中国移动国际有限公司]223.118.5.202 (223.118.5.202)  71.853 ms  71.794 ms  70.987 ms
15  [香港 中国移动国际有限公司]223.119.81.118 (223.119.81.118)  75.071 ms  75.178 ms  74.998 ms
16  [加拿大 Bell]64.230.44.104.in-addr.arpa (104.44.230.64)  75.493 ms  75.548 ms  75.482 ms
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

5.1.2 UDP 跟踪(>32768)

$ traceroute www.github.com
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  [光猫路由器]192.168.1.1 (192.168.1.1)  0.848 ms  0.615 ms  0.703 ms
 2  [移动局域网 IP]10.105.0.1 (10.105.0.1)  3.528 ms  3.573 ms  3.857 ms
 3  [浙江省杭州市 移动]111.0.94.85 (111.0.94.85)  3.294 ms  3.546 ms  3.592 ms
 4  [浙江省 移动数据上网公共出口]117.148.181.13 (117.148.181.13)  4.311 ms 112.11.232.49 (112.11.232.49)  4.512 ms 117.148.181.1 (117.148.181.1)  9.321 ms
 5  [浙江省杭州市 移动]211.140.0.98 (211.140.0.98)  4.433 ms *  4.322 ms
 6  [浙江省杭州市 移动]211.140.0.97 (211.140.0.97)  4.166 ms  4.621 ms  4.800 ms
 7  [中国 移动]111.24.10.169 (111.24.10.169)  5.580 ms  4.718 ms  4.432 ms
 8  [中国 移动]111.24.5.105 (111.24.5.105)  30.792 ms  30.921 ms [海南省海口市 移动]221.183.111.214 (221.183.111.214)  31.186 ms
 9  [中国 移动]111.24.5.178 (111.24.5.178)  30.604 ms 111.24.5.174 (111.24.5.174)  30.874 ms 111.24.5.182 (111.24.5.182)  32.266 ms
10  [广东省广州市 中国移动骨干网广东省节点(AS9808)]221.176.22.158 (221.176.22.158)  33.008 ms  33.529 ms [海南省海口市 移动]221.183.68.145 (221.183.68.145)  35.493 ms
11  * * *
12  [广东省广州市 中国移动骨干网广东省节点(AS9808)]221.183.55.81 (221.183.55.81)  36.245 ms [海南省海口市 移动]221.183.68.126 (221.183.68.126)  34.653 ms [海南省海口市 移动]221.183.68.130 (221.183.68.130)  44.125 ms
13  [中国 移动-香港]223.120.2.9 (223.120.2.9)  35.518 ms 223.120.2.5 (223.120.2.5)  36.991 ms  36.979 ms
14  [中国 移动-香港]223.120.2.46 (223.120.2.46)  72.513 ms  72.378 ms 223.120.2.106 (223.120.2.106)  73.557 ms
15  [香港 中国移动国际有限公司]223.119.81.118 (223.119.81.118)  75.666 ms  73.561 ms 223.119.81.114 (223.119.81.114)  73.137 ms
16  [美国 Microsoft公司]ae24-0.icr01.sg2.ntwk.msn.net (104.44.40.102)  87.966 ms  87.604 ms ae23-0.icr02.sg2.ntwk.msn.net (104.44.230.64)  100.965 ms
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

5.1.3 TCP 跟踪(443)

$ sudo traceroute www.github.com -T -p 443
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  [光猫路由器]192.168.1.1 (192.168.1.1)  0.750 ms  0.734 ms  0.455 ms
 2  [移动局域网 IP]10.105.0.1 (10.105.0.1)  2.771 ms  3.331 ms  3.529 ms
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  [美国 Microsoft数据中心]20.205.243.166 (20.205.243.166)  70.031 ms  72.180 ms *

5.1.4 UDP 跟踪(443)

$ sudo traceroute www.github.com -U -p 443
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  [光猫路由器]192.168.1.1 (192.168.1.1)  0.732 ms  0.687 ms  0.533 ms
 2  [移动局域网 IP]10.105.0.1 (10.105.0.1)  3.248 ms  3.751 ms  3.600 ms
 3  [浙江省杭州市 移动]111.0.94.85 (111.0.94.85)  3.471 ms * *
 4  [浙江省杭州市 移动]* * 211.138.119.153 (211.138.119.153)  4.618 ms
 5  [浙江省杭州市 移动]211.140.0.98 (211.140.0.98)  3.997 ms  3.841 ms  4.150 ms
 6  [浙江省杭州市 移动]211.140.0.97 (211.140.0.97)  4.685 ms * *
 7  [中国 移动]111.24.10.169 (111.24.10.169)  5.379 ms  5.804 ms  7.281 ms
 8  [中国 移动]111.24.5.105 (111.24.5.105)  40.892 ms 221.183.111.214 (221.183.111.214)  32.394 ms  32.621 ms
 9  [中国 移动]111.24.5.186 (111.24.5.186)  32.822 ms 111.24.5.170 (111.24.5.170)  31.929 ms 111.24.5.190 (111.24.5.190)  33.622 ms
10  [海南省海口市 移动]221.183.68.145 (221.183.68.145)  35.285 ms 221.176.24.6 (221.176.24.6)  32.685 ms  32.036 ms
11  [广东省广州市 中国移动骨干网广东省节点(AS9808)]221.183.25.117 (221.183.25.117)  32.315 ms  43.334 ms  42.833 ms
12  [广东省广州市 中国移动骨干网广东省节点(AS9808)]221.183.55.57 (221.183.55.57)  36.822 ms  36.671 ms  36.861 ms
13  * * *
14  [中国 移动]223.120.2.46 (223.120.2.46)  73.975 ms 223.120.2.18 (223.120.2.18)  76.448 ms 223.118.5.202 (223.118.5.202)  71.598 ms
15  [香港 中国移动国际有限公司]223.119.81.114 (223.119.81.114)  77.932 ms 223.119.81.118 (223.119.81.118)  85.611 ms 223.119.81.114 (223.119.81.114)  76.867 ms
16  [美国 Microsoft公司]ae23-0.icr01.sg3.ntwk.msn.net (104.44.230.62)  77.216 ms ae23-0.icr02.sg2.ntwk.msn.net (104.44.230.64)  80.455 ms ae24-0.icr01.sg2.ntwk.msn.net (104.44.40.102)  105.147 ms
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

5.2 2022-11-09 【正常】

5.2.1 ICMP 跟踪

$ traceroute -I www.github.com
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  192.168.1.1 (192.168.1.1)  0.835 ms  0.700 ms  0.836 ms
 2  10.105.0.1 (10.105.0.1)  4.024 ms  4.583 ms  4.523 ms
 3  【浙江省舟山市 移动】120.199.253.193 (120.199.253.193)  4.219 ms  4.212 ms  4.319 ms
 4  【浙江省 移动数据上网公共出口】112.17.216.186 (112.17.216.186)  4.288 ms  4.196 ms  4.351 ms
 5  * * *
 6  【浙江省 移动】211.138.128.34 (211.138.128.34)  6.253 ms  6.712 ms  6.783 ms
 7  【中国 移动】111.24.10.109 (111.24.10.109)  5.555 ms  5.903 ms  5.829 ms
 8  【海南省海口市 移动】221.176.15.129 (221.176.15.129)  36.742 ms  36.623 ms  36.541 ms
 9  【中国 移动】111.24.14.146 (111.24.14.146)  32.885 ms  32.809 ms  32.738 ms
10  【海南省海口市 移动】221.183.68.141 (221.183.68.141)  33.212 ms  33.140 ms  32.907 ms
11  【广东省广州市 中国移动骨干网广东省节点(AS9808)】221.183.25.117 (221.183.25.117)  34.137 ms  34.069 ms  33.999 ms
12  【广东省广州市 中国移动骨干网广东省节点(AS9808)】221.183.55.81 (221.183.55.81)  40.905 ms  40.812 ms  40.712 ms
13  * * *
14  【香港 中国移动国际有限公司】223.118.5.202 (223.118.5.202)  77.339 ms  77.041 ms  77.264 ms
15  【香港 中国移动国际有限公司】223.119.81.118 (223.119.81.118)  76.934 ms  76.868 ms  76.802 ms
16  【美国 Microsoft公司】ae23-0.icr02.sg2.ntwk.msn.net (104.44.230.64)  75.750 ms  82.024 ms  81.859 ms
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

5.2.2 UDP 跟踪(>32768)

$ traceroute www.github.com
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  192.168.1.1 (192.168.1.1)  0.721 ms  0.532 ms  0.555 ms
 2  10.105.0.1 (10.105.0.1)  3.431 ms  4.709 ms  4.634 ms
 3  【浙江省舟山市 移动】120.199.253.193 (120.199.253.193)  4.563 ms  4.602 ms  4.531 ms
 4  【浙江省 移动数据上网公共出口】112.17.216.186 (112.17.216.186)  4.325 ms  4.120 ms  4.187 ms
 5  * * *
 6  * * *
 7  【中国 移动】111.24.10.109 (111.24.10.109)  6.938 ms  5.032 ms  5.226 ms
 8  【中国 移动】111.24.4.169 (111.24.4.169)  30.209 ms  29.638 ms 221.176.15.129 (221.176.15.129)  31.416 ms
 9  【111.24.4.254】111.24.4.254 (111.24.4.254)  32.122 ms 111.24.5.2 (111.24.5.2)  33.118 ms  30.947 ms
10  【广东省广州市 中国移动骨干网广东省节点(AS9808)】221.176.22.106 (221.176.22.106)  33.222 ms 221.183.68.137 (221.183.68.137)  32.251 ms  30.532 ms
11  【广东省广州市 中国移动骨干网广东省节点(AS9808)】221.183.25.121 (221.183.25.121)  33.309 ms 221.183.52.86 (221.183.52.86)  37.865 ms 221.183.25.117 (221.183.25.117)  33.630 ms
12  【海南省海口市 移动】221.183.68.126 (221.183.68.126)  40.347 ms 221.183.68.130 (221.183.68.130)  41.030 ms  38.730 ms
13  【中国 移动】223.120.2.9 (223.120.2.9)  41.622 ms 223.120.2.77 (223.120.2.77)  41.783 ms 223.120.2.85 (223.120.2.85)  39.548 ms
14  【中国 移动】223.120.2.18 (223.120.2.18)  69.796 ms  71.090 ms 223.120.2.106 (223.120.2.106)  75.670 ms
15  【香港 中国移动国际有限公司】223.119.81.118 (223.119.81.118)  84.485 ms 223.119.81.114 (223.119.81.114)  76.686 ms  93.149 ms
16  【美国 Microsoft公司】ae23-0.icr01.sg3.ntwk.msn.net (104.44.230.62)  80.617 ms ae24-0.icr01.sg2.ntwk.msn.net (104.44.40.102)  71.989 ms  71.167 ms
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

5.2.3 TCP 跟踪(443)

$ sudo traceroute www.github.com -T -p 443
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  192.168.1.1 (192.168.1.1)  0.695 ms  0.648 ms  0.640 ms
 2  10.105.0.1 (10.105.0.1)  8.217 ms  8.123 ms  8.048 ms
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * 20.205.243.166 (20.205.243.166)  72.508 ms *

5.2.4 UDP 跟踪(443)

$ sudo traceroute www.github.com -U -p 443
traceroute to www.github.com (20.205.243.166), 30 hops max, 60 byte packets
 1  192.168.1.1 (192.168.1.1)  0.858 ms  0.767 ms  0.845 ms
 2  10.105.0.1 (10.105.0.1)  4.328 ms  4.760 ms  4.612 ms
 3  【浙江省舟山市 移动】120.199.253.193 (120.199.253.193)  4.693 ms  4.744 ms  4.617 ms
 4  【浙江省 移动数据上网公共出口】112.17.216.186 (112.17.216.186)  4.010 ms  4.091 ms  3.929 ms
 5  * * *
 6  【浙江省 移动】211.138.128.34 (211.138.128.34)  5.139 ms  6.804 ms  6.265 ms
 7  【中国 移动】111.24.10.109 (111.24.10.109)  4.978 ms  5.014 ms  4.691 ms
 8  【海南省海口市 移动】221.176.15.129 (221.176.15.129)  32.089 ms  31.522 ms 221.183.109.229 (221.183.109.229)  33.549 ms
 9  【中国 移动】111.24.4.234 (111.24.4.234)  30.418 ms 111.24.4.246 (111.24.4.246)  31.371 ms  32.094 ms
10  【广东省广州市 中国移动骨干网广东省节点(AS9808)】221.176.22.106 (221.176.22.106)  35.028 ms  31.783 ms 221.183.68.137 (221.183.68.137)  31.572 ms
11  【广东省广州市 中国移动骨干网广东省节点(AS9808)】221.183.52.86 (221.183.52.86)  36.022 ms  36.334 ms  36.100 ms
12  【海南省海口市 移动】221.183.68.130 (221.183.68.130)  39.055 ms  39.820 ms 221.183.55.57 (221.183.55.57)  38.293 ms
13  * * *
14  【中国 移动】223.120.2.106 (223.120.2.106)  74.334 ms 223.120.2.46 (223.120.2.46)  71.420 ms  71.433 ms
15  【香港 中国移动国际有限公司】223.119.81.118 (223.119.81.118)  84.277 ms  84.195 ms 223.119.81.114 (223.119.81.114)  84.921 ms
16  【美国 Microsoft公司】ae27-0.icr02.sg3.ntwk.msn.net (104.44.230.66)  77.769 ms 102.40.44.104.in-addr.arpa (104.44.40.102)  69.891 ms ae23-0.icr02.sg2.ntwk.msn.net (104.44.230.64)  77.660 ms
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

6. 参考资料

【1】IP归属地查询

  • 6
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ping命令大全 各种cmd命令 Ping是典型的网络工具。Ping能够辨别网络功能的某些状态。这些网络功能的状态是日常网络故障诊断的基础。特别是Ping能够识别连接的二进制状态(也就是是否连通)。但是,这只是能够告知你的网络运行状况的众多行为分析中一个最简单的例子。 假设网络是一个黑匣子,对此你事先一无所知。通过适当地刺激网络分析网络的反应,正确地应用网络行为分析模型确定这个黑匣子的内部状态。这就使网络工程师和用户不必专门访问网络的组成设备(也就是接口、交换机和路由器)就可以了解一个网络通道。 向网络发送数据包。用网络的正常状态和网络标准作为分析模型。接下来,把可能的网络反应同已知的状态联系起来,就可以识别网络的内部状态,如连通性。 在使用Ping的情况下,这只能使简单的事情更加复杂。向一个IP地址发送一个ICMP Echo数据包,可以得到ICMP(互联网信报控制协议)应答,你就可以确定在网络路径上存在连接。这很简单,但是功能却非常强大,因为它可以指出更有趣的可能性。 当然,网络从来不是理想的。网络对刺激的反应是随时间变化的。一般来说,Ping要重复这个过程不只一次,然后进行统计评估。按照这种做法,Ping大体上可以确定往返时间(RTT)的统计变化以及丢包率(往返时间为无穷大)。根据这个额外的信息,可以稍微多的了解到网络通道中的一些信息,但是了解的并不多。 Traceroute是采用这种方法的另一个工具。利用与中间路径第三层设备有关的已知的行为和IP报头的生存时间(TTL)域,Traceroute能够确定主机与某些目标主机之间的第三层的设备的排列顺序。要完成这个任务,Traceroute不是发送一个数据包,而是发送一系列具有TTL特殊设置的数据包,从1逐步增加到255个,直到达到预定的目标。Traceroute然后能够识别以ICMP TTL到其信息应答的每个第三层接口的IP地址。 Traceroute因此可以提供一个功能,了解两个主机之间IP路由的状态。显然,这样的状态很多,比简单的二进制的连接状态要复杂。 Traceroute需要大量增加网络路径的样本来完成这个任务。
实验四 ICMP 协议和IP 数据报分片分析 【实验目的】 1. 理解 ICMP 协议报文类型和格式; 2. 理解 ping 命令的工作原理; 3. 理解 traceroute 的工作原理; 4. 理解 IP 协议报文类型和格式。 【实验环境】 与因特网连接的计算机,操作系统为Windows,安装有Wireshark、IE 等软件。 【实验内容】 1. 使用 wireshark 抓包软件分析ICMP 协议报文的类型; 2. 分析 ping 命令的工作原理; 3. 分析 tracert 命令的工作原理; 4. 使用 wireshark 抓包软件分析IP 协议报文以及报文分片。 【实验步骤】 1. 分析 ICMP 协议 步骤1:在 PC1 运行 Wireshark,开始截获报文,为了只截获和实验内容有关的报文,将 Wireshark 的 Captrue Filter 设置为"No Broadcast and no Multicast"; 步骤2:在 PC1 以 www.baidu.com 为目标主机,在命令行窗口执行 Ping 命令,要求ping 通8 次; 【答】:Ping 命令为:____ ping –n 8 www.baidu.com ____ 将命令行窗口进行截图: 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第1页。【答】: 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第1页。 步骤3:停止截获报文,分析截获的结果,回答下列问题: (1)将抓包结果进行截图(要求只显示 ping 的数据包): (2)截获的 ICMP 报文有几种类型?分别是: 【答】:两种:8(Echo(ping) request) 、 0(Echo (ping) reply ) (3)分析截获的 ICMP 报文,按下表要求,将各字段信息填入表中,要求填写前4 个报文的信息。 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第2页。【答】: 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第2页。 报文号 源IP 目的IP 报文格式 类型 代码 标识 序列号 BE LE BE LE 15 192.168.6.57 119.75.217.56 Echo(ping) request 8 512 2 3328 13 16 119.75.217.56 192.168.6.57 Echo(ping) reply 0 512 2 3328 13 17 192.168.6.57 119.75.217.56 Echo(ping) request 8 512 2 3584 14 18 119.75.217.56 192.168.6.57 Echo(ping) reply 0 512 2 3584 14 (4)查看ping 请求信息,ICMP 的type是 ___Echo(ping) request___。和code是 __8__。并截图。 (5)查看相应得ICMP 响应信息,ICMP 的type 是___Echo(ping) reply___和code 是 __0__。并截图。 (6)若要只显示ICMP的echo响应数据包,显示过滤器的规则为__icmp.type == 0___.并根据过滤规则进行抓包截图。 7) 若要只显示ICMP的echo请求数据包,显示过滤器的规则为___icmp.type == 8___. 并根据过滤规则进行抓包截图。 2. 分析traceroute 的工作原理 步骤1:在 PC1 上运行 Wireshark 开始截获报文; 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第3页。步骤2:在PC1上执行Tracert命令,如:tracert www.baidu.com;将命令窗口进行截图; 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第3页。 步骤3:在wireshark里设置显示过滤器为icmp; 步骤4:停止截获报文,分析截获的报文,回答下列问题: (1)截获了报文中哪几种 ICMP 报文?其类型码和代码各为多少? 【答】: ICMP 报文 类型码 代码 Echo request 0 0 Echo reply 8 0 Time-to-live exceeded 11 0 (2)在截获的报文中,哪些是超时报告报文,请截图显示所有超时报文并指出超时报告报文的源地址分别是多少? 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第4页。 实验四-ICMP数据报和IP数据报分片分析实验报告全文共8页,当前为第4页。 【答】:超时报告报文的源地址:192.168.6.254 、172.31.1.1 、 2
traceroute是一个用于追踪网络数据包从源地址到目的地址经过的路由路径的命令行工具,它可以用于诊断网络故障,以及分析网络性能问题。下面是traceroute命令的详解: 使用方式: ``` traceroute [-dFITnNqrsSvwx] [-f first_ttl] [-m max_ttl] [-p port] [-t tos] [-w waittime] [-A as_server] [-g gateway] [-i interface] [-z pausemsecs] host [packetlen] ``` 常用参数: - -d: 使用socket的SO_DEBUG选项,开启调试功能。 - -F: 不分段,即使数据包太长,也不分段。 - -I: 使用ICMP的ECHO请求,而不是使用UDP数据包。 - -n: 直接使用IP地址,而不是使用DNS进行域名解析。 - -N: 设置要显示的列数,可以指定列数。 - -q: 指定发送数据包的数量。 - -r: 不进行域名解析。 - -s: 指定发送数据包的大小。 - -S: 启用TCP SYN带外数据包,即“TCP ping”模式。 - -v: 显示详细的调试信息。 - -w: 指定等待响应的时间。 - -x: 在显示的数据包中,显示源IP地址和端口号。 - -A: 指定AS服务器的IP地址。 - -f: 设置第一个TTL值。 - -g: 设置网关地址。 - -i: 指定使用的网络接口。 - -m: 设置最大的TTL值。 - -p: 指定使用的端口号。 - -t: 指定服务类型(TOS)。 - -z: 指定发送数据包之间的时间间隔。 使用示例: ``` traceroute www.google.com ``` 这个命令会显示从本机到www.google.com的路由路径,以及每一跳的延迟时间。 总体来说,traceroute是一个非常有用的网络诊断工具,可以帮助我们快速定位网络故障,并进行相应的调整和维护。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值