🗂 | 查看 Linux 专题可浏览更多内容
BestTrace 是由 IPIP.net 出品的可视化网络路由追踪工具。
下载
$ wget https://cdn.ipip.net/17mon/besttrace4linux.zip
安装
先来看一下压缩包内容:
$ unzip -l besttrace4linux.zip
Length Date Time Name
--------- ---------- ----- ----
8980324 2021-03-25 10:48 besttrace
1181 2021-03-28 23:59 besttrace4linux.txt
7892485 2021-03-25 10:48 besttrace32
8931152 2021-03-25 10:48 besttracebsd
7852302 2021-03-25 10:48 besttracebsd32
8765024 2021-03-25 10:48 besttracemac
7838934 2021-03-25 10:48 besttracearm
--------- -------
50261402 7 files
通过命令 uname -a
得知我的 VPS 是 x86_64
,所以压缩包内我需要的文件其实就是第一个 besttrace
。
第二个
.txt
是说明文件,besttrace32
适用于x86
,接着是适用于 BSD 及 macOS 平台的,最后一个是适用于 ARM 架构的 Linux。
那么只要将 besttrace
放入 /usr/local/bin
即可:
$ sudo unzip besttrace4linux.zip besttrace -d /usr/local/bin/
然后赋予运行权限:
$ sudo chmod +x /usr/local/bin/besttrace
使用
$ besttrace
Usage of besttrace host [packetlen]
-6, --ipv6 Use ipv6.
-J, --json Print traceroute result with JSON format, Enterprise version only.
-g, --lang string Language only supported cn and en now.
-m, --maxhop int Specifies the maximum number of hops (max time-to-live value) traceroute will probe. The default is 30. (default 30)
-a, --noas Do not try to map IP addresses to AS when displaying them.
-n, --nodomain Do not try to map IP addresses to host names when displaying them.
-l, --nolocation Do not try to map IP addresses to location when displaying them.
-q, --queries int Sets the number of probe packets per hop. The default is 3. (default 3)
-z, --sendtime int 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).
Useful when some routers use rate-limit for ICMP messages.
-f, --starthop int Specifies with what TTL to start. Defaults to 1. (default 1)
--sync Send icmp package by sync.
-T, --tcp Use TCP SYN for probes.
-V, --version Print the version and exit.
-w, --waittime int Set the time (in seconds) to wait for a response to a probe. (default 3)
以路由跟踪 1.1.1.1
为例:
$ sudo besttrace -g cn 1.1.1.1
1 216.24.255.1 9.65 ms AS35916 美国, 加利福尼亚州, 洛杉矶, multacom.com
216.24.255.1 2.52 ms AS35916 美国, 加利福尼亚州, 洛杉矶, multacom.com
216.24.255.1 0.98 ms AS35916 美国, 加利福尼亚州, 洛杉矶, multacom.com
2 1.162.45.96-dedicated.multacom.com (96.45.162.1) 2.62 ms AS35916 美国, 加利福尼亚州, 洛杉矶, multacom.com
1.162.45.96-dedicated.multacom.com (96.45.162.1) 5.89 ms AS35916 美国, 加利福尼亚州, 洛杉矶, multacom.com
1.162.45.96-dedicated.multacom.com (96.45.162.1) 15.09 ms AS35916 美国, 加利福尼亚州, 洛杉矶, multacom.com
3 be5361.ccr42.lax01.atlas.cogentco.com (38.99.219.57) 1.90 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
be5361.ccr42.lax01.atlas.cogentco.com (38.99.219.57) 6.01 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
be5361.ccr42.lax01.atlas.cogentco.com (38.99.219.57) 15.48 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
4 be3360.ccr41.lax04.atlas.cogentco.com (154.54.25.150) 3.55 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
be3360.ccr41.lax04.atlas.cogentco.com (154.54.25.150) 1.24 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
be3360.ccr41.lax04.atlas.cogentco.com (154.54.25.150) 1.39 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
5 38.104.83.170 4.87 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
38.104.83.170 3.32 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
38.104.83.170 4.86 ms AS174 美国, 加利福尼亚州, 洛杉矶, cogentco.com
6 172.70.204.4 4.85 ms AS13335 美国, 加利福尼亚州, 洛杉矶, cloudflare.com
172.70.204.4 3.28 ms AS13335 美国, 加利福尼亚州, 洛杉矶, cloudflare.com
172.70.204.4 1.86 ms AS13335 美国, 加利福尼亚州, 洛杉矶, cloudflare.com
7 one.one.one.one (1.1.1.1) 1.34 ms AS13335 CLOUDFLARE.COM, apnic.net
one.one.one.one (1.1.1.1) 3.73 ms AS13335 CLOUDFLARE.COM, apnic.net
one.one.one.one (1.1.1.1) 2.36 ms AS13335 CLOUDFLARE.COM, apnic.net
-g
选项表示指定输出语言,如果你的默认输出是英文但想要显示中文,就可以使用该参数:-g cn
。