RHEL 5.4 下安装和使用 ntop 全纪录(ntop:Linux下可通过Web访问的网络流量监控工具)...

RHEL 5.4 下安装和使用 ntop 全纪录

1. ntop介绍

  Ntop是一种监控网络流量工具,用ntop显示网络的使用情况比其他一些网络管理软件更加直观、详细。Ntop甚至可以列出每个节点计算机的网络带宽利用率。他是一个灵活的、功能齐全的,用来监控和解决局域网问题的工具;尤其当ntop与nprobe配合使用,其功能更加显著。它同时提供命令行输入和web页面,可应用于嵌入式web服务。

http://www.linuxidc.com/Linux/2012-05/59659.htm 写道
NTOP主要提供以下一些功能:
◆ 自动从网络中识别有用的信息;
◆ 将截获的数据包转换成易于识别的格式;
◆ 对网络环境中通信失败的情况进行分析;
◆ 探测网络环境中的通信瓶颈;
◆ 记录网络通信的时间和过程。
◆ 自动识别客户端正在使用的操作系统;
◆ 可以在命令行和Web两种方式运行。
它可以通过分析网络流量来确定网络上存在的各种问题;也可以用来判断是否有黑客正在攻击网络系统;还可以很方便地显示出特定的网络协议、占用大量带宽的主机、各次通信的目标主机、数据包的发送时间、传递数据包的延时等详细信息。通过了解这些信息,网管员可以对故障做出及时的响应,对网络进行相应的优化调 整,以保证网络运行的效率和安全。
 
http://www.linuxidc.com/Linux/2011-08/40783.htm 写道
ntop 4.1 发布了,这是一个维护版本,删除了一些过时的代码和协议,增加 Facebook 和 Twitter 支持,降低了内存占用,提升了稳定性。
跟 top 监视系统活动状况相似,ntop 是一个用来实时监视网络使用情况的工具。由于 ntop 具有 Web 界面模式,因此无论是配置还是使用都很容易在短时间之内快速上手。

 

2. ntop安装

2.1. 安装 cairo-devel

因为安装 rrdtool 需要。cairo,埃及首都开罗,向量图形绘图库。

http://www.oschina.net/p/cairo/ 写道
在资讯领域中,cairo 是一个让用于提供向量图形绘图的免费函式库,Cairo 提供在多个背景下做 2-D 的绘图,进阶的更可以使用硬件加速功能。

虽然 Cairo 是使用C语言撰写的,但是当使用 Cairo 时,可以用许多其他种语言来使用,包括有 C++、C#、Java、Python、Perl、Ruby、Scheme、Smalltalk 以及许多种语言,Cairo 在 GPL 与 Mozilla Public License 两个认证下发行。
 

先将光盘mount到/mnt。


[root@liunx0918 ~]# mount /dev/cdrom /mnt
[root@liunx0918 ~]# cd /mnt
[root@liunx0918 mnt]# ls
Cluster                RELEASE-NOTES-de.html  RELEASE-NOTES-ml.html     RELEASE-NOTES-U4-de.html  RELEASE-NOTES-U4-ml.html     RELEASE-NOTES-zh_CN.html
ClusterStorage         RELEASE-NOTES-en       RELEASE-NOTES-mr.html     RELEASE-NOTES-U4-en       RELEASE-NOTES-U4-mr.html     RELEASE-NOTES-zh_TW.html
EULA                   RELEASE-NOTES-en.html  RELEASE-NOTES-or.html     RELEASE-NOTES-U4-en.html  RELEASE-NOTES-U4-or.html     RPM-GPG-KEY-redhat-beta
eula.en_US             RELEASE-NOTES-es.html  RELEASE-NOTES-pa.html     RELEASE-NOTES-U4-es.html  RELEASE-NOTES-U4-pa.html     RPM-GPG-KEY-redhat-release
GPL                    RELEASE-NOTES-fr.html  RELEASE-NOTES-pt_BR.html  RELEASE-NOTES-U4-fr.html  RELEASE-NOTES-U4-pt_BR.html  Server
images                 RELEASE-NOTES-gu.html  RELEASE-NOTES-ru.html     RELEASE-NOTES-U4-gu.html  RELEASE-NOTES-U4-ru.html     TRANS.TBL
isolinux               RELEASE-NOTES-hi.html  RELEASE-NOTES-si.html     RELEASE-NOTES-U4-hi.html  RELEASE-NOTES-U4-si.html     VT
README-en              RELEASE-NOTES-it.html  RELEASE-NOTES-ta.html     RELEASE-NOTES-U4-it.html  RELEASE-NOTES-U4-ta.html
README-en.html         RELEASE-NOTES-ja.html  RELEASE-NOTES-te.html     RELEASE-NOTES-U4-ja.html  RELEASE-NOTES-U4-te.html
RELEASE-NOTES-as.html  RELEASE-NOTES-kn.html  RELEASE-NOTES-U4-as.html  RELEASE-NOTES-U4-kn.html  RELEASE-NOTES-U4-zh_CN.html
RELEASE-NOTES-bn.html  RELEASE-NOTES-ko.html  RELEASE-NOTES-U4-bn.html  RELEASE-NOTES-U4-ko.html  RELEASE-NOTES-U4-zh_TW.html
[root@liunx0918 mnt]# find . -name "cairo*rpm"
./Server/cairo-1.2.4-5.el5.i386.rpm
./Server/cairo-devel-1.2.4-5.el5.i386.rpm
./Server/cairo-java-1.0.5-3.fc6.i386.rpm
./Server/cairo-java-devel-1.0.5-3.fc6.i386.rpm
[root@liunx0918 mnt]# rpm -ivh ./Server/cairo-1.2.4-5.el5.i386.rpm ./Server/cairo-devel-1.2.4-5.el5.i386.rpm
warning: ./Server/cairo-1.2.4-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        fontconfig-devel >= 2.0 is needed by cairo-devel-1.2.4-5.el5.i386
        freetype-devel >= 2.1.3-3 is needed by cairo-devel-1.2.4-5.el5.i386
        libXrender-devel is needed by cairo-devel-1.2.4-5.el5.i386
        libpng-devel is needed by cairo-devel-1.2.4-5.el5.i386
