059
PERL基于NetFlow的流量分析系统样本
(样本只提供该系统的基本情况介绍,若需要完整的设计和论文,建议您购买本系统,凡是购买本站系统的,本站均根据您的要求,把系统上的开发信息,题目等修改成符合您的要求)
本设计包含内容:源代码+毕业论文
论文大概:
基于NetFlow的流量分析系统
摘要:考虑到CISCO公司的网络设备在企业的广泛应用与Netflow技术的简单高效性,以及企业的对流量分析、管理与记费等要求,本文对基于netflow技术的流量分析系统作了较为详细的介绍,本文针对利用Netflow技术可记录通过网络边界路由器上IP流的数据包信息,因此利用此技术来实现对这些流量信息的分析,为网络管理、规划、记账等提供依据。本文首先介绍了与本系统相关的不同技术,通过对比说明了用此技术实现本系统和本系统的功能的优点,随后系统的介绍了系统的设计方法及过程,同时通过对部分主要源代码的阐述,详细的说明了利用Perl语言实现本系统的过程。最后针对本系统现有的缺陷以及不足,进一步阐明了下一步的工作。
关键词:Net
Flow, 流量分析 , 网络管理 , Perl程序设计
Flow Analysis System Based on Net Flow
【Abstract】:Considers
to the CISCO Corporation's network equipment is wide applied in
enterprise's and Netflow technology simple effectiveness,As well as
enterprise's flow analysis, the management and billing and so on the
request, this article to has made a more detailed introduction flow
analysis system based on the netflow technology ,and the article in
view of can record the information of packet using the Netflow
technology which IP flows through the border router on, therefore
uses this technology to realize to these flow information analyses,
to provide the basis for the network management , planing, billing
and so on .At first,the article introduced the correlation
technology, showed through the contrast realizes this system merit
as well as this system function with this technology and so on,
afterwards the systematic introduction system design method and the
process, at the same time through to the partial main sources code
elaboration, detailed showing have realized this system process
using the Perl language. Finally aims at this system existing flaw
as well as the insufficiency, further has expounded the next step of
work.
【key words】:NetFlow,Flow Analysis,The Network
Management,Programing of Perl
目 录
1 前言 …………………………………………………………………………………… (1)
2
相关技术概述及比较 ………………………………………………………………… (2)
2.1
网络流量的分类 ………………………………………………………………… (2)
2.1.1 网络节点端口流量 …………………………………………………………
(2)
2.1.2 端到端的IP流量
………………………………………………………… (2)
2.1.3
业务层流量 ………………………………………………………………
(2)
2.1.4 完整的用户业务数据流量
………………………………………………… (2)
3 系统分析与用户需求报告
…………………………………………………………… (3)
3.1 问题概述
………………………………………………………………………… (3)
3.2 解决途径
………………………………………………………………………… (3)
3.3 与其它技术比较
………………………………………………………………… (5)
3.4 技术介绍
………………………………………………………………………… (6)
3.4.1
Netflow服务简介 ………………………………………………………… (6)
3.4.2 Netflow的定制流程………………………………………………………… (6)
3.4.3 Netflow流量采集对路由器的影响………………………………………… (7)
4 总体设计及规划
……………………………………………………………………… (8)
4.1 技术方案与开发工具及语言的选定
…………………………………………… (8)
4.1.1
技术方案的选定 …………………………………………………………
(8)
4.1.2 开发语言及工具的选择
…………………………………………………… (8)
4.2 开发及测试平台的组成
………………………………………………………… (9)
4.3 概要设计及总体流程图
………………………………………………………… (9)
5 系统详细设计及实现过程
…………………………………………………………… (10)
5.1 系统开发与测试平台的搭建与配置
…………………………………………… (10)
5.1.1 网络拓扑结构
……………………………………………………………… (10)
5.1.2
Netflow 的具体配置 ……………………………………………………… (10)
5.2 Netflow
的数据采集 …………………………………………………………… (11)
5.3
数据存储 ……………………………………………………………………
(18)
5.4 数据分析
……………………………………………………………………… (19)
5.4.1
流量统计 …………………………………………………………………… (19)
5.4.2 流量分析 …………………………………………………………………… (21)
5.5 Web 显示
………………………………………………………………………… (22)
6 结论
……………………………………………………………………………………
(27)
致谢……………………………………………………………………………………
(27)
参考文献………………………………………………………………………………
(28)
附录…………………………………………………………………………………… (29)
1
前言
以往的因特网建设的工作重点基本是”以量为主”,随着用户对业务的要求不断提高,”量质并重”已成为当前工作的核心,因为只有这样才可以使网络的建设和发展更加科学,在众多的影响网络性能的因素中,网络流量是最为重要,它包含了用户上网的所有信息.但是一直以来,对网络流量的分析处理由于捕获网络流量非常困难而停滞不前.
然而在国外,运营商与企业由于受到来自各方面的压力和由于经济的考虑,均已大规模地开展了对网络流量的分析研究以应用.通过这些分析研究应用,运营商可以科学的估算出各种业务在网络总流量中所占的比重和各条链路上的分布,可以科学的预测链路流量和业务流量的增长规律,可以客观的评测各类用户上网的特性和对网络造成的影响,并可以预测各类用户增加时对网络可造成的影响,以指导网络建设与管理.
得出结果的如图5-2:
(图5-1)
(图5-2)
(2)查看特定主机的通信记录
输入查看主机的ip地址,其主要代码如下:
$db->sql("SELECT *
FROM traffic_info where src_ip='$ip';");
if(not
defined $db->FetchRow()){
print
"没有此主机的记录!";
}else{
&Data_header;
while ($db->FetchRow())
{
($secs,$in_index,$next_hop,$dest_ip,$out_index,$protocol,$port_num,$src_as,$dest_as,$src_encapsulation,$dest_encapsulation,$bytes,$flow)
=
$db->Data("secs","in_index","next_hop","dest_ip","out_index","protocol","port_num","src_as","dest_as","src_encapsulation","dest_encapsulation","bytes","flow");
}
所得结果如图5-3所示:
(图5-3)
5.5 Web显示
数据在Web页面中具体显示样式参见图5-1、图5-2、图5-3。
为了直观的在Web中显示各种流量的分布状况,本系统对流量数据进行部分的分析后形成了饼状图,从而可从图形直观的看出整个网络内部的通信的流量状况分布情况。其具体样式见图5-4、图5-5。
(图5-4)
(图5-5)
以上饼状图可根据网络中具体通信流量的变化而变化,它由Perl中的GD模块生成PNG格式的图片,在每次查看时根据后台的CGI程序自动更新此图片。其主要代码如下:
if(!(my
$db =new
Win32::ODBC("dsn=traffic;uid=sa;pwd=;")))
{
#建立数据接口,从流量数据库取出数据
print "Error
connecting to traffic\n";
print
"Error:".Win32::ODBC::Error()."\n";
}else{
$db->sql("SELECT sum(bytes) as sumicmp FROM traffic_info where
protocol='1';");
#取出ICMP的总计流量字节数
while ($db->FetchRow())
{
$icmpbytes =
$db->Data("sumicmp");