0
Linux mtr 命令详解
ㄒiger / Posted in 程序代码 / January 9, 2012
一般在windows 来判断网络连通性用ping 和tracert,ping的话可以来判断丢包率,tracert可以用来跟踪路由,在Linux中有一个更好的网络连通性判断工具,它可以结合ping nslookup tracert 来判断网络的相关特性,这个命令就是mtr
centos下面如果没安装就先 yum install mtr
[root@dns ~]# mtr -h-bash: mtr: command not found[root@dns ~]#[root@dns ~]# yum install mtrLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.usc.edu* extras: mirrors.easynews.com* updates: mirrors.easynews.combase | 1.1 kB 00:00extras | 2.1 kB 00:00updates | 1.9 kB 00:00updates/primary_db | 433 kB 00:00vz-base | 951 B 00:00vz-updates | 951 B 00:00Excluding Packages inglobalexclude listFinishedSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package mtr.i386 2:0.71-3.1 set to be updated--> Finished Dependency ResolutionDependencies Resolved================================================================================Package Arch Version Repository Size================================================================================Installing:mtr i386 2:0.71-3.1 base 50 kTransaction Summary================================================================================Install 1 Package(s)Upgrade 0 Package(s)Total download size: 50 kIs this ok [y/N]: yDownloading Packages:mtr-0.71-3.1.i386.rpm | 50 kB 00:00Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning TransactionInstalling : mtr 1/1Installed:mtr.i386 2:0.71-3.1Complete!mtr -h提供帮助命令mtr -v显示mtr的版本信息mtr -r已报告模式显示[root@dns ~]# mtr -r 8.8.8.8dns.tiger.im Snt: 10 Loss% Last Avg Best Wrst StDev173.232.0.14 0.0% 0.1 0.1 0.1 0.1 0.0phx1.200-1.5.bb2.po11.gi3-1-9.eonixco.v4.inf 0.0% 0.3 1.0 0.3 3.7 1.4gige-g1-6.core1.phx2.he.net 0.0% 0.6 0.6 0.4 1.1 0.210gigabitethernet1-4.core1.phx1.he.net 0.0% 6.7 3.1 0.8 9.5 2.910gigabitethernet2-2.core1.lax1.he.net 0.0% 12.1 13.7 11.1 20.9 3.0core1-0-1-0.lax.net.google.com 0.0% 27.8 16.9 11.2 45.0 11.172.14.234.47 0.0% 12.0 21.0 11.5 101.3 28.264.233.174.190 0.0% 14.0 20.1 11.5 41.2 12.672.14.239.162 0.0% 40.5 41.6 40.4 47.0 1.9216.239.48.165 10.0% 41.0 41.2 40.2 43.6 1.172.14.232.2 80.0% 53.8 50.2 46.7 53.8 5.0google-public-dns-a.google.com 0.0% 40.5 40.9 40.3 42.0 0.6第一列:显示的是IP地址和本机域名,这点和tracert很像
第二列:snt:10 设置每秒发送数据包的数量,默认值是10 可以通过参数 -c来指定。
[root@dns ~]# mtr -r -c 15 8.8.8.8dns.tiger.im Snt: 15 Loss% Last Avg Best Wrst StDev173.232.0.14 0.0% 0.1 0.1 0.1 0.1 0.0phx1.200-1.5.bb2.po11.gi3-1-9.eonixco.v4.inf 0.0% 4.0 0.9 0.3 4.1 1.3gige-g1-6.core1.phx2.he.net 0.0% 0.9 1.4 0.3 7.7 1.910gigabitethernet1-4.core1.phx1.he.net 0.0% 7.0 3.2 0.8 10.8 3.210gigabitethernet2-2.core1.lax1.he.net 0.0% 11.3 12.4 11.2 18.8 2.2core1-0-1-0.lax.net.google.com 0.0% 12.7 16.6 11.1 57.9 13.372.14.234.47 0.0% 11.7 16.6 11.4 81.0 17.864.233.174.186 0.0% 12.2 29.2 11.5 57.0 16.672.14.239.162 0.0% 41.0 43.2 40.4 57.0 5.1216.239.48.165 0.0% 41.0 42.1 40.2 58.2 4.672.14.232.2 60.0% 49.0 45.1 40.8 50.5 4.0google-public-dns-a.google.com 0.0% 40.4 41.2 40.3 43.9 1.0其中-c的说明是:–report-cycles COUNT
第三列:是显示的每个对应IP的丢包率
第四列:显示的最近一次的返回时延
第五列:是平均值 这个应该是发送ping包的平均时延
第六列:是最好或者说时延最短的
第七列:是最差或者说时延最常的
第八列:是标准偏差
接下来接着说相关参数:
mtr -s用来指定ping数据包的大小
mtr -nno-dns不对IP地址做域名解析
mtr -a来设置发送数据包的IP地址 这个对一个主机由多个IP地址是有用的
mtr -i使用这个参数来设置ICMP返回之间的要求默认是1秒
mtr -4IPv4
mtr -6IPv6 来源:http://blog.51bbo.com/archives/241
其他相关文章....
转载于:https://blog.51cto.com/584250550/1299532