学 号: 题目类型: 桂林理工大学
GUILIN UNIVERSITY OF TECHNOLOGY
本科毕业设计(论文)
题目: 基于NS2的AODV协议仿真
学 院: 信息科学与工程学院 专业(方向): 班 级: 学 生: 指导教师:
2013年 5 月 25日
桂林理工大学本科毕业设计·论文
摘 要
Ad hoc网络是一种能随时随地组成网络而不依赖任何网络基础设备支持的自组网。因此得到越来越广泛的应用。由于Ad hoc网络拓扑是动态变化的,具有无中心网络的自组织性,受移动终端的局限性等因素的影响,Ad hoc网络的路由协议一直是Ad hoc网络领域的研究热点。
AODV协议是Ad hoc网络中的自组织按需距离向量协议,是应用最广泛的按需路由协议之一。本文首先介绍了Ad hoc网络的特点、应用领域、路由协议等,特别是对AODV的工作机制与特点进行了详细阐述。然后介绍了相关的准备工作,包括NS2平台在Linux下的安装和使用,NS2的特点、工作机制及相关工具。接着介绍了用NS2对AODV进行仿真的场景规划及相应TCL编码,产生了NAM动画演示文件和数据记录trace文件。最后根据仿真生成的trace文件,分析了场景中节点的数量及移动性对AODV的网络传输时延、丢包率这两个重要网络性能参数的影响,初步得出AODV协议适用于中小型网络环境的结论。
关键词: Ad hoc网络;AODV;NS2;传输时延;丢包率
I
桂林理工大学本科毕业设计·论文
Simulation Of AODV Protocol Based On NS2
Abstract: Ad hoc network is a network composed of anytime, anywhere without relying on any network infrastructure to support the ad hoc network. So get more and more widely used. Since Ad hoc network topology is dynamic, with no central network self-organization, affect by the limitations of mobile terminals and other factors, Ad hoc network routing protocol has been a hot research field of Ad hoc networks.
AODV protocol in Ad hoc networks are self-organizing on-demand distance vector protocol that is most widely used on-demand routing protocols. This paper first introduces characteristics, applications, routing protocols of the Ad hoc network, especially for the working mechanism of AODV and features are elaborated. Then introduce the relevant preparatory work, including the installation and use of NS2 platform under Linux, NS2 characteristics, working mechanism and related tools. Then introduced using NS2 for AODV simulation scenario planning and the corresponding TCL code, resulting in a NAM animation files and data logging tr0ace files. Finally, according to the trace files generated simulation, analysis of the number of nodes in the scene and mobility on AODV network transmission delay, packet loss ratio of these two important network performance parameters, preliminary draw AODV protocol for small and medium network environment conclusion.
Key words: Ad hoc network;AODV;NS2;packet loss ratio;network delay
II
桂林理工大学本科毕业设计·论文
目 次
摘 要 .............................................................................................................................. I Abstract .............................................................................................................................. II
1 绪论 .................................................................................................................................. 1
1.1 研究背景 ................................................................................................................. 1 1.2 选题领域的研究成果 ............................................................................................. 1 1.3 课题研究目标 ......................................................................................................... 2 2 Ad hoc网络概述 ............................................................................................................... 3
2.1 Ad hoc网络介绍 ...................................................................................................... 3 2.2 Ad hoc应用领域 ...................................................................................................... 3 2.3 Ad hoc路由协议 ...................................................................................................... 4 2.4 AODV路由协议 ....................................................................................................... 5 2.5 AODV路由算法 ....................................................................................................... 6 2.6 AODV工作过程与路由特点 .................................................................................... 6 2.7 本章小结 ................................................................................................................. 8 3 NS2网络仿真 ................................................................................................................... 9
3.1 NS2仿真工具 .......................................................................................................... 9 3.2 OPENET与NS2的比较 ........................................................................................... 9 3.3 NS2安装 ................................................................................................................ 11 3.4 NS2仿真 ................................................................................................................ 12 3.5 GAWK的介绍 ......................................................................................................... 13 3.6 Gnuplot介绍 .......................................................................................................... 13 3.7 本章小结 ............................................................................................................... 13 4 基于NS2的AODV协议仿真 ...................................................................................... 14
4.1 仿真环境场景的配置 ........................................................................................... 14 4.2 AODV协议场景代码的编写 .................................................................................. 15 4.3 AODV协议仿真 ..................................................................................................... 18 4.4 本章总结 ............................................................................................................... 21 5 AODV协议的性能分析 ................................................................................................. 22
5.1 性能参数 ............................................................................................................... 22
III
桂林理工大学本科毕业设计·论文
5.2 参数分析 ............................................................................................................... 23
5.2.1 网络延迟的数据提取 ................................................................................. 23 5.2.2 丢包率的数据提取 ..................................................................................... 24 5.2.3 数据平均值的计算 ..................................................................................... 25 5.3 仿真节点对AODV协议的影响分析 .................................................................... 26
5.3.1 仿真节点的变化对网络传输延时的影响 ................................................. 26 5.3.2 仿真节点的变化对网络丢包率的影响 ..................................................... 27 5.4 仿真区域大小对AODV协议的影响分析 ............................................................ 28
5.4.1 仿真区域大小变化对网络传输延时的影响.............................................. 28 5.4.2 仿真区域大小变化对网络丢包率的影响 ................................................. 28 5.5 本章小结 ............................................................................................................... 29 6 结论 ................................................................................................................................ 30
致谢 .................................................................................................... 错误!未定义书签。 参考文献 ............................................................................................ 错误!未定义书签。
IV