













Network simulator is a tool for simulating basic networking aspects.
NS2 requires a different language for scripting.
In this session i will provide you with the basics of Network Simulator installation and scripting.
Also i will provide you with some basic programs and protocol scripts that you would need as a framework for implementing your project’s.
Here is my WebSite for NS2.
Please do visit this site if you need to learn NS2 or if have any queries about NS2.
https://sites.google.com/site/dicoverns2/
Here are a few applications where you will need ns2.
focused on modeling network protocols
-> wired, wireless, satellite
-> TCP, UDP, multicast, unicast
-> Web, telnet, ftp
-> Ad hoc routing; sensor networks
-> Infrastructure: stats, tracing, error models etc.
Simulate existing network protocols: TCP,routing, and multicast protocols over both wired and wireless networks.
•Possibility to implement and test new protocols and applications
•Current release: ns-2.5
Here is a sample ns2 code that is used for creating two nodes and link them using a duplex link:
#Create a simulator object
set ns [new Simulator]
#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a ‘finish’ procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
#exec nam out.nam &
exit 0
}
#Create two nodes
set n0 [$ns node]
set n1 [$ns node]
#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 “finish”
#Run the simulation
$ns run
Coming to NAM :
Nam is a Tcl/TK based animation tool for viewing network simulation traces and real world packet traces. It supports topology layout, packet level animation, and various data inspection tools.
Share this session:
Leave a Reply
You must be logged in to post a comment.