NTOP的功能
NTOP主要提供以下一些功能:
◆ 自动从网络中识别有用的信息;
◆ 将截获的数据包转换成易于识别的格式;
◆ 对网络环境中通信失败的情况进行分析;
◆ 探测网络环境中的通信瓶颈;
◆ 记录网络通信的时间和过程。
它可以通过分析网络流量来确 定网络上存在的各种问题;也可以用来判断是否有黑客正在攻击网络系统;还可以很方便地显示出特定的网络协议、占用大量带宽的主机、各次通信的目标主机、数 据包的发送时间、传递数据包的延时等详细信息。通过了解这些信息,网管员可以对故障做出及时的响应,对网络进行相应的优化调整,以保证网络运行的效率和安全。
如果ntop架设在集线器环境.可以监控整个网络的封包.如果架在交换机上.需要交换机开启SPAN.否则只能监控对本机的所有封包.
NTOP的安装
Ntop需要: rrdtool libpcap libgd
安装apache(见apache安装文档)
安装RRDTool
由于rrdtool-1.2.23 需要一些库文件支持,故需先安装配置支持的环境,然后编译安装。
需要的包:cgilib-0.5.tar.gz、zlib-1.2.3.tar.gz、libpng-1.2.18.tar.gz、freetype-2.3.5.tar.gz、libart_lgpl-2.3.17.tar.gz、rrdtool-1.2.23.tar.gz
安装zlib
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/zlib-1.2.3.tar.gz
# tar zxvf zlib-1.2.3.tar.gz -C ../software/
# cd ../software/zlib-1.2.3/
#./configure --prefix=/usr/local/rrdtool/lb
#make
#make install
安装libpng
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/libpng-1.2.16.tar.gz
# tar zxvf libpng-1.2.16.tar.gz -C ../software/
# cd ../software/libpng-1.2.16/
#./configure --disable-shared --prefix=/usr/local/rrdtool/lb
#make
#make install
安装freetype
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/freetype-2.3.4.tar.gz
# tar zxvf freetype-2.3.4.tar.gz -C ../software/
# cd ../software/freetype-2.3.4/
#./configure --disable-shared --prefix=/usr/local/rrdtool/lb
#make
#make install
rmdir: /usr/local/rrdtool/lb//include/freetype2/freetype/internal: 没有那个文件或目录
make: [install] 错误 1 (忽略)
Make install 过程会报这个错.直接忽略.
安装libart_lgpl
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/libart_lgpl-2.3.17.tar.bz2
# tar jxvf libart_lgpl-2.3.17.tar.bz2 -C ../software/
# cd ../software/libart_lgpl-2.3.17/
#./configure --disable-shared --prefix=/usr/local/rrdtool/lb
#make
#make install
安装intltool
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/intltool-0.40.6.tar.bz2
# tar jxvf intltool-0.40.6.tar.bz2 -C ../software/
# cd ../software/intltool-0.40.6/
#./configure
#make
#make install
编译过程会报这个错:checking for XML::Parser... configure: error: XML::Parser perl module is required for intltool
安装perl-XML-Parser
# cd /usr/local/src/tarbag
# wget http://d3.766.com/766down/XML-Parser-2.34.tar.gz
# tar zxvf XML-Parser-2.34.tar.gz -C ../software/
# cd ../software/XML-Parser-2.34/
# perl Makefile.PL
# make
# make install
安装完XML-Parser再回去重编译intltool
# cd /usr/local/src/software/intltool-0.40.6/
#./configure
# make
# make install
安装rrdtool
# cd /usr/local/src/tarbag
# tar zxvf rrdtool-1.4.3.tar.gz -C ../software/
# cd ../software/rrdtool-1.4.3/
#./configure --prefix=/uar/local/rrdtool --disable-tcl
configure: error: Please fix the library issues listed above and try again.
wget http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/libs/cgilib-0.5.tar.gz
tar zxvf cgilib-0.5.tar.gz
cd cgilib-0.5
make
cp libcgi.a /usr/local/lib
cp cgi.h /usr/include
cd rrdtool-1.2.6
./configure
这样一般就可以了,如果还出现上面 try again 那个错误,尝试下面的几个方法
1. configure: error: Please fix the library issues listed above and try again.
安装libart_lgpl-devel这个包
rpm 包或者源码包都可以
如果仍然报错
configure: error: Please fix the library issues listed above and try again.
无语了,有可能是找不到FreeType
把/usr/local/freetype2/lib/pkgconfig下的.pc文件拷贝到/usr/lib/pkgconfig下即可
还不行?就把这两个包装上 pango-devel cairo-devel
# make
# make install
安装Cgilib
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/cgilib-0.5.tar.gz
# tar zxvf cgilib-0.5.tar.gz -C ../software
# cd ../software/cgilib-0.5/
# make
# cp libcgi.a /usr/lib
# cp cgi.h /usr/include
安装libgd
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/gd-2.0.33.tar.gz
# tar zxvf gd-2.0.33.tar.gz -C ../software/
# cd ../software/gd-2.0.33
# ./configure --prefix=/usr/local/libgd
# make
# make install
安装pcap库
#cd /usr/local/src/tarbag
Yum install libpcap* (有问题.装源码包)
安装Ntop
# cd /usr/local/src/tarbag/
# wget http://d3.766.com/766down/ntop-3.2.tgz
# tar zxvf ntop-3.2.tgz -C ../software/
# cd ../software/ntop-3.2
# ./configure --prefix=/usr/local/ntop --with-gd-root=/usr/local/libgd/ --with-gd-lib=/usr/local/libgd/lib/ --with-gd-include=/usr/local/libgd/include/
# make
# make install
# cp packages/RedHat/ntop.conf.sample /usr/local/ntop/etc/ntop.conf
# useradd ntop
# chown -R ntop:ntop /usr/local/ntop/
修改配置文件
#cp packages/RedHat/ntop.conf.sample /usr/local/ntop/etc/ntop/ntop.conf
#vi /usr/local/ntop/etc/ntop.conf
--interface eth0,lo //#eth0 是我的单块网卡 lo是回路
--local-subnets 192.168.10.0/24 //#由于我只是一台机器所以下面的没加,如果您是在路由器或网关上请把对应的ip段改成自己的
--http-server 3000 //运行端口
--db-file-path /usr/local/ntop/var/log //数据库存放路径
--daemon //守护进程方式运行
--user ntop //用户名
--trace-level 3 //默认运行等级
--disable-schedyield //跳过所有错误
NTop第一次启动
第一次运行说明:第一次启动前用下面的命令设置一个管理密码,以后web页面设置的时候用得到。用户名默认admin,密码就是下面的命令设置的。
#/usr/bin/ntop -P -u -A
-P [directory]指定数据库存放路径
-u [user]指定service启动user
-A 设定admin密码,ntop会内建admin管理者帐号于ntop中
如:
# /usr/local/ntop/bin/ntop -P /usr/local/ntop/var/log/ -u ntop -A
Fri Nov 13 14:36:23 2009 NOTE: Interface merge enabled by default
Fri Nov 13 14:36:23 2009 Initializing gdbm databases
ntop startup - waiting for user response!
Please enter the password for the admin user: admin
Please enter the password again: admin
Fri Nov 13 14:37:09 2009 Admin user password has been set
以上操作ntop初始化就完成了。
启动运行
#/usr/local/ntop/bin/ntop -P /usr/local/ntop/var/log/ -u ntop &
或加入启动脚本(若找不到网络设备可用 -i eth0 项指定!)
# echo "/usr/local/ntop/bin/ntop -P /usr/local/ntop/var/log/ -u ntop &" >>/etc/rc.d/rc.local
浏览
WEB简单说明(版本不同略有差异):
①About在线手册
②Summary:目前网络的整体概况。
— Traffic:流量。
— Hosts:所有主机的使用概况。
— Network Load:各时段的网络负载。
— Netflows:网络流量图。
③IP Summary:各主机的流量状况与排名明细。
— Traffic:所有主机的流量明细。
— Multicast:多点传送情况。
— Domain:域名。
— Distribution:通信量状况。
— Local >>Local:本地流量。
— Local>>Remote:所有主机对外的明细。
— Remote>>Local:远程主机到本地流量。
— Remote>>Remote:远程主机到远程主机流量。
④All Protocols:查看各主机占用的频宽与各时段网络使用者等的明细。
— Traffic:流量。
— Throughput:频宽使用明细表(点选主机,可以看到该主机详细的信息及使用状况)。
— Activity:各时段所有主机使用流量状况(点选主机,可以看到该主机详细的信息及使用状况)。
⑤Local IP:局域网络内各主机使用状况。
— Routers:路由器状况。
— Ports Used:端口使用情况。
— Active TCP Sessions:目前正在进行的联机。
— Host Fingerprint:主机快照情况。
— Host Characterization:主机描述。
— Local Matrix:局域网络内各主机间的流量明细。
⑥FC:光纤网络的状况。
⑦SCSI:SCSI设备状况。
⑧Admin:新增NTOP使用者或重新启动,停止NTOP。