ns2仿真步骤与新协议添加课件_第1页
ns2仿真步骤与新协议添加课件_第2页
ns2仿真步骤与新协议添加课件_第3页
ns2仿真步骤与新协议添加课件_第4页
ns2仿真步骤与新协议添加课件_第5页
已阅读5页,还剩36页未读 继续免费阅读

下载本文档

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

文档简介

NS2网络仿真平台李春明2008-12-08.1IntroductiontoNS-2NS2网络仿真软件概述创建基本的仿真网络一个完整的仿真例程模型说明运行和结果分析高级主题如何添加新协议.2NS-2,网络仿真器是一个具有10+年历史的科研项目成果开源、可自由分发目前主要由ISI(InformationSciencesInstitute)维护隶属DARPA+NSF项目目前,代码约~200K,手册约400页具有大量的用户主要是学术界人士是网络研究领域的事实标准主页:/nsnam/ns.3NS功能特性它是一个离散事件驱动型仿真器提供如下网络模拟组件流量模型和应用层程序Web,FTP,telnet,audio,sensornets传输层协议TCP(Reno,SACK,etc),UDP,multicast路由协议和队列管理staticrouting,DVrouting,multicast,ad-hocroutingqueueingdisciplines:drop-tail,RED,FQ链路层协议wired,wireless,satellite提供的辅助工具tracing,visualization,errormodels,etcmodifyorcreateyourownmodules.4NS2组件NS,仿真器本身NAM,可视化界面工具visualizeNS(orother)outputGUIinputsimpleNsscenarios辅助工具:trafficandtopologygenerators结果处理:simpletraceanalysis,ofteninAwk,Perl,orTclTutorial:/nsnam/ns/tutorialNSbyexample:/NS/.5NS体现架构:C++andOTCL主要采用两种语言C++实现NS仿真器的功能如数据包处理、路由算法实现等优点:运行速度快,效率高OTCL用来编写脚本,完成具体仿真[ourfocus]如建立仿真场景、参数修改配置等优点:易于编写和修改.6仿真步骤编写OTCL脚本nodes,links,trafficsources,sinks,等.确定各个对象的参数Links:queuesizes,linkspeeds,…TransportProtocols:TCPflavorandparameters(morethan30),…运行脚本,收集数据dumpeverythingtotrace,postprocessitgatherstatsduringsimulationwithinOTCLscriptmodifyNssourcecode重复多次运行NSconfidenceintervals.7创建一个基本的仿真场景CreateeventschedulerCreatenodesandlinksCreateconnectionsCreatetrafficsources/sinksEnabletracing.8CreateaBasicNSSimulationCreatetheeventschedulerCreatenodesandlinksCreateconnectionsCreatetrafficsources/sinksEnabletracing.9Step1:CreatingEventSchedulerCreateschedulersetns[newSimulator]Scheduleevent$nsat<time><event><event>:anylegitimateNs/TCLcommandsStartscheduler$nsrun.10CreateaBasicNSSimulationCreatetheeventschedulerCreatenodesandlinksCreateconnectionsCreatetrafficsources/sinksEnabletracing.11Step2:CreatingNetwork(Nodes+Links)Nodessetn0[$nsnode]setn1[$nsnode]Links:connecttogethertwonodes$nsduplex-link$n0$n1<bandwidth><delay><queue_type><delay>determinespropagationdelay<queue_type>determinesqueueingpolicyDropTail,RED,CBQ,FQ,SFQ,DRR.12CreateaBasicNSSimulationCreatetheeventschedulerCreatenodesandlinksCreateconnectionsCreatetrafficsources/sinksEnabletracing.13Step3:CreateConnectionsTransports:TCP,UDP,multicast,etc.transportprotocolinstancesattachtonodes.14CreatingTransportChannels:UDPsourceandsinksetu_src[newAgent/UDP]setu_dst[newAgent/NULL]attachthemtonodes,thenconnecttoeachother$nsattach-agent$n0$u_src$nsattach-agent$n1$u_dst$nsconnect$u_src$u_dst.15CreatingTransportChannels:TCPsourceandsinksett_src[newAgent/TCP/Newreno]sett_dst[newAgent/TCPSink]attachtonodesandeachother$nsattach-agent$n0$t_src$nsattach-agent$n1$t_dst$nsconnect$t_src$t_dst.16CreateaBasicNSSimulationCreatetheeventschedulerCreatenodesandlinksCreateconnectionsCreatetrafficsources/sinksEnabletracing.17Step4:CreateTrafficModelsTraffic(applications):Web,ftp,telnet,audio,etc.applicationobjectsattachtotransportprotocolobjectsgeneratestrafficintotransportprotocol.18CreatingTrafficoverTCPChannelsHowtocreateaFTPsessionoverTCP?createtrafficmodelsetftp[newApplication/FTP]defaultis“infinite”filesizeattachtoTCPchannel$ftpattach-agent$t_srcschedulestarttime$nsat<time>“$ftpstart”.19CreatingTrafficoverUDPChannelsHowtocreateaCBR(ConstantBitRate)modeloverUDP?setcbr[newApplication/Traffic/CBR]$cbrsetpacketSize_512$cbrsetinterval_0.250$cbrattach-agent$u_src$nsat<time>“$cbrstart”.20CreateaBasicNSSimulationCreatetheeventschedulerCreatenodesandlinksCreateconnectionsCreatetrafficsources/sinksEnabletracing.21Step5:dumpeverythingintoatracefileOpenatracefile(defaultout.tr)andrecordtheinfoyouwanttotrace

