DOC PREVIEW
BU CS 580S - Overview

This preview shows page 1-2-16-17-18-34-35 out of 35 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Network Simulator 2: IntroductionPresented by Ke LiuDept. Of Computer ScienceSUNY BinghamtonSpring, 20061NS-2 Overviewc Ke Liu, SUNY-Binghamton, 20062NS-2• Developed by UC Berkeley• Maintained by USC• Popular simulator in scientific environment• Other popular network simulators– QualNet: based on GloMoSim– Others: GloMoSim, OPNET, etcc Ke Liu, SUNY-Binghamton, 20063NS2 Goals• To support networking research and education– Protocol design, traffic studies, etc.– Protocol comparison;– New architecture designs are also supported.• To provide collaborative environment– Freely distributed, open source;– Increase confidence in resultc Ke Liu, SUNY-Binghamton, 20064Two Languages: C++, OTclOTcl: short for MIT Object Tcl,an extension to Tcl/Tk for object-oriented programming.• Used to build the network structure and topologywhich is just the surface of your simulatoion;• Easily to configure your network parameters;• Not enough for research schemes and protocol architecture adaption.c Ke Liu, SUNY-Binghamton, 20065Two Languages (Con’t)C++: Most important and kernel part of the NS2• To implement the kernel of the architecture of the protocol designs;• From the packet flow view, the processes run on a single node;• To change or “comment out” the existing protocols running in NS2;• Details of your research scheme.c Ke Liu, SUNY-Binghamton, 20066Why 2 Languages?• 2 requirements of the simulator– Detailed simulation of Protocol: Run-time speed;– Varying parameters or configuration: easy to use.• C++ is fast to run but slower to code and change;• OTcl is easy to code but runs slowly.c Ke Liu, SUNY-Binghamton, 20067Protocols/Models supported by NS2• Wired Networking– Routing: Unicast, Multicast, and Hierarchical Routing, etc.– Transportation: TCP, UDP, others;– Traffic sources: web, ftp, telnet, cbr, etc.– Queuing disciplines: drop-tail, RED, etc.– QoS: IntServ and Diffserv Wireless Networking• Ad hoc routing and mobile IP– Routing Protocol: AODV, DSDV, DSR, etc.– MAC layer Protocol: TDMA, CDMA(?), IEEE Mac 802.x, etc.– Physical layers: different channels(?), directional attena• Sensor Networksc Ke Liu, SUNY-Binghamton, 20068Researches based on NS2• Intserv/Diffserv (QoS)• Multicast: Routing, Reliable multicast• Transport: TCP Congestion control• Application: Web caching Multimedia• Sensor Networks: LEACH, Directed Diffusion, etc.• etc.c Ke Liu, SUNY-Binghamton, 20069NS2 research actions• NS2: the simulator itself, now version: ns-2.29We will work with the part mostly.•NAM: Network animator. Visualized trace tool(not really).My recommendation is that ”Don’t use nam at all”.•Pre-processing:Traffic and topology generators•Post-processing:Simple trace analysis, often in Awk, Perl(mostly), or Tclc Ke Liu, SUNY-Binghamton, 200610Living under NS2c Ke Liu, SUNY-Binghamton, 200611The NS2 Directory Structurec Ke Liu, SUNY-Binghamton, 200612Warning• Try to avoid using ns2 with version before 2.27• DO NOT use gcc 4.x, suggestion: gcc3.3• If you work withMAC layer protocols, please be careful for the versionsc Ke Liu, SUNY-Binghamton, 200613A Simple SimulationWe just need one Tcl script to do so.c Ke Liu, SUNY-Binghamton, 200614A Simple Simulation, part 1: set up$ns_ use-scheduler Heap ;#Specify the scheduler, default: List Schedulerset ns [new Simulator] ;#Create a simulator object$ns color 1 Blue$ns color 2 Red;#Define different colors for data flows (for NAM)set nf [open out.nam w]$ns namtrace-all $nfset tf [open trace.tr w]$ns trace-all $tf;#Create trace files for simulationproc finish {} {global ns nf tf$ns flush-trace#Close the NAM trace fileclose $nf#Close the ns2 trace fileclose $tfexit 0};#Define a ’finish’ procedurec Ke Liu, SUNY-Binghamton, 200615A Simple Simulation, part 2: n/w structure#Create four nodesset n0 [$ns node]set n1 [$ns node]set n2 [$ns node]set n3 [$ns node]#Create links between the nodes$ns duplex-link $n0 $n2 2Mb 10ms DropTail$ns duplex-link $n1 $n2 2Mb 10ms DropTail$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail#Set Queue Size of link (n2-n3) to 10$ns queue-limit $n2 $n3 10#Give node position (for NAM)$ns duplex-link-op $n0 $n2 orient right-down$ns duplex-link-op $n1 $n2 orient right-up$ns duplex-link-op $n2 $n3 orient right#Monitor the queue for link (n2-n3). (for NAM)$ns duplex-link-op $n2 $n3 queuePos 0.5c Ke Liu, SUNY-Binghamton, 200616A Simple Simulation, part 3: Transport and Traffic#Setup a TCP connection: from node 0 to node 3set tcp [new Agent/TCP]$ns attach-agent $n0 $tcpset sink [new Agent/TCPSink]$ns attach-agent $n3 $sink$ns connect $tcp $sink$tcp set fid_ 1#Setup a FTP over TCP connectionset ftp [new Application/FTP]$ftp attach-agent $tcp$ftp set type_ FTP ;#for Nam#Setup a UDP connection: from node 1 to node 3set udp [new Agent/UDP]$ns attach-agent $n1 $udpset null [new Agent/Null]$ns attach-agent $n3 $null$ns connect $udp $null$udp set fid_ 2c Ke Liu, SUNY-Binghamton, 200617A Simple Simulation, part 4: traffic#Setup a CBR over UDP connectionset cbr [new Application/Traffic/CBR]$cbr attach-agent $udp $cbrset type_ CBR $cbr ;#used by Namset packet_size_ 1000 $cbrset rate_ 1mb $cbrset random_ false ;#generating traffic periodically#Schedule events for the CBR and FTP agents$ns at 0.1 "$cbr start"$ns at 1.0 "$ftp start"$ns at 4.0 "$ftp stop"$ns at 4.5 "$cbr stop"#Detach tcp and sink agents (not really necessary)$ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"#Call the finish procedure after 5 seconds of simulation time$ns at 5.0 "finish"#Run the simulation$ns runc Ke Liu, SUNY-Binghamton, 200618Steps in writing a simulating script• Create the event scheduler• Turn on tracing• Create network• Setup routing• Insert errors• Create transport connection• Create traffic• Transmit application-level datac Ke Liu, SUNY-Binghamton, 200619The trace file• Turn on tracing on specific links$ns_ trace-queue $n0 $n1• Each line in the trace file is in the format:< event > < time > < f rom > < to > < pkt − type >< pkt − size > < flags > < f id > < src.port > < dst.port >< seq > < unique pkt id >• Trace example:+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0r 1.00234 0 2 cbr 210 ------- 0 0.0 3.1 0 0• Event: s send, r receive, + enqueue, − dequeue, d drop, f forward,c Ke Liu, SUNY-Binghamton, 200620The network Topologyc Ke Liu, SUNY-Binghamton,


View Full Document
Download Overview
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Overview and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Overview 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?