记录一下如何查看某个网卡流量最多进程,用到几个命令
dstatiftopdstat 是一个用来替换vmstat、iostat、netstat、nfsstat和ifstat的全能系统信息统计工具,支持数据实时刷新,输出直观易懂。dstat 默认没有安装,安装命令为:yum install -y dstat。dstat -tnf 1 10 输出接下来10秒内每秒的网络数据:
iftop 是一款实时流量监控工具,可以查看每个连接的实时速率。
iftop 来自EPEL软件库,安装命令是:yum install -y epel-release && yum install -y iftop。iftop -i eth0 -nNP 实时查看eth0网卡的各个连接和网速:
排查步骤
- 先使用dstat -tnf 1 10命令去定位哪个网卡流量异常
- 在使用iftop -i eth0 -nN去定位异常网卡访问了哪个ip
- 在采用iftop -i eth0 -nNP查看对应ip的端口
- 然后netstat -tnau或者lsof -i:$port去查看对应的进程



