linux查看网络丢包情况 mtr网络连通性判断工具
3.1 先查看硬件情况
一台机器经常收到丢包的报警,先看看最底层的有没有问题:
(1) 查看工作模式是否正常
[root@localhost ~]# ethtool eth0 | egrep 'Speed|Duplex'
Speed: 1000Mb/s
Duplex: Full
(2) 查看检验是否正常
[root@localhost ~]# ethtool -S eth0 | grep crc
rx_crc_errors: 0
Speed,Duplex,CRC 之类的都没问题,基本可以排除物理层面的干扰。
3.2 通过 ifconfig 可以看到 overruns 是否一直增大
for i in `seq 1 100`; do ifconfig eth2 | grep RX | grep overruns; sleep 1; done
这里一直增加
RX packets:346547657 errors:0 dropped:0 overruns:35345 frame:0
3.3 查看buffer大小
可以通过ethtool来修改网卡的buffer size ,首先要网卡支持,我的服务器是是INTEL 的1000M网卡,我们看看ethtool说明
-g –show-ringQueries the specified ethernet device for rx/tx ring parameter information.
-G –set-ringChanges the rx/tx ring parameters of the specified ethernet device.
(1) 查看当前网卡的buffer size情况
ethtool -g eth0
[root@localhost ~]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 256
RX Mini: 0
RX Jumbo: 0
TX: 256
3.4 修改buffer size大小
ethtool -G eth0 rx 2048
ethtool -G eth0 tx 2048
[root@localhost ~]# ethtool -G eth0 rx 2048
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ethtool -G eth0 tx 2048
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 2048
RX Mini: 0
RX Jumbo: 0
TX: 2048
MTR是Linux平台上一款非常好用的网络诊断工具,或者说网络连通性判断工具,集成了ping,traceroute,nslookup的功能,用于诊断网络状态很好用,可以用来判断服务器是否丢包
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
2021-03-29 Shell中 |和||,&和&&用法
2021-03-29 shell -r参数
2018-03-29 实战:使用SVN+apache搭建一个版本控制服务器