依赖的rpm包还真多!
[root@liunx0918 mnt]# find . -name "fontconfig-devel*rpm"
./Server/fontconfig-devel-2.4.1-7.el5.i386.rpm
[root@liunx0918 mnt]# find . -name "freetype-devel*rpm"
./Server/freetype-devel-2.2.1-21.el5_3.i386.rpm
[root@liunx0918 mnt]# find . -name "libXrender-devel*rpm"
./Server/libXrender-devel-0.9.1-3.1.i386.rpm
[root@liunx0918 mnt]# find . -name "libpng-devel*rpm"
./Server/libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm
[root@liunx0918 mnt]# rpm -ivh ./Server/cairo-1.2.4-5.el5.i386.rpm ./Server/cairo-devel-1.2.4-5.el5.i386.rpm ./Server/fontconfig-devel-2.4.1-7.el5.i386.rpm ./Server/freetype-devel-2.2.1-21.el5_3.i386.rpm ./Server/libXrender-devel-0.9.1-3.1.i386.rpm ./Server/libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm
warning: ./Server/cairo-1.2.4-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        libX11-devel is needed by libXrender-devel-0.9.1-3.1.i386
        xorg-x11-proto-devel is needed by libXrender-devel-0.9.1-3.1.i386
[root@liunx0918 mnt]# find . -name "libX11-devel*rpm"
./Server/libX11-devel-1.0.3-11.el5.i386.rpm
[root@liunx0918 mnt]# find . -name "xorg-x11-proto-devel*rpm"
./Server/xorg-x11-proto-devel-7.1-13.el5.i386.rpm
[root@liunx0918 mnt]# rpm -ivh ./Server/cairo-1.2.4-5.el5.i386.rpm ./Server/cairo-devel-1.2.4-5.el5.i386.rpm ./Server/fontconfig-devel-2.4.1-7.el5.i386.rpm ./Server/freetype-devel-2.2.1-21.el5_3.i386.rpm ./Server/libXrender-devel-0.9.1-3.1.i386.rpm ./Server/libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm ./Server/libX11-devel-1.0.3-11.el5.i386.rpm ./Server/xorg-x11-proto-devel-7.1-13.el5.i386.rpm
warning: ./Server/cairo-1.2.4-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        libXau-devel is needed by libX11-devel-1.0.3-11.el5.i386
        libXdmcp-devel is needed by libX11-devel-1.0.3-11.el5.i386
        mesa-libGL-devel is needed by xorg-x11-proto-devel-7.1-13.el5.i386
[root@liunx0918 mnt]# find . -name "libXau-devel*rpm"
./Server/libXau-devel-1.0.1-3.1.i386.rpm
[root@liunx0918 mnt]# find . -name "libXdmcp-devel*rpm"
./Server/libXdmcp-devel-1.0.1-2.1.i386.rpm
[root@liunx0918 mnt]# find . -name "mesa-libGL-devel*rpm"
./Server/mesa-libGL-devel-6.5.1-7.7.el5.i386.rpm
[root@liunx0918 mnt]# rpm -ivh ./Server/cairo-1.2.4-5.el5.i386.rpm ./Server/cairo-devel-1.2.4-5.el5.i386.rpm ./Server/fontconfig-devel-2.4.1-7.el5.i386.rpm ./Server/freetype-devel-2.2.1-21.el5_3.i386.rpm ./Server/libXrender-devel-0.9.1-3.1.i386.rpm ./Server/libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm ./Server/libX11-devel-1.0.3-11.el5.i386.rpm ./Server/xorg-x11-proto-devel-7.1-13.el5.i386.rpm ./Server/libXau-devel-1.0.1-3.1.i386.rpm ./Server/libXdmcp-devel-1.0.1-2.1.i386.rpm ./Server/mesa-libGL-devel-6.5.1-7.7.el5.i386.rpm
warning: ./Server/cairo-1.2.4-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package cairo-1.2.4-5.el5.i386 is already installed
[root@liunx0918 mnt]# rpm -ivh ./Server/cairo-devel-1.2.4-5.el5.i386.rpm ./Server/fontconfig-devel-2.4.1-7.el5.i386.rpm ./Server/freetype-devel-2.2.1-21.el5_3.i386.rpm ./Server/libXrender-devel-0.9.1-3.1.i386.rpm ./Server/libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm ./Server/libX11-devel-1.0.3-11.el5.i386.rpm ./Server/xorg-x11-proto-devel-7.1-13.el5.i386.rpm ./Server/libXau-devel-1.0.1-3.1.i386.rpm ./Server/libXdmcp-devel-1.0.1-2.1.i386.rpm ./Server/mesa-libGL-devel-6.5.1-7.7.el5.i386.rpm          
  warning: ./Server/cairo-devel-1.2.4-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:freetype-devel         ########################################### [ 10%]
   2:fontconfig-devel       ########################################### [ 20%]
   3:libXau-devel           ########################################### [ 30%]
   4:libpng-devel           ########################################### [ 40%]
   5:xorg-x11-proto-devel   ########################################### [ 50%]
   6:libX11-devel           ########################################### [ 60%]
   7:libXrender-devel       ########################################### [ 70%]
   8:cairo-devel            ########################################### [ 80%]
   9:libXdmcp-devel         ########################################### [ 90%]
  10:mesa-libGL-devel       ########################################### [100%]

