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 1 commit
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
84 changes: 84 additions & 0 deletions command/mtr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
mtr
===

hululu1068 marked this conversation as resolved.
Show resolved Hide resolved
`mtr`在单个网络诊断工具中结合了`traceroute`和`ping`程序的功能。当`mtr`启动时,它调查运行在主机mtr和主机名之间的网络连接。

通过发送有目的的低TTL的包,以较低的TTL发送数据包,记录中间路由器。
这允许MTR打印Internet路由的响应百分比和响应时间。
到主机,包丢失或响应时间的突然增加通常是不好的(或仅仅是过度的)迹象。
已加载、链接、结果通常以往返响应时间(毫秒)和包丢失百分比报告。

### 语法

```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

```