M. S. RAMAIAH INSTITUTE OF TECHNOLOGY
(AUTONOMOUS INSTITUTE, AFFILIATED TO
VTU)
A Presentation Report on
“NETWORK SIMULATOR 2”
Submitted in Partial fulfillment of
5th
Semester B.E
In
Information Science and Engineering
For the subject
Data communication
Submitted by
NIKITHA.K.N(1MS13IS066)
POOJA.B(1MS13IS074)
RASHMI.K(1MS13IS082)
NIDHI SHETTY(1MS13IS063)
NEHA.M(1MS13IS062)
M. S. RAMAIAH INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION SCIENCE AND
ENGINEERING
BANGALORE – 560 054
C E R T I F I C A T E
This is to certify that the “Presentation on network simulator 2”
has been successfully completed by:
NIKITHA.K.N(1MS13IS066)
POOJA.B(1MS13IS074)
RASHMI.K(1MS13IS082)
NIDHI SHETTY(1MS13IS063)
NEHA.M(1MS13IS062)
In partial fulfillment of 5th Semester B.E (Information Science &
Engg) for the subject “Data Communication(IS511)” during the
period 2015 - 2016, as prescribed by Department of Information
Science & Engineering, MSRIT.
SIGNATURE OF STAFF INCHARGE
Mr. Suresh kumar
Assistant professor
Dept of ISE, MSRIT
ACKNOWLEDGEMENT
Any achievement be it scholastic or otherwise does not depend only on the
individual efforts but on the guidance ,encouragement and cooperation of elders and friends.
We wish to express our sincere gratitude to MR.SURESH KUMAR, Assistant Professor
,department of ISE, who provided us an opportunity to do “NETWORK SIMULATOR 2”
project work at M S Ramaiah institute of technology.
We would like to thank out DR.VIJAY KUMAR B.P , Head of department ,Information Science
and engineering, M S R I T, Bangalore for his valuable suggestions and advice.
NIDHI SHETTY(1MS13ISO63)
NEHA .M(1MS13IS062)
RASHMI.K(1MS13IS082)
POOJA.B(1MS13IS074)
NIKITHA.K.N(1MS13IS066)
CONTENTS
 NS2 INTRODUCTION.
 HISTORY OF NS2.
 FLATFORMS PREFFERED TO RUN NS2.
 CRITICISM.
 ADVANTAGES.
 TCL PROGRAMMING.
 NS2 COMPONENTS.
 NAM.
 NS2 GOALS.
 DRAWBACKS.
NS2 INTRODUCTION
WHAT IS NS2?
 Discrete event simulator.
 Packet level
 Mainly for networking research.
 The object oriented extension of TCL(OTCL) and C++
used.
 Designing for unix systems bt runs under windows Cygwin
as well.
HISTORY OF NS2:
 1995 : Developed by LBL through support of
DARPA
 1996: NS was extended and distributed by VINT
project
 1997: Satellite models added @ UCB
 1999: Wireless models added @ CMU
PLATFORMS SUPPORTED FOR NS2:
• Most UNIX and UNIX-like systems
 FreeBSD
 Linux
 Solaris
• Windows 98/2000/2003/XP
 Cygwin required
 Some work , some doesnt
C++ :
 It increases the efficiency of simulation.
 It is used to provide the details of the protocols and their
operation.
 It is used to reduce packet and event processingtime.
ADVATAGES:
• sometimes cheaper
• find bugs (in design) in advance
• generality: over analytic/numerical techniques
• detail: can simulate system details at arbitrary level.
OTCL:
 Simulation of slightly varying parameters or configurations
 quickly exploring a number of scenarios
 iteration time (change the model and re-run) is more
important
 it allows fast development.
NS2 COMPONENTS:
• NS – Simulator
• NAM – Network AniMator
– visual demonstration of NS output
• Preprocessing
– Handwritten TCL or
– Topology generator
• Post analysis
– Trace analysis using Perl/TCL/AWK/MATLAB
NAM:
 NAM-Network animator tool
 The NAM is a completely separate program that is distributed with
the NS simulator.
 This program is named NAM and is shows the progression of the