setnd[openout.trw]$nstrace-all$nd.22TracepacketsonindividuallinksTracefileformat:<event><time><from><to><pkt><size>--<flowid><src><dst><seqno><aseqno>+102tcp900-------10.03.1715-102tcp900-------10.03.1715r1.0023402tcp900-------10.03.1715+enqueue

dequeuerreceiveddroptimenodesinvolvedinthiseventpackettypepacketlengthpacketflagsflowIDsourcedestaddressesseqnumberpacketIDTracing:dumpeverythingintoafile.23IntroductiontoNS-2:NS2网络仿真软件概述创建基本的NS2仿真场景一个完整的例子模型说明运行和结果分析高级主题如何添加新协议.24一个完整的例子acksfullduplexacksfullduplexNode2Node0Node1.25一个完整的例子2FTPsourcesOneOn-OffSource(voice)acks12TCPdestOneOn-OffdestOneCBRdest2Mbpsfullduplex5msecpropdelay100packetbufferDrop-tailpolicyacks1Mbpsfullduplex10msecpropdelay700packetbufferDrop-tailpolicy10FTPsourcesOneUDP2TCPSACKW_max=32MSS=140010TCPNewRenoW_max=32MSS=1400Node0Node1Node2OneUDPOneCBRsource12FTPdestTwoUDPdestfatlinkthinlinkperformancetracing.26NSTracefile(linkn1->n2):

NS-trace.txt...+11.53344112tcp1440-------121.22.4962092r11.53569412tcp1440-------121.22.4651527-11.53721412exp180-------1000.22.132841528-11.53865412cbr1440-------1011.112.141551530r11.54721412tcp1440-------121.22.4661529+11.5472812tcp1440-------121.22.4972095r11.54865412exp180-------1000.22.132841528+11.5512cbr1440-------1011.112.142112096-11.55017412tcp1440-------121.22.4671534r11.56017412cbr1440-------1011.112.141551530-11.56169412exp180-------1000.22.132851532+11.5622212tcp1440-------121.22.4982097-11.56313412tcp1440-------121.22.4681537r11.57169412tcp1440-------121.22.4671534r11.57313412exp180-------1000.22.132851532-11.57465412exp180-------1000.22.132861536...0.0114sec=180*8/(10^6)+0.01.27FlowMonitor(linkn1->n2)Trace:

packet-trace.txt...103561394.693963512362412629060473010.53671575.387577739350313259580815701100113661759.834006166616113841018081570110011.53701944.0583990191849144810780815701100123802131.71086371380415121132081570110012.53822325.178644727122155811760815701100133822516.761545447012416131231081570110013.53952710.8647514290892167612810815702310144212912.34621869907511747132601631150231014.54323130.385842319376918051373016311502310154363344.5896974377333186214260

1631150

2310

15.54623571.381118231159719371475016311502310164773804.6531596587571995151801631150231016.54954049.592932656351920571562016311502310175314303.921177137932321361605016311502310....28.trfileprocessingGawkGnuplot,Xgraph.29Results-FlowStatisticsCongestionWindowsofFlow1andFlow2CumulativedroppedpacketsofFlow1andFlow2Red-TCPflow1Green-TCPflow2.30PerformanceQueueStatistics多次运行取平均值.31IntroductiontoNS-2:NS2网络仿真软件概述创建基本的NS2仿真场景一个完整的例子模型说明运行和结果分析高级主题如何添加新协议.32高级主题Otlc和C+

温馨提示

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

评论

0/150

提交评论