[root@liunx0918 mnt]#

 

2.2. 安装 pango-devel

因为安装 rrdtool 需要。pango是一个文字渲染库。

http://baike.baidu.com/view/2941612.htm 写道
  Pango(Παν语)是一个开放源代码的自由函数库,用于高质量地渲染国际化的文字。Pango可以使用不同的后端字体,并提供了跨平台支持。

  Pango已经被整合到多数Linux发行版中,并在Fedora Core 6被用于Firefox网页浏览器和Thunderbird邮件客户端的文字渲染。虽然在Mozilla的源代码里并没有包含Pango,但Fedora Core得到了Mozilla基金会的特别许可[1]。同样,Debian的Iceweasel、IceDove和IceApe也使用了Pango。

  在与Cairo融合后,Pango可以完全进行文字处理和图形渲染。
 


[root@liunx0918 mnt]# find . -name "pango*rpm"
./Server/pango-1.14.9-6.el5.i386.rpm
./Server/pango-devel-1.14.9-6.el5.i386.rpm
[root@liunx0918 mnt]#
[root@liunx0918 mnt]# rpm -ivh ./Server/pango-1.14.9-6.el5.i386.rpm ./Server/pango-devel-1.14.9-6.el5.i386.rpm
warning: ./Server/pango-1.14.9-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        libXext-devel is needed by pango-devel-1.14.9-6.el5.i386
        libXft-devel is needed by pango-devel-1.14.9-6.el5.i386
[root@liunx0918 mnt]# find . -name "libXext-devel*rpm"
./Server/libXext-devel-1.0.1-2.1.i386.rpm
[root@liunx0918 mnt]# find . -name "libXft-devel*rpm"
./Server/libXft-devel-2.1.10-1.1.i386.rpm
[root@liunx0918 mnt]# rpm -ivh ./Server/pango-1.14.9-6.el5.i386.rpm ./Server/pango-devel-1.14.9-6.el5.i386.rpm ./Server/libXext-devel-1.0.1-2.1.i386.rpm

./Server/libXft-devel-2.1.10-1.1.i386.rpm
warning: ./Server/pango-1.14.9-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package pango-1.14.9-6.el5.i386 is already installed
[root@liunx0918 mnt]# rpm -ivh ./Server/pango-devel-1.14.9-6.el5.i386.rpm ./Server/libXext-devel-1.0.1-2.1.i386.rpm ./Server/libXft-devel-2.1.10-1.1.i386.rpm         

warning: ./Server/pango-devel-1.14.9-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:libXft-devel           ########################################### [ 33%]
   2:libXext-devel          ########################################### [ 67%]
   3:pango-devel            ########################################### [100%]
[root@liunx0918 mnt]#

 

2.3. 安装 rrdtool

rrdtool是一个环状数据库工具。

http://baike.baidu.com/view/1867979.htm 写道
  RRDtool是由Tobias Oetiker 编写并由全球各地的许多人贡献的工具。RRDtool是指Round Robin Database 工具(环状数据库)。Round robin是一种处理定量数据、以及当前元素指针的技术。想象一个周边标有点的圆环--这些点就是时间存储的位置。从圆心画一条到圆周的某个点的箭头--这就是指针。就像我们在一个圆环上一样,没有起点和终点,你可以一直往下走下去。过来一段时间,所有可用的位置都会被用过,该循环过程会自动重用原来的位置。这样,数据集不会增大,并且不需要维护。RRDtool处理RRD数据库。它用向RRD数据库存储数据、从RRD数据库中提取数据。

 

简要安装步骤如下:

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
tar zxf rrdtool-1.4.7.tar.gz
cd rrdtool-1.4.7
./configure --prefix=/usr
make && make install


下面是安装过程中的一些输出信息:
[root@liunx0918 rrdtool-1.4.7]# ./configure --prefix=/usr
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc

省略

