设为首页 收藏本站
查看: 1130|回复: 0

[经验分享] Use NTOP's sflow monitor Enterprise traffic

[复制链接]

尚未签到

发表于 2019-1-26 11:02:18 | 显示全部楼层 |阅读模式
  前言
  

  Ntop是一个基于libpcap开发的流量分析和flow收集系统,遵守GPLv3版本分为pro与community版本,其中community为免费版,它的功能如下:
  .根据网络流量的使用状况来排序协议。
  .查看网络流量和IPv4/v6的活动主机。
  .数据以RRD格式存储在磁盘并可持续流量统计。
  .通过利用由谷歌和HTTP Blacklist提供黑名单服务的分析HTTP流量。
  .显示各种协议的IP流量分布。
  .分析IP流量并按照源/目的排序。
  .显示IP子网流量矩阵
  .报告IP协议使用排序按协议类型。
  .生成HTML5/AJAX网络流量统计报告。
  

  我们主要使用ISO 多层协议分析与sflow功能。
  
  1.版本信息
  plat
info

  centos
6.4

  Ntopng&nprobe
2.0

  2.部署信息
  2.1 查看系统信息
  [root@ntopng~]# lsb_release -a
  LSB Version:   :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
  Distributor ID: CentOS
  Description:    CentOS release 6.4 (Final)
  Release:        6.4
  Codename:       Final
  2.2 安装epel扩展库
  [root@ntopng ~]# mkdir code
  [root@ntopng ~]# cd code/
  [root@ntopng code]# wgethttp://mirrors.opencas.cn/epel//6/x86_64/epel-release-6-8.noarch.rpm
  [root@ntopng code]# rpm -ivh epel-release-6-8.noarch.rpm
  warning: epel-release-6-8.noarch.rpm:Header V3 DSA signature: NOKEY, key ID 217521f6
  Preparing...               ########################################### [100%]
  1:epel-release          ########################################### [100%]
  [root@ntopng code]#yum --disablerepo=epel–y update ca–certificates
  [root@ntopng src]# yum list
  [root@ntopng ~]# yum install -y ntp
  [root@ntopng ~]# ntpdate time.windows.com
  13 Jul 12:01:32 ntpdate[2148]: step timeserver 104.41.150.68 offset 104.068333 sec
  [root@ntopng ~]# hwclock –w
  2.3 安装ntopng的依赖包
  [root@ntopng ~]# yum install -y GeoIP-devel GeoIP redis
  [root@ntopng ~]# yum install -ylibpcap-devel glib2-devel glibc libxml2-devel redis autoconf automake sqlite-devel numactl
  [root@ntopng ~]# yum install -y rrdtool* gcc gcc-c++
  [root@ntopng ~]# service redis start
  Starting redis-server:                                     [确定]
  

  2.4安装ntopng
  自动安装
  This directory contains nightly builds (SVNcode) of 64 bit binary packages for RedHat/CentOS (latest OS version). Pleaseuse rpm-stable.ntop.org for stable builds.
  In order to use the repository you need tocreate a file named /etc/yum.repos.d/ntop.repo containing
  # cat /etc/yum.repos.d/ntop.repo
  [ntop]
  name=ntop packages
  baseurl=http://www.nmon.net/centos/$releasever/$basearch/
  enabled=1
  gpgcheck=1
  gpgkey=http://www.nmon.net/centos/RPM-GPG-KEY-deri
  [ntop-noarch]
  name=ntop packages
  baseurl=http://www.nmon.net/centos/$releasever/noarch/
  enabled=1
  gpgcheck=1
  gpgkey=http://www.nmon.net/centos/RPM-GPG-KEY-deri
  and also install the/etc/yum.repos.d/epel.repo extra repositories
  # cat /etc/yum.repos.d/epel.repo
  [epel]
  name=Extra Packages for Enterprise Linux X- $basearch
  mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-X&arch=$basearch
  failovermethod=priority
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-X
  Note: replace X with 6 (for CentOS 6) or 7(for CentOS 7) then do:
  yum clean all
  yum update
  yum install pfring n2disk nprobe ntopngntopng-data nbox
  手工安装
  离线安装:
  RPM格式
  网站:http://www.nmon.net/packages/rpm/x86_64/
wget http://www.nmon.net/packages/Packages/ntopng-2.0.150630-216.x86_64.rpm
wget http://www.nmon.net/packages/Packages/ntopng-data-2.0.150630-216.noarch.rpm

