Ns2 Paper

Only available on StudyMode
  • Topic: Network simulator, Open source, Network simulation
  • Pages : 4 (665 words )
  • Download(s) : 27
  • Published : October 17, 2010
Open Document
Text Preview
What is NS-2 exactly ????
ns or the network simulator (also popularly called ns-2, in reference to its current generation) is an object oriented discrete-event network simulator. Simulator maintains list of events and executes one event after another.

What we can do with ns2?
Ns-2 is popularly used in the simulation of routing and multicast protocols and is heavily used in ad-hoc networking research. Ns-2 supports network protocols (TCP, UDP, HTTP, Routing algorithms, MAC etc) for offering simulation results for wired and wireless networks. It is popular in academic for its extensibility (due to its open source model).

Why we do Simulation?
In real environment, it is quit hard to implement complex network, in same situation diagnosis of this complex network is very hard. Before directly implementation of complex network in real, somehow it is useful to test it. It saves time and money. Simulation process provides the environment same as real.

Result of simulation is quick so more ideas can be tested in a similar timeframe. Simulation process is Cheap and does not require costly equipment Complex scenarios can be easily tested
Results can be quickly obtained – more ideas can
Be tested in a smaller timeframe
We can control experimental conditions

NS-2 programming Structure:-

1) Creating Event Scheduler
● Create event scheduler:
set ns [new simulator]
● Schedule an event: $ns at <time> <event>
$ns at 5.0 “finish”

proc finish {} {
global ns nf
close $nf
exec nam out.nam &
exit 0
● Start Scheduler
$ns run

2) Turn on tracing
● All packet trace
$ns traceall [open out.tr w] <event> <time> <from> <to> <pkt> <size>------<flowid> <src> <dst> <seqno> <aseqno> + 0.51 0 1 cbr 500------ 0 0.0 1.0 0 2

- 0.51 0 1 cbr 500------ 0 0.0 1.0 0 2
r 0.514 0 1 cbr 500------ 0 0.0 1.0 0 0
● Variable trace
set par [open output/param.tr w]
$tcp attach $par...
tracking img