----------------------------------------------------------------
Config is DONE!

          With MMAP IO: yes
      Build rrd_getopt: no
       Build rrd_graph: yes
       Static programs: no
          Perl Modules: perl_piped perl_shared
           Perl Binary: /usr/bin/perl
          Perl Version: 5.8.8
          Perl Options: PREFIX=/usr LIB=/usr/lib/perl/5.8.8
          Ruby Modules:
           Ruby Binary: no
          Ruby Options: sitedir=/usr/lib/ruby
    Build Lua Bindings: no
    Build Tcl Bindings: no
 Build Python Bindings: yes
          Build rrdcgi: yes
       Build librrd MT: yes
           Use gettext: yes
           With libDBI: no
          With libwrap: yes

             Libraries: -lxml2 -lglib-2.0 -lcairo -lcairo -lcairo -lm  -lwrap -lcairo -lpng12   -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 

Type 'make' to compile the software and use 'make install' to
install everything to: /usr.

       ... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.

                               -- Tobi Oetiker <tobi@oetiker.ch>
----------------------------------------------------------------
[root@liunx0918 rrdtool-1.4.7]#

 

 

2.4. 安装 libpcap-devel

libpcap是一个网络数据包捕获函数库。

http://baike.baidu.com/view/1319961.htm 写道
  libpcap是unix/linux平台下的网络数据包捕获函数包,
  大多数网络监控软件都以它为基础。
  Libpcap可以在绝大多数类unix平台下工作.
  Libpcap应用程序框架
  Libpcap提供了系统独立的用户级别网络数据包捕获接口,并充分考虑到应用程序的可移植性。
 

安装 ntop 时需要,否则报下面的错:
checking for pcap_lookupdev in -lpcap... no
             *** FATAL ERROR ***            
 It looks that you don't have the libpcap distribution installed.
 Download, compile and, optionally, install it.
 When finished please re-run this program.
 You can download the latest source tarball at http://www.tcpdump.org/
configure: error:  The LBL Packet Capture Library, libpcap, was not found!


下面是安装记录:
[root@liunx0918 mnt]# find . -name "libpcap*rpm"
./Server/libpcap-0.9.4-14.el5.i386.rpm
./Server/libpcap-devel-0.9.4-14.el5.i386.rpm
[root@liunx0918 mnt]# rpm -ivh ./Server/libpcap-0.9.4-14.el5.i386.rpm ./Server/libpcap-devel-0.9.4-14.el5.i386.rpm
warning: ./Server/libpcap-0.9.4-14.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package libpcap-0.9.4-14.el5.i386 is already installed
[root@liunx0918 mnt]# rpm -ivh ./Server/libpcap-devel-0.9.4-14.el5.i386.rpm                                       
warning: ./Server/libpcap-devel-0.9.4-14.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:libpcap-devel          ########################################### [100%]
[root@liunx0918 mnt]#

 

 

2.5. 安装 GeoIP

GeoIP是一个 ip 对应地理信息的数据库。

http://hi.baidu.com/liongg/item/4ba0083e224b620fceb9fe81 写道
所谓GeoIP,就是通过来访者的IP,定位他的经纬度,国家/地区,省市,甚至街道等位置信息。这里面的技术不算难题,关键在于有个精准的数据库。有了准确的数据源就奇货可居赚点小钱,可是发扬合作精神,集体贡献众人享用是我们追求的。
 

如果不安装 GeoIP,那么在安装 ntop 时报错:

