Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create mtr.md #540

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions command/mtr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
mtr
===

hululu1068 marked this conversation as resolved.
Show resolved Hide resolved
`mtr`结合了`traceroute`和`ping`程序的功能,是一款简单的网络诊断工具。
用于调查 mtr 运行的主机与用户指定的目标主机之间的网络连接。在确定机器之间每个网络跳转的地址后,它会向每台机器发送一系列 ICMP ECHO 请求,以确定与每台机器的链路质量。在此过程中,它会打印每台机器的运行统计数据。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hululu1068 这里必须一句话介绍,用于搜索索引,其它内容放到补充说明中。 thx!


## 补充说明

Debian发行版已经内置了`mtr`,其它发行版可自行安装,支持主流操作系统。
可以访问其[官网](https://www.bitwizard.nl/mtr)详细了解。

### 语法

```shell
mtr (参数) (目标ip/域名)
```

### 参数
| 参数 | 解释
---- | ----
-r | 以报告模式显示
-c | 发送数据包大小
-n | 不用主机名解释
-s | 指定ping数据包的大小
--report | 不动态显示结果

### 实例

```shell
使用 -r 参数显示报告:
[root@localhost ~]# mtr -r github.com

HOST: WIKIHOST Loss% Snt Last Avg Best Wrst StDev
1.|-- 161.129.42.1 0.0% 10 0.5 0.5 0.4 0.6 0.1
2.|-- 10.12.52.0 0.0% 10 0.9 1.2 0.8 3.4 0.8
3.|-- unn-138-199-1-182.cdn77.c 0.0% 10 0.9 0.8 0.8 0.9 0.1
4.|-- 63.217.254.209 70.0% 10 1.3 1.3 1.2 1.3 0.0
5.|-- 63-216-176-146.static.pcc 0.0% 10 4.1 3.6 1.1 12.9 3.5
6.|-- ae27-0.icr02.hkg20.ntwk.m 0.0% 10 2.8 5.5 1.7 24.0 6.9
7.|-- be-102-0.ibr01.hkg20.ntwk 20.0% 10 36.4 36.5 36.3 36.7 0.1
8.|-- be-10-0.ibr01.sg3.ntwk.ms 50.0% 10 36.4 37.3 36.3 39.5 1.4
9.|-- ae100-0.icr01.sg3.ntwk.ms 0.0% 10 35.9 38.8 35.9 53.3 5.4
10.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
11.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
12.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
13.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
14.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
15.|-- 20.205.243.166 0.0% 10 35.7 35.8 35.7 35.9 0.0

使用-c参数设置每秒发送数据包数量:
[root@localhost ~]# mtr -r -c 30 github.com

HOST: WIKIHOST Loss% Snt Last Avg Best Wrst StDev
1.|-- 161.129.42.1 0.0% 30 0.5 0.4 0.3 1.2 0.2
2.|-- 10.12.52.0 0.0% 30 0.8 1.2 0.8 9.2 1.6
3.|-- unn-138-199-1-182.cdn77.c 0.0% 30 0.9 0.9 0.8 3.0 0.4
4.|-- 63.217.254.209 40.0% 30 1.3 1.3 1.1 2.4 0.3
5.|-- 63-216-176-146.static.pcc 0.0% 30 3.0 3.1 1.0 13.5 3.4
6.|-- ae27-0.icr02.hkg20.ntwk.m 0.0% 30 1.7 2.2 1.6 5.7 0.9
7.|-- be-102-0.ibr01.hkg20.ntwk 6.7% 30 36.4 36.6 36.3 38.9 0.5
8.|-- be-10-0.ibr01.sg3.ntwk.ms 50.0% 30 36.7 47.1 36.2 102.7 21.0
9.|-- ae100-0.icr01.sg3.ntwk.ms 0.0% 30 36.1 41.4 35.9 78.4 8.8
10.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0
11.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0
12.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0
13.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0
14.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0
15.|-- 20.205.243.166 0.0% 30 35.7 35.8 35.6 35.8 0.0

使用-s参数指定ping数据包的大小:
[root@localhost ~]# mtr -r -c 30 -s 1024 github.com

HOST: WIKIHOST Loss% Snt Last Avg Best Wrst StDev
1.|-- 161.129.42.1 0.0% 30 0.6 0.6 0.3 4.3 0.7
2.|-- 10.12.52.0 0.0% 30 1.0 1.1 0.8 7.0 1.1
3.|-- unn-138-199-1-182.cdn77.c 0.0% 30 0.9 0.9 0.8 1.1 0.1
4.|-- 63.217.254.209 66.7% 30 1.3 1.3 1.2 1.5 0.1
5.|-- 63-216-176-146.static.pcc 0.0% 30 3.1 3.3 1.0 18.4 4.5
6.|-- ae27-0.icr02.hkg20.ntwk.m 0.0% 30 2.2 3.7 1.7 12.2 2.5
7.|-- be-102-0.ibr01.hkg20.ntwk 6.7% 30 36.5 36.6 36.4 38.9 0.5
8.|-- be-10-0.ibr01.sg3.ntwk.ms 33.3% 30 38.3 36.9 36.3 39.1 0.7
9.|-- ae100-0.icr01.sg3.ntwk.ms 0.0% 30 36.1 38.4 35.9 66.6 5.9
10.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0

```