源代码格式:
  网站:http://sourceforge.net/projects/ntop/files/ntopng/
  tar -zxvf ntopng-2.0.tar.gz
  在线安装:使用流行的github.com作为源
  nDPI
  git clone https://github.com/ntop/nDPI.git
  cd nDPI
  ./configure –with-pic
  make
  git clonehttps://github.com/ntop/ntopng.git
  cd ntopng
  ./autogen.sh
  ./configure
  make
  make install
  -------------------
  2.5 ntopng 配置详解
  需要添加配置文件
  [root@ntopng]#mkdir –p /etc/ntopng/
  [root@ntopng]#vi  /etc/ntopng/ntopng.conf
  ntopng.conf是ntopng启动时需要的配置文件。下面我们来查看一下具体文件,
  [root@ntopng ntopng]# vi ntopng.conf
  -G=/var/tmp/ntopng.gid        #-G指定运行所用进程号文件。
  --local-networks 192.168.60.0/22  #--local-network指定本地子网段
  --interface eth0               #--interface 0 指定监听eth0网卡上的流量
  --user nobody                #匿名登陆,可选
  --http-port 8000              #指定web服务端口,如果不指定默认为3000
  2.6启动ntopng服务
  在运行ntopng之前,要确认先启动redis服务,redis为ntopng提供键值存储。我们这边重新启动一下redis服务。
  [root@ntopng ntopng]# service redis restart
  Stopping redis-server:                                     [确定]
  Starting redis-server:                                     [确定]
  [root@ntopng ntopng]# /usr/local/bin/ntopng /etc/ntopng/ntopng.conf
  [root@ntopng ntopng]# netstat -ntulp
  Active Internet connections (onlyservers)
  Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
  tcp       0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      2069/redis-server
  tcp       0      0 0.0.0.0:779                 0.0.0.0:*                   LISTEN      2717/rpc.statd
  tcp       0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2674/portmap
  tcp       0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      3013/sshd
  tcp       0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      3026/cupsd
  tcp       0      0 0.0.0.0:8000                0.0.0.0:*                   LISTEN      3084/ntopng
  tcp       0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      3051/sendmail
  tcp       0      0 :::22                       :::*                        LISTEN      3013/sshd
  2.7.正常访问
  (1).http://192.168.60.4:8000,默认的用户名和密码是admin。
  现在为普通流量监控模式,将需要的监控的端口镜像给ntopng。
  2.7.1 活动的流
  BOGON,表示不应该出现在公共网络中的私有IP资源,特指10.0.0.0/8、172.16-31.0.0/16、192.168.0.0/24
  其实我们可以检测到所有网内主机的通信流,使用的IP地址,对端IP,端口号,协议,持续时间,速率等。

  2.7.2 检测到的主机

  2.7.3 自治系统
  网络中IP地址涉及到的Internet AS区域,依据NTOP检测到的ip匹配GeoIP离线数据库的结果。

  2.7.4 主机国别归属

  2.7.5 网内主机关联图

  2.7.6 主机相关信息

  2.7.7协议分析状态

  3.配置sflow
  DataCollector (ntopng)   
   ntopng -i tcp://127.0.0.1:5556
   Probe (nProbe)      
  nprobe--zmq "tcp://*:5556" -i eth1 -n none (probe mode)     
  nprobe--zmq "tcp://*:5556" -i none -n none --collector-port 2055(sFlow/NetFlow collector mode)
  [root@ntopng ntopng]# ntopng -i tcp://127.0.0.1:5556 -d /var/tmp -w 8000
  [root@ntopng nprobe]# nprobe --collector-port 6343 --zmq tcp://127.0.0.1:5556
  Cisco device:
  (config)#sflow enable
  (config)#sflow destination 192.168.6.106343
  (config)#sflow polling-interval 1
  (config)#sflow sample 10240
  (config)#interface ethernet 1/6
  (config-if-e1000-1/6)#sflow forwarding
  H3C device:
   system-view
  [Device] interface vlan-interface 1
  [Device-Vlan-interface1] ip address 192.168.6.254 24
  [Device-Vlan-interface1] quit
  [Device] sflow agent ip 192.168.6.254
  [Device] sflow collector ip 192.168.6.10 port 6343
  [Device] sflow interval 30
  [Device] interface gigabitethernet2/0/1
  [Device-GigabitEthernet2/0/1] sflow enable inbound
  [Device-GigabitEthernet2/0/1] sflow enable outbound
  [Device-GigabitEthernet2/0/1] sflow sampling-rate 100000
  [Device-GigabitEthernet2/0/1] sflow sampling-mode random
  [Device-GigabitEthernet2/0/1] display sflow
  sFlow Version: 5
  sFlow Global Information:
  Agent                   IP:192.168.6.254
  Collector               IP:192.168.6.10  Port:6343
  Interval(s): 30
  sFlow Port Information:
  Interface    Direction       Rate         Mode      Status
  GE2/0/1       In/Out          100000       Random    Active
  


  以上为NTOP的普通模式与使用sflow分析网络的部署全过程,希望对需要的friends有所帮助。
  sflow对于网络分析是非常重要的技术之一。




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-667729-1-1.html 上篇帖子: 运用Ntop监控网络流量(视频Demo) 下篇帖子: 安装ntop时错误的解决
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表