第二章 NS2简介与系统安装_第1页
第二章 NS2简介与系统安装_第2页
第二章 NS2简介与系统安装_第3页
第二章 NS2简介与系统安装_第4页
第二章 NS2简介与系统安装_第5页
已阅读5页,还剩41页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第二讲 NS2简介与系统安装,邱静怡,简介,由于发展通讯协议与网络算法,需要许多的设备来进行实作,但实作或撰写出来的程序,不一定是成功且不易BUG,如此将花费相当可观的成本。 将自己所提出的网络协议方法或算法以仿真的方式先前进行模拟与测试,且当测试结果都完整后,再将方法实作出来,将会节省很多不必要的成本与时间。,NS2简介-背景,NS2,是Network Simulator - Version 2 的简写。 在1989 年首先由 REAL Network Simulator 改版而来。 1995年,当时由 VINT Project 这个团体所维护,现在由 SAMAN

2、 和 CONSER 负责 。,NS2简介-背景 (Cont.),支持网络协议的教育研究 通讯协议的设计、数据流的研究等 不同通讯协议间的比较 优点 免费与作业平台无关,有支持大量通讯协议、代码以及模型可供使用,不同的协议之间容易进行比較。,NS2简介-功能,有线网络 网络层:DV, LS, PIM-SM。 传输层:TCP 、SCTP and UDP。 应用层:FTP, SIP, CBR, stochastic。 排队模型:Drop-tail, RED, FQ, SFQ。 QoS:MPLS、IntServ and Diffserv。 无线网络 网络类型:MANET, Sensor Network

3、s 路由方式:AODV, DSR, DSDV,Mobile IP等等。 链接层:802.11, 802.16, 802.15.4,Smac等,NS2简介-架构,NS2是一个是件驱动的仿真软件。 事件驱动指两节点间通讯协议传输过程的事件,例如:在1.0秒的时候开始进行FTP数据的传输,2.0秒时结束传输。 注:仿真器中的秒不等于现实中的秒。 把世界上的一切都看成事件 维护一个基于发生时间排序的事件(events)排列 维护一个系统的时间virtual time CPU 执行的快慢不影响结果。,NS2简介-架构(Cont.),使用C+与OTCL撰写而来。 C+: 处理封包传送 更改一些底层协议或新

4、增Protocols之类的C+ Class 不常更动,执行速度快。 OTCL 负责设定档部分 运作已编译过的C+ Objects 常会更动,执行时需花一点直译时间,NS2简介-架构(Cont.),NS2简介-组件,ns: 网络模拟器 执行tcl脚本,进行模拟,并将所有的模拟结果以trace档案的格式输出。 nam: 网络 AniMator 将ns的结果可视化。,NS2简介-操作流程,NS2简介- 与OPNET 的比较,12,NS2简介- 与OPNET 的比较(Cont.),OPNET 的使用界面,Reference,REAL Network Simulator: http:/www.cs.co

5、/skeshav/real/overview.html VINT Project: /nsnam/vint/index.html SAMAN: /saman/index.html CONSER /conser/index.html The Network Simulator - ns-2 /nsnam/ns/ NS2 supported protocol /nsnam/ns/ns-tests.html NS2

6、 Manual /nsnam/ns/doc/index.html NS2 by Example /NS/ OTCL /research/cmt/cmtdoc/otcl/,Reference (Cont.),Network Simulator 学习网站 .tw/ns2/ns2_website/ NS2 教学手册 ( NS2 Learning Guide) 0/smallko/ns2/ns2.htm

7、Trace graph 华玄明因特网实验室 创新智能信息系统实验室 .tw/wordpress/?p=66 阿贵的Gnuplot .tw/ckhung/b/ma/gnuplot.php,NS2简介- TCP&OSI对应,NS2 和 TCP/IP、OSI 7-Layer 的对应关系,NS2简介-支持的通讯协议,17,NS2安装,Install Cygwin,Download the software from here. Decompress the rar file. You will see a set

8、up.exe. Click this file. It will be like the following figure.,Because the language of operating system is Traditional Chinese. The text of button is shown in Chinese. But you dont need to worry about this. I think it is shown in English in your computer. Just click “Next “.,Then choose “Install fro

9、m Local Directory”,Click “Next”.,Click “Next”.,Click “Browse” to choose where the software is. (Please choose “ftp%3a%2f%2.tw%2fWindows%2fcygwin”),Click “OK”.,Click “Next” and you will see the figure shown as follows. In this window, the cygwin setup program let you choose what software

10、 you want to install.,Click “View” first to make the word “Category “change to “Full”. XFree86-base, XFree86-bin, XFree86-prog, XFree86-lib, XFree86-etc, make, patch, perl, gcc, gcc-g+, gawk, gnuplot, tar and gzip must be chosen. For example, if I want to install XFree-86 base (upper figure), click

11、the “Skip” of “New” column. The “Skip” will be changed to “4.3.0-1” (lower figure).,Click “Next”.,When setup is done, it will be shown as following figure. Click “Finish”.,Click the icon on the desktop. For the first time execution, it will generate some environment parameter setting files. In this

12、example, smallko is my login name to windows system. Therefore, the cygwin will create a folder named “smallko” under home directory. (The actual path for smallko folder is: c:cygwinhomesmallko) It should be noticed that the login name can not have any space in your name. For example, “A B” may caus

13、e errors when you install NS2. (smallko-hpds is my computer name),Install NS2,Please copy ns-allinone-2.29.rar into your director. Then decompress the compressed file. typing “cd ns-allinone-2.29”. Then type “./install”.,Please type “y” to continue.,NS2 is installed in your windows. But before you s

14、tart running NS2 simulation, you should set the path first. I have prepared one file for it. Just copy the “.bashrc” to replace the one under your home directory. (In this example, I copy .bashrc to c:cygwinhomesmallko),Testing,To initial graphical mode. ( type “startxwin.bat”),Run the example tcl s

15、cript. (Change to /ns-allinone-2.29/ns-2.29/ns-tutorial/examples. Then run the command “ns example2.tcl),If you can see the following figures, congratulations. You have successfully install cygwin + ns-2.29 under windows platform.,TCL语言介绍,TCL語言簡介,TCL(Tool Command Language) 安装文字编辑器PSPad,变量和变量替換,1. se

16、t foo “john” puts “my name is $foo”,2 set foo puts hi eval $foo,表示式及指令替換,1. set value expr 0=1 puts $value,2. set value expr 2+3 puts $value,3. puts I am expr 10 * 2 years old, and my I.Q. is expr 100 - 25,流程控制,set num_legs 4 switch $num_legs 2 puts It could be a human. 4 puts It could be a cow. 6 p

17、uts It could be an ant. 8 puts It could be a spider. default puts It could be anything. ,流程控制cont.,set i 0 while $i 5 puts In the while loop, and i = $i incr i 1,In the while loop, and I =0In the while loop, and I =1In the while loop, and I =2In the while loop, and I =3In the while loop, and I =4,程序

18、,procsum_proc a b return expr $a + $b procmagnitudenum if $num 0 return $num set num expr $num * (-1) return $num set num1 12 set num2 14 set sum sum_proc $num1 $num2 puts The sum is $sum puts The magnitude of 3 is magnitude 3 puts The magnitude of -2 is magnitude -2,The sum is 26The magnitude of 3 is 3The magnitude of -2 is 2,程序cont.,procdumb_proc set myvar 4 puts The value of thelocal variableis $myvar global myglobalvar puts The value of the global variable is $myglobalvar“ set myglobalvar 79 dumb_proc,The value of local variable is 4The value of t

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论