checking for GeoIP_record_by_ipnum in -lGeoIP... no
checking for GeoIP_name_by_ipnum_v6 in -lGeoIP... no
Please install GeoIP (http://www.maxmind.com/)

 

下面是简要安装步骤:
wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar zxf GeoIP.tar.gz
cd GeoIP-1.4.8/
./configure --prefix=/usr
make && make install

 

下面是详细安装记录:
[root@liunx0918 install]# wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
--2012-05-28 15:00:14--  http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
正在解析主机 www.maxmind.com... 174.36.207.186
Connecting to www.maxmind.com|174.36.207.186|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1074829 (1.0M) [application/octet-stream]
Saving to: `GeoIP.tar.gz'

100%[=============================================================================================================================>] 1,074,829   45.6K/s   in 20s    

2012-05-28 15:00:35 (53.4 KB/s) - `GeoIP.tar.gz' saved [1074829/1074829]

[root@liunx0918 install]# tar zxf GeoIP.tar.gz
[root@liunx0918 install]# cd GeoIP-1.4.8/
[root@liunx0918 GeoIP-1.4.8]# ls
aclocal.m4  ChangeLog     configure     depcomp            get_ver.awk  ltmain.sh         Makefile.vc     NEWS          READMEwin32static.txt
apps        conf          configure.in  geoip.ico          INSTALL      Makefile.am       Makefile.win32  README        READMEwin32.txt
AUTHORS     config.guess  COPYING       GeoIP.spec.in      install-sh   Makefile.in       man             README.MinGW  test
bootstrap   config.sub    data          GeoIPWinDLL.patch  libGeoIP     Makefile.netware  missing         README.OSX    TODO
[root@liunx0918 GeoIP-1.4.8]# ./configure --prefix=/usr
checking for gcc... gcc
checking whether the C compiler works... yes

省略

configure: creating ./config.status
config.status: creating Makefile
config.status: creating GeoIP.spec
config.status: creating libGeoIP/Makefile
config.status: creating apps/Makefile
config.status: creating conf/Makefile
config.status: creating data/Makefile
config.status: creating man/Makefile
config.status: creating test/Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
[root@liunx0918 GeoIP-1.4.8]#

 

2.6. 安装 ntop

终于到这一步了。下面是安装的简要步骤:

wget "http://sourceforge.net/projects/ntop/files/ntop/Stable/ntop-4.1.0.tar.gz/download"
tar zxf ntop-4.1.0.tar.gz
cd ntop-4.1.0
./autogen.sh
make && make install

 

下面是安装过程中输出的部分信息:
*******************************************************************
*
* NOTE: ./configure is now complete!
*
*       All of the obviously FATAL errors would cause you to
*       abort before this point, so while you SHOULD scroll
*       back and check for error/warning/note messages,
*       you probably will not...
*
++
++    If you like ntop, please do not forget to support its
++    development. See SUPPORT_NTOP.txt for more information.
++
++              Thanks for supporting ntop!
++
*
* NEXT STEP(S):
*
*    Building ntop requires GNU Make, so to build ntop, type
*    'make' (or on *BSD and Solaris systems, 'gmake')
*
*******************************************************************

        .... autogen.sh done
just type make to compile ntop


************************************************************
************************************************************

  WARNING: This install created a directory for the ntop
           files and databases:

             //usr/local/share/ntop

           This directory MUST be owned by the user
           which you are going to use to run ntop.

           The command you must issue is something like:

           chown -R ntop.ntop //usr/local/share/ntop
     or    chown -R ntop:users //usr/local/share/ntop

           man chown to check the syntax for YOUR system

************************************************************
************************************************************


echo "Shall you be using SELinux please run:"
Shall you be using SELinux please run:
echo "make install-selinux-policy"
make install-selinux-policy

 

3. 运行 ntop

3.1. 运行前的准备工作

网上有些资料说需要添加名为 ntop 的用户,我试了,并不需要。

首先来看一下 ntop 的启动参数:


ntop -u user 就可以指定启动程序执行的用户,否则 ntop是以 nobody 用户来运行的。

ntop -h 写道
[-u <user> | --user <user>] Userid/name to run ntop under (see man page)
 

 

一般建议以 ntop 用户来运行 ntop 程序。


下面是创建 ntop 用户的步骤:
useradd -s /sbin/nologin ntop
passwd -l ntop


[root@liunx0918 ~]# useradd -s /sbin/nologin ntop
[root@liunx0918 ~]# passwd -l ntop
Locking password for user ntop.
passwd: Success
[root@liunx0918 ~]#

计划将 ntop 的数据库放在 /var/ntop 目录
[root@liunx0918 ~]# mkdir /var/ntop
[root@liunx0918 ~]# chown -R ntop:ntop /var/ntop
[root@liunx0918 ~]#

检查防火墙设置,放开 3000 端口
先执行 service iptables save
再在 /etc/sysconfig/iptables 中添加一行
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 3000 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
保存
执行 service iptables restart


[root@liunx0918 ~]# service iptables save
Saving firewall rules to /etc/sysconfig/iptables:          [  OK  ]
[root@liunx0918 ~]# vi /etc/sysconfig/iptables
修改 /etc/sysconfig/iptables 文件,如上所示。
[root@liunx0918 ~]# service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]
[root@liunx0918 ~]#

注:直接执行下面的命令不能放开 3000 端口
iptables -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 3000 -j ACCEPT

ntop其他重要参数

ntop -h 写道
[-P <path> | --db-file-path <path>] Path for ntop internal database files

[-i <name> | --interface <name>] Interface name or names to monitor

[-d | --daemon] Run ntop in daemon mode

[-L] Do logging via syslog

[--skip-version-check] Skip ntop version check

[-A] Ask admin user password and exit
 

经过这么长时间的准备工作,我准备用下面的方式来启动 ntop,用以监控第一块网卡上的流量:

ntop -P /var/ntop -i eth0 -u ntop

 

3.2. 设置 ntop 管理密码

首先得使用 ntop -A 设置管理密码。可以设置得复杂些。

 

ntop startup - waiting for user response!


Please enter the password for the admin user: Mon May 28 15:07:13 2012  THREADMGMT[t3017280400]: DNSAR(3): Address resolution thread running

Password too short (5 characters or more). Please try again.


ntop startup - waiting for user response!


Please enter the password for the admin user:
Please enter the password again:
Mon May 28 15:07:31 2012  Admin user password has been set

 

3.3. 运行 ntop

[root@liunx0918 ~]# ntop -P /var/ntop -i eth0 -u ntop -d
Tue Jun  5 09:08:22 2012  NOTE: Interface merge enabled by default
Tue Jun  5 09:08:22 2012  Initializing gdbm databases
Tue Jun  5 09:08:22 2012  Setting administrator password...
Tue Jun  5 09:08:22 2012  Admin password set...
Tue Jun  5 09:08:22 2012  ntop v.4.1.0 (32 bit)
Tue Jun  5 09:08:22 2012  Configured on May 28 2012 15:03:47, built on May 28 2012 15:05:09.
Tue Jun  5 09:08:22 2012  Copyright 1998-2011 by Luca Deri <deri@ntop.org>
Tue Jun  5 09:08:22 2012  Get the freshest ntop from http://www.ntop.org/
Tue Jun  5 09:08:22 2012  NOTE: ntop is running from 'ntop'
Tue Jun  5 09:08:22 2012  NOTE: (but see warning on man page for the --instance parameter)
Tue Jun  5 09:08:22 2012  NOTE: ntop libraries are in '/usr/local/lib'
Tue Jun  5 09:08:22 2012  Initializing ntop
Tue Jun  5 09:08:22 2012  Checking eth0 for additional devices
Tue Jun  5 09:08:22 2012  Added virtual interface: 'eth0:0'
Tue Jun  5 09:08:22 2012  Resetting traffic statistics for device eth0
Tue Jun  5 09:08:22 2012  Initializing device eth0 (0)
Tue Jun  5 09:08:22 2012  DLT: Device 0 [eth0] is 1, mtu 1514, header 14
Tue Jun  5 09:08:22 2012  Initialized events [mask: 0][path: ]
Tue Jun  5 09:08:22 2012  Initializing gdbm databases
Tue Jun  5 09:08:22 2012  VENDOR: Loading MAC address table.
Tue Jun  5 09:08:22 2012  VENDOR: Checking for MAC address table file
Tue Jun  5 09:08:22 2012  VENDOR: File '/usr/local/etc/ntop/specialMAC.txt.gz' does not need to be reloaded
Tue Jun  5 09:08:22 2012  VENDOR: ntop continues ok
Tue Jun  5 09:08:22 2012  VENDOR: Checking for MAC address table file
Tue Jun  5 09:08:22 2012  VENDOR: File '/usr/local/etc/ntop/oui.txt.gz' does not need to be reloaded
Tue Jun  5 09:08:22 2012  VENDOR: ntop continues ok
Tue Jun  5 09:08:22 2012  Fingerprint: Loading signature file
Tue Jun  5 09:08:22 2012  Fingerprint: Checking for Fingerprint file... file
Tue Jun  5 09:08:22 2012  Fingerprint: Loading file '/usr/local/etc/ntop/etter.finger.os.gz'
Tue Jun  5 09:08:22 2012  Fingerprint: ...loaded 1765 records
Tue Jun  5 09:08:22 2012  INIT: Parent process is exiting (this is normal)
Tue Jun  5 09:08:22 2012  INIT: Bye bye: I'm becoming a daemon...
[root@liunx0918 ~]#

 

现在就可以通过浏览器来访问了,比如使用 Firefox,网址为:

http://your_server_ip:3000/

 

4. 安装和使用 ntop 的常见问题

4.1. 我用浏览器访问 http://xxx:3000/ 时没有询问用户名和密码(很多资料上说有),为什么?

在查看网络统计信息时不需要,但点 Admin 里面的配置选项时需要。

 

4.2. 流量的单位

是 bps, 不是 Bps

 

4.3. ntop 提供了使用 Google Maps 查看访问者地图,但是不灵。

得先申请一个 Google Maps API Key,下面的资料有介绍:

http://blog.youkuaiyun.com/guanzhouxuezi/article/details/6070015

http://code.google.com/android/maps-api-signup.html
https://developers.google.com/maps/documentation/android/maps-api-signup

不过,怎么试都不灵。最后,看了一下网页源代码,发现 ntop 使用的 Google Maps v2 的API,现在已经作废不能用了。希望 ntop 尽快推出支持 Google Maps v3 的版本。

5. ntop 相关资料

(1) 百度百科:ntop
http://baike.baidu.com/view/6340040.htm
(2) 互动百科:NTOP
http://www.hudong.com/wiki/NTOP
(3) 天下网盟:网管经验 用NTOP精确监控网络流量
http://netbar.txwm.com/wguan/v13826.html
(4) IT专家网:连载:安装配置NTOP监控Linux网络
http://linux.ctocio.com.cn/400/8873900.shtml

(5) RHEL 5.4 下安装和使用 ntop 全纪录(就是本文)

http://codingstandards.iteye.com/blog/1551505

 

END.

 

 

 

OpenClaw + Qwen 模型集成飞书完整教程 1、环境要求:- **操作系统**: Windows- **Node.js**: v18+ (推荐 v20+)- **飞书账号**: 需要企业管理员权限(创建应用用)或者个人飞书账号创建个人应用- **网络**: 能访问 GitHub 和飞书开放平台2、安装Node.js下载完成后验证是否安装成功,cmd窗口输入“node --version”,显示版本号即为安装成功(如下图所示)3、获取大模型APIKEY(这里以Qwen为例) 阅读详情

相关推荐

Reactor 响应式编程(第一篇:Reactor核心)

响应式:响应式编程: 全异步、消息、事件回调默认还是用当前线程,生成整个流、发布流、流操作.log();//只要不指定线程池,默认发布者用的线程就是订阅者的线程;

moments的博客 1572

ntop安装报错记录

wget  http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpm wget -c -t 3 http://packages.sw.be/ntop/ntop-3.3.8-2.el5.rf.i386.rpm Test the compiler an

MiltonZhong 1126

INCA文件刷写全流程:从ES581驱动安装到XCP协议实战(附避坑指南)

本文详细解析INCA文件刷写的全流程操作,从ES581驱动安装到XCP协议配置,提供实战经验与避坑指南。涵盖A2L文件校验、工作区优化、XCP参数调优及自动化刷写技巧,帮助工程师高效完成ECU开发中的文件刷写任务。

egg99的博客 942

嵌入式开发经典网站

嵌入式开发经典网站 来自boji:http://www.readlife.com/read.php?tid=23170 1.OpenHardwaredevelopersite 提供一些优秀的开源嵌入式开发项目,里面都有详细的资料。给几个例子看看 http://www.openhardware.net/?title=WebPal%20Project%20page&...

weixin_30493321的博客 1928

记录:N10激光雷达串口编程,将数据存进 SQLite,并进行 ROS2 - cartographer 单雷达建图

N10 系列采用 TOF(time of flight)测距原理,通过测量调制激光的发射、返回时间差来测量物体与传感器的相对距离。激光发射器发出调制脉冲激光,内部定时器开始 从t1时刻计算时间,当激光照射到目标物体后,部分能量返回,当雷达接收到返回的激光信号时,在t2时刻停止内部定时器计时,光速C,激光雷达到达物体的距离D为:经过N10系列激光雷达内嵌的信号处理单元的实时解算得到探测物体的距离值,结合高精度自适应角度测量模块输出的角度信息,可以得到量程内周围 360 度环境 的二维平面信息。

m0_74013893的博客 1096

【异常】OpenClaw网关仪表盘 pairing required 报错排查与解决方案

在OpenClaw网关仪表盘页面,完成WebSocket URL、网关令牌等必填项配置后,点击「连接」按钮尝试建立网关连接时,页面下方出现红色报错提示框,核心报错内容为,无法完成网关连接建立,且该报错在令牌配置正确、网络链路通畅的场景下仍会触发。该报错常见于非本地回环地址的访问场景,包括局域网远程访问、公网域名/IP访问、云服务器部署的网关远程管理等场景,本地127.0.0.1回环地址访问通常可正常连接。

奶爸的编程之路,也就一周冷个三天 1077

Jmeter常用插件使用说明

插件使用步骤: 1、下载管理插件,plugins-manager.jar,将plugins-manager.jar拷贝到Jmeter的lib/ext目录下,重新打开Jmeter在options菜单可以看到如下界面 2、打开options->Plugins Manager,如下图展示,第一个标签列出的是已经安装的插件,第二个标签是可以获得的插件,第三个标签是可以升级的插件,点击Avaliable Plugins 3、选择需要安装的插件(右边有插件的介绍),点击Apply Ch.

csdnhnma的博客 2655

【YOLO系列】YOLOv8详解:模型结构、损失函数、训练方法及代码实现

YOLOv8是Ultralytics团队2023年推出的高效目标检测框架,在速度与精度平衡、多任务支持和易用性方面实现突破。模型采用改进的CSPDarknet主干网络、C2f模块和SPPF加速结构,结合PAN-FPN特征融合和解耦检测头设计,支持目标检测、实例分割和关键点检测任务。创新性地使用CIoU定位损失、Focal Loss置信度损失和动态样本分配策略,显著提升检测性能。实验表明,YOLOv8较前代模型mAP提升5-10%,在TensorRT加速下可达1000FPS,提供5种尺寸灵活选择,成为实时目标

一碗白开水一 2779

SAS进阶《深入解析SAS》之开发多语言支持的SAS程序

SAS进阶《深入解析SAS》之开发多语言支持的SAS程序 1. 多语言支持的应用程序是指该程序在世界给第使用时,其能够处理的数据,以及处理数据的方式、信息展现的方式都符合当地的语言、文化习惯,这要求应用程序运行时,能够自动进行与地区、语言相关的处理,也就是通常所说的国际化。 2. SBCS、DBCS、MBCS 单字节字符集...

weixin_34294649的博客 811

路由三大分类:直连路由、静态路由、动态路由

直连路由、静态路由和动态路由各有其独特的特点和适用场景。直连路由适用于简单的直接连接网络,静态路由提供了精确的路径控制,而动态路由则在大型复杂网络中展现出强大的适应性和自动化能力。了解和掌握这三种路由类型的配置和管理,对于网络管理员来说,是确保网络高效、安全运行的重要技能。

网络技术联盟站 4698

xtop:multi_driven_net与incomplete_timing_cell fail reason 分析

man multi_driven_net”可以得知,这个问题是multi driven结构引起的,使用命令“get_failed_pins -reason multi_driven_net”,获取violation pin。“man incomplete_timing_cell”可以得知,这个fail reason的原因是缺少timing library cell,检查并补全后这个错误就显示了。这里选择的解决方法是修改lib文件,把inout改成input,重新lib2idb。通过这种方法解决了问题。

m0_61544122的博客 566

Ubuntu常用命令大全

Ubuntu常用命令大全 查看软件xxx安装内容#dpkg -L xxx 查找软件#apt-cache search 正则表达式查找文件属于哪个包#dpkg -S filename apt-file search filename 查询软件xxx依赖哪些包#apt-cache depends xxx 查询软件xxx被哪些包依赖#apt-cache rdepends xxx 增加一个光盘...

cxianf 2215

Tmux学习总结

Tmux 重要概念 使用 Tmux 的时候千万不要去背指令,所有的指令都可以在 .tmux.conf 配置文件中绑定自己顺手的快捷键,也可以配置开启鼠标。 这个是我的配置文件:https://github.com/zuorn/tmux.conf 在Tmux逻辑中,需要分清楚Server > Session > Window > Pane这个大小和层级顺序是极其重要的,直接关系到工作效率: Server:是整个tmux的后台服务。有时候更改配置不生效,就要使用tmux kill-

满目星辰 577

PaddleLite部署PaddleOCR流程

PaddleLite部署PaddleOCR流程 1.准备交叉编译的opencv4.2 具体步骤和问题解决方案见 https://blog.csdn.net/qiaolin19890323/article/details/107692034 https://www.cnblogs.com/weicaiershang/archive/2004/01/13/12834497.html 2.准备PaddleLite编译环境(可以选择交叉编译或者本地编译) 3.PaddleLite源码编译获得预测库 由于Padd

Zhangzh_0329的博客 5147

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

PHP

1      php安装 1.1    版本选择 1.1.1  如何选择PHP的VC9版本和VC6版本     VC6版本是使用Visual Studio 6编译器编译的,如果你的PHP是用Apache来架设的,那你就选择VC6版本。     VC9版本是使用Visual Studio 2008编译器编译的,如果你的PHP是用IIS来架设的,那你就选择VC9版本。     VC9版本是

2209

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

python:pycharm2019.1.1配置

文章目录一、搭建python解释器二、pycharm汉化三、pycharm常用快捷键1、编辑2、运行3、调试4、导航5、查找、替换、搜索6、重构四、自动加入文件头1、预定义变量2、部分实例五、关闭自动更新六、鼠标调整字体大小七、设置的备份与还原八、pycharm启动速度调整九、配置autopep8到菜单栏1、安装autopep82、配置autopep8到扩展工具3、使用autopep8十、设置仿sublime配色1、设置外观主题2、备份原Monokai方案,创建新的Monokai Copy方案3、在Copy

weixin_44374471的博客 1894

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Flutter 使用intl实现国际化

1.添加依赖 dependencies: #...省略无关项 intl: ^0.15.7 dev_dependencies: #...省略无关项 intl_translation: ^0.17.2 2.创建必要目录 首先,在项目根目录下创建一个i10n-arb目录,该目录保存我们接下来通过intl_translation命令生成的arb文件。一个简单的arb文件内容如下: ...

倚栏静望的博客 5586

rhel 5.8 安装iotop CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot determine

今天想监控数据库服务器io,找到iotop,从iotop官方网站下了rpm包后发现不能用,官网上提示要求python2.7,一看服务器上才2.4的版本,于是下载了python2.7.5来编译安装,然后重新安装iotop的rpm包,终于发现能用了,可每个进程具体占用io情况没显示出来,下脚提示“CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot...

sjw的窝 1276

Linux流量监控工具 – iftop (最全面的iftop教程)

在类Unix系统中可以使用top查看系统资源、进程、内存占用等信息。查看网络状态可以使用netstat、nmap等工具。若要查看实时的网络流量,监控TCP/IP连接等,则可以使用iftop。 一、iftop是什么? iftop是类似于top的实时流量监控工具。 官方网站:http://www.ex-parrot.com/~pdw/iftop/ 二、iftop有什么用? iftop可以用来监控网卡的...

入海数沙 2311

【vue-element-admin】4.x 添加 i18n 国际化多语言切换

vue-element-admin4.x 重新添加i18n国际化支持

萧仁武~~博客~~ 3790

jntoo.php,小舍微信分销拼团系统V6.0三级分销系统最新版源码+支持多商户入驻+拼团+微商城+分销...

【实例简介】小舍微信分销拼团系统V6.0三级分销系统最新版源码+支持多商户入驻+拼团+微商城+分销【实例截图】【核心代码】小舍微信分销拼团系统V6.0三级分销系统最新版源码支持多商户入驻拼团微商城分销├── admin│ ├── css│ │ └── mobile.css│ ├── images│ │ └── login_logo.png│ ├── includes│...

weixin_39724382的博客 1660

达梦DMHS中Oracle到达梦veri数据对比

文章目录前言一、规划二、源端配置ODBC1.ODBC安装2.配置文件三、创建配置文件1.Oracle源端agent配置文件2.DM目的端agent配置文件3.Oracle源端配置veri对比文件4.查看依赖5.启动对比6.查看对比报告总结 前言 已经安装好Oracle11g单机到达梦8单机的dmhs数据同步 一、规划 1、源端是Oracle11g,目的端是DM8 2、两端需要为数据对比各开一个agent服务,然后在其中一端开一个对比服务 3、数据对比服务启动在源端Oracle所在的服务器上 二、源端配.

qing1122334455的博客 486

Ubuntu使用

IMUX6UL嵌入式开发

ARM_QT2019的博客 639

I2C Gate级仿真SDA毛刺误触发START的排查与根治

I2C总线通信中,SDA和SCL的信号完整性直接影响通信可靠性。在数字IC设计中,RTL仿真因零延迟理想模型无法暴露组合逻辑竞争,而Gate级仿真结合SDF反标能真实反映标准单元延迟与连线延迟,从而捕获SDA上的Delta毛刺。这类毛刺若落在SCL高电平窗口内,可能被从机误判为START条件,导致通信失败。通过波形定位、根因分析及RTL同步输出、时序约束等加固手段,可有效消除毛刺,提升I2C控制器的量产稳定性。

weixin_34408717的博客 452
上一篇: CentOS 下安装 svn
下一篇: Linux下更改MySQL的数据库目录
codingstandards
博客等级 码龄16年 12粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值