packets through the network.
 The NAM program reads an input file(containing the packets
transmission events and draw the network event graphically.
 Running NAM-unix>>nam nam.input
NS2 GOALS:
 To support networking research and education.
– Protocol design, traffic studies, etc and the Protocol comparison;
– New architecture designs are also supported.
 To provide collaborative environment
– Freely distributed, open source and to increase confidence in result.
NS2 DRAWBACKS:
 caution: does model reflect reality
 large scale systems: lots of resources to simulate
(especially accurately simulate)
 may be slow (computationally expensive – 1 min real
time could be hours of simulated time)
 art: determining right level of model complexity
 statistical uncertainty in results
Simulatea three nodes point-to-point network with duplex links between them. Set the queue sizevary the
bandwidth and find the number of packets dropped.
#Create simulator setns [new Simulator]
#Open the nam trace file
set nf [open ex1.nam w]
$ns namtrace-all
$nf set nt [open ex1.tr w]
$ns trace-all $nt
proc finish {}{
global ns nf nt
$ns flush-trace
#Close the trace file
close$nf close$nt
#Execute nam on the tracefile
exec nam ex1.nam &
exit 0 }
#create node
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
#create link $ns duplex-link $n0 $n1 12Mb 10ms DropTail
$ns duplex-link $n1 $n2 0.2Mb 10ms DropTail
#Set Queue Size
$ns queue-limit $n0 $n1 10
$ns queue-limit $n1 $n2 10
#setup udp connection
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
#set sink to node
set null0 [new Agent/Null]
$ns attach-agent $n2 $null0
#connect udp src and sink
$ns connect $udp0 $null0
# set udp traffic
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp0
$cbr set type_ CBR
$cbr set packetSize_ 1000
$cbr set rate_ 0.5Mb
$cbr set random_ false
$ns at 0.0 "$cbr start"
$ns at 5.0 "finish"
$ns run
TO CALCULATE NUMBER OF PACKETS DROPPED:
BEGIN { pktdrp = 0; }
{
event = $1;
if(event == "d")
{ pktdrp++; }
}
END { printf("The numberof packetsdroppedis%dn",pktdrp);
BIBLIOGRAPHY
http://www.Googleweblight.com
http://www.isi.edu
http://wikipedia.com
Data communication and networking-behrouz A forouzan
Computer networks - renukambigar.
Computer networks - tannanbaum

Dc project 1

  • 1.
    M. S. RAMAIAHINSTITUTE OF TECHNOLOGY (AUTONOMOUS INSTITUTE, AFFILIATED TO VTU) A Presentation Report on “NETWORK SIMULATOR 2” Submitted in Partial fulfillment of 5th Semester B.E In Information Science and Engineering For the subject Data communication Submitted by NIKITHA.K.N(1MS13IS066) POOJA.B(1MS13IS074) RASHMI.K(1MS13IS082) NIDHI SHETTY(1MS13IS063) NEHA.M(1MS13IS062)
  • 2.
    M. S. RAMAIAHINSTITUTE OF TECHNOLOGY DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING BANGALORE – 560 054 C E R T I F I C A T E This is to certify that the “Presentation on network simulator 2” has been successfully completed by: NIKITHA.K.N(1MS13IS066) POOJA.B(1MS13IS074) RASHMI.K(1MS13IS082) NIDHI SHETTY(1MS13IS063) NEHA.M(1MS13IS062) In partial fulfillment of 5th Semester B.E (Information Science & Engg) for the subject “Data Communication(IS511)” during the period 2015 - 2016, as prescribed by Department of Information Science & Engineering, MSRIT. SIGNATURE OF STAFF INCHARGE Mr. Suresh kumar Assistant professor Dept of ISE, MSRIT ACKNOWLEDGEMENT
  • 3.
    Any achievement beit scholastic or otherwise does not depend only on the individual efforts but on the guidance ,encouragement and cooperation of elders and friends. We wish to express our sincere gratitude to MR.SURESH KUMAR, Assistant Professor ,department of ISE, who provided us an opportunity to do “NETWORK SIMULATOR 2” project work at M S Ramaiah institute of technology. We would like to thank out DR.VIJAY KUMAR B.P , Head of department ,Information Science and engineering, M S R I T, Bangalore for his valuable suggestions and advice. NIDHI SHETTY(1MS13ISO63) NEHA .M(1MS13IS062) RASHMI.K(1MS13IS082) POOJA.B(1MS13IS074) NIKITHA.K.N(1MS13IS066)
  • 4.
    CONTENTS  NS2 INTRODUCTION. HISTORY OF NS2.  FLATFORMS PREFFERED TO RUN NS2.  CRITICISM.  ADVANTAGES.  TCL PROGRAMMING.  NS2 COMPONENTS.  NAM.  NS2 GOALS.  DRAWBACKS.
  • 5.
    NS2 INTRODUCTION WHAT ISNS2?  Discrete event simulator.  Packet level  Mainly for networking research.  The object oriented extension of TCL(OTCL) and C++ used.  Designing for unix systems bt runs under windows Cygwin as well. HISTORY OF NS2:  1995 : Developed by LBL through support of DARPA  1996: NS was extended and distributed by VINT project  1997: Satellite models added @ UCB
  • 6.
     1999: Wirelessmodels added @ CMU PLATFORMS SUPPORTED FOR NS2: • Most UNIX and UNIX-like systems  FreeBSD  Linux  Solaris • Windows 98/2000/2003/XP  Cygwin required  Some work , some doesnt C++ :  It increases the efficiency of simulation.  It is used to provide the details of the protocols and their operation.  It is used to reduce packet and event processingtime. ADVATAGES: • sometimes cheaper • find bugs (in design) in advance • generality: over analytic/numerical techniques • detail: can simulate system details at arbitrary level. OTCL:
  • 7.
     Simulation ofslightly varying parameters or configurations  quickly exploring a number of scenarios  iteration time (change the model and re-run) is more important  it allows fast development. NS2 COMPONENTS: • NS – Simulator • NAM – Network AniMator – visual demonstration of NS output • Preprocessing – Handwritten TCL or – Topology generator • Post analysis – Trace analysis using Perl/TCL/AWK/MATLAB NAM:  NAM-Network animator tool  The NAM is a completely separate program that is distributed with the NS simulator.  This program is named NAM and is shows the progression of the packets through the network.  The NAM program reads an input file(containing the packets transmission events and draw the network event graphically.  Running NAM-unix>>nam nam.input NS2 GOALS:  To support networking research and education.
  • 8.
    – Protocol design,traffic studies, etc and the Protocol comparison; – New architecture designs are also supported.  To provide collaborative environment – Freely distributed, open source and to increase confidence in result. NS2 DRAWBACKS:  caution: does model reflect reality  large scale systems: lots of resources to simulate (especially accurately simulate)  may be slow (computationally expensive – 1 min real time could be hours of simulated time)  art: determining right level of model complexity  statistical uncertainty in results
  • 9.
    Simulatea three nodespoint-to-point network with duplex links between them. Set the queue sizevary the bandwidth and find the number of packets dropped. #Create simulator setns [new Simulator] #Open the nam trace file set nf [open ex1.nam w] $ns namtrace-all $nf set nt [open ex1.tr w] $ns trace-all $nt proc finish {}{ global ns nf nt $ns flush-trace #Close the trace file close$nf close$nt #Execute nam on the tracefile exec nam ex1.nam & exit 0 } #create node set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] #create link $ns duplex-link $n0 $n1 12Mb 10ms DropTail $ns duplex-link $n1 $n2 0.2Mb 10ms DropTail #Set Queue Size $ns queue-limit $n0 $n1 10 $ns queue-limit $n1 $n2 10 #setup udp connection set udp0 [new Agent/UDP]
  • 10.
    $ns attach-agent $n0$udp0 #set sink to node set null0 [new Agent/Null] $ns attach-agent $n2 $null0 #connect udp src and sink $ns connect $udp0 $null0 # set udp traffic set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp0 $cbr set type_ CBR $cbr set packetSize_ 1000 $cbr set rate_ 0.5Mb $cbr set random_ false $ns at 0.0 "$cbr start" $ns at 5.0 "finish" $ns run TO CALCULATE NUMBER OF PACKETS DROPPED: BEGIN { pktdrp = 0; } { event = $1; if(event == "d") { pktdrp++; } } END { printf("The numberof packetsdroppedis%dn",pktdrp);
  • 13.
    BIBLIOGRAPHY http://www.Googleweblight.com http://www.isi.edu http://wikipedia.com Data communication andnetworking-behrouz A forouzan Computer networks - renukambigar. Computer networks - tannanbaum