Download presentation
Presentation is loading. Please wait.
Published byLeslie Leonard Modified over 9 years ago
1
Network Simulator-2 Sandeep singla 1998A2A7540
2
NS-2 A discrete event simulator Focused on modeling network protocols –Wired, wireless –TCP,UDP,unicast,multicast –Web,telnet,ftp –Routing protocols –Error modeling
3
Ns components Ns, the simulator itself Nam, Network animator –Visualize the ns output –GUI input the simple scenarios Preprocessing –Traffic and topology generator Post processing –Simple trace analysis,often in TCL
4
Languages Uses two languages –C++ for packet processing Fast to run,detailed,complete control –TCL for control Simulation setups,configuration,occasional events Fast to write and change
5
TCL The file has the extension.tcl. To start the first line is. –Set ns [new simulator]. –This will create a simulator object.
6
TCL Next a file is opened for dumping all the trace data to be used by nam (network animator). –Set nf [open out.Nam w]. – $Ns namtrace-all $nf.
7
TCL The next step is to add a finish procedure to close the trace file and start the nam. –Proc finish {} { Global ns nf $Ns flush-trace Close $nf Exec nam out.Nam & Exit 0 }
8
TCL The next step is to execute the finish procedure and then start the simulation. –$ns at 5.0 "finish" –$ns run
9
Adding Nodes and Links To create a network node –Set n0 [$ns node]
10
Adding Nodes and Links To create a link between two nodes –$Ns duplex-link $n0 $n1 1mb 10ms DropTail –Specifies bandwidth,delay,and queue type Drop tail,RED,CBQ,FQ,SFQ,DRR
11
Adding Nodes and Links To send data – Set udp0 [new agent/UDP] $Ns attach-agent $n0 $udp0 Set cbr0 [new application/traffic/CBR] Set null0 [new agent/null] $Ns attach-agent $n1 $null0 $Ns connect $udp0 $null0 $Ns at 0.5 "$cbr0 start" $Ns at 4.5 "$cbr0 stop"
12
Routing Alternatives Unicast –$ns rtproto – :static,session,DV,cost,multi-path Multicast –$ns multicast –$ns mrtproto – :DM,ST,BST,CtrMcast
13
What More Can Be Done.. Ns-2 offers a simulation of a variety of protocols ex: various routing protocols, various multicast and broadcast protocols. All the links can be monitored and graphs can be created of the traffic pattern using a tool that comes along with the ns-2 package- x graph.
14
What More Can Be Done.. Wireless networks can be simulated using ns-2 and various tools have been provided for this purpose. The various network failures scenarios can also be simulated, for example failure of a link or a node.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.