• 网卡流量

1、iftop命令

iftop可以用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息、TCP/IP连接等
官网:http://www.ex-parrot.com/~pdw/iftop/

  • 安装iftop:
[root@Super ~]# yum install flex byacc  libpcap ncurses ncurses-devel libpcap-devel -y
[root@Super ~]# wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
[root@Super ~]#  tar -zxvf iftop-0.17.tar.gz
[root@Super ~]# cd iftop-0.17
[root@Super iftop-0.17]#    ./configure
[root@Super iftop-0.17]# make
[root@Super iftop-0.17]# make install
[root@Super iftop-0.17]# iftop --help
iftop: unknown option --
iftop: display bandwidth usage on an interface by host

Synopsis: iftop -h | [-npbBP] [-i interface] [-f filter code] [-N net/mask]

   -h                  display this message
   -n                  don't do hostname lookups
   -N                  don't convert port numbers to services
   -p                  run in promiscuous mode (show traffic between other
                       hosts on the same network segment)
   -b                  don't display a bar graph of traffic
   -B                  Display bandwidth in bytes
   -i interface        listen on named interface
   -f filter code      use filter code to select packets to count
                       (default: none, but only IP packets are counted)
   -F net/mask         show traffic flows in/out of network
   -P                  show ports as well as hosts
   -m limit            sets the upper limit for the bandwidth scale
   -c config file      specifies an alternative configuration file

iftop, version 0.17
copyright (c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors
[root@Super iftop-0.17]# 

  

或者安装好epel源后直接yum install iftop -y安装

[root@Super ~]# yum install iftop -y

iftop监控命令的例子:

iftop -N -n -i eth0
  • 运行iftop

直接运行后效果图如下

[root@Super soft]# iftop
interface: ens32
IP address is: 192.168.100.127 MAC address is: 00:50:56:a9:1c:49 [root@Super soft]# 

linux网络流量查看命令

<= 、=> 左右箭头,表示流量的方向;
右边3列,表示的是该访问