blog icon indicating copy to clipboard operation
blog copied to clipboard

mtr 网络诊断工具

Open qingquan-li opened this issue 3 years ago • 0 comments

常用的 ping,tracert,nslookup 一般用来判断主机的网络连通性,其实 Linux 下有一个更好用的网络联通性判断工具,它可以结合ping nslookup tracert 来判断网络的相关特性,这个命令就是 mtr。mtr 全称 my traceroute,是一个把 ping 和 traceroute 合并到一个程序的网络诊断工具。

traceroute默认使用UDP数据包探测,而mtr默认使用ICMP报文探测,ICMP在某些路由节点的优先级要比其他数据包低,所以测试得到的数据可能低于实际情况。

参考:


一、Ubuntu 安装和使用 mtr

1⃣️ 安装 mtr:

$ sudo apt update
$ sudo apt install mtr

2⃣️ 使用 mrt:

$ mrt + ip/domain

二、mtr google.com 效果图(macOS系统)

mtr-google-com

输出参数解释:

  1. Host IP地址
  2. Loss 丢包率
  3. Snt 已发送的包数
  4. Last 最后一个包的延时
  5. Avg 平均延时
  6. Best 最低延时
  7. Wrst 最差延时
  8. StDev 方差(稳定性)

三、macOS 配置 mtr

mtr-macos-zsh

1⃣️ $ vim .zshrc

export PATH="/usr/local/sbin/:${PATH}"

2⃣️ $ source .zshrc # 使配置生效

qingquan-li avatar Apr 17 '21 18:04 qingquan-li