ns-2 tutorial - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

ns-2 tutorial

Description:

ns-2 tutorial CSCI 5931 Network Security Instructor : Dr. T. Andrew Yang Karthik Sadasivam Banuprasad Samudrala Introduction Ns-2 is a discrete event simulator ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 14
Provided by: sce9
Category:

less

Transcript and Presenter's Notes

Title: ns-2 tutorial


1
ns-2 tutorial
CSCI 5931 Network Security Instructor Dr. T.
Andrew Yang
  • Karthik Sadasivam
  • Banuprasad Samudrala

2
Introduction
  • Ns-2 is a discrete event simulator targeted at
    network research
  • 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

3
Goals of ns
  • support networking research and education
  • protocol design, traffic studies, etc.
  • protocol comparison
  • provide a collaborative environment
  • freely distributed, open source
  • share code, protocols, models, etc.
  • allow easy comparision of similar protocols
  • increase confidence in results
  • models provide useful results in several
    situations
  • multiple levels of detail in one simulator

4
ns status
  • platforms basically all Unix and Windows
  • size about 200k loc each C and Tcl, 350 page
    manual
  • user-base gt1k institutions, gt10k users
  • releases about every 6 months, plus daily
    snapshots

5
Components of ns
  • ns, the simulator itself
  • nam, the Network AniMator
  • visualize ns (or other) output
  • GUI input simple ns scenarios
  • pre-processing
  • traffic and topology generators
  • post-processing
  • simple trace analysis, often in Awk, Perl, or Tcl

6
ns Software Structure C and Otcl
  • Uses two languages
  • C for packet-processing
  • fast to run, detailed, complete control
  • OTcl for control
  • simulation setup, configuration, occasional
    actions
  • fast to write and change
  • pros trade-off running vs. writing speed,
    powerful/documented config language
  • cons two languages to learn and debug in

7
oTcl and C The Duality
C
otcl
  • OTcl (object variant of Tcl) and C share class
    hierarchy
  • TclCL is glue library that makes it easy to share
    functions, variables, etc.

8
Installation and documentation
  • http//www.isi.edu/nsnam/ns/
  • download ns-allinone
  • includes Tcl, OTcl, TclCL, ns, nam, etc.
  • mailing list ns-users_at_isi.edu
  • documentation (see url above)
  • Marc Gries tutorial
  • ns manual

9
Steps to set up the simulation
  • Initialize the simulator
  • Define files for output (tracing)
  • Set up the topology
  • Set up the agents
  • Set up the traffic between the nodes
  • Start the simulation
  • Analyze the trace files to compute the parameters
    of interest

10
Example TCP
set ns new Simulator set n0 ns node set n1
ns node
set ftp new Application/FTP ftp attach-agent
tcp ns at 0.2 "ftp start" ns at 1.2
exit" ns run
ns duplex-link n0 n1 1.5Mb 10ms DropTail
set tcp new Agent/TCP set tcpsink new
Agent/TCPSink ns attach-agent n0 tcp ns
attach-agent n1 tcpsink ns connect tcp
tcpsink
11
Script to start nam
  • set nf open out.nam w
  • ns namtrace-all nf
  • proc finish
  • global ns nf
  • ns flush-trace
  • close nf
  • exec nam out.nam
  • exit 0
  • your code goes in here
  • ns at 12.0 "finish" 12.0 is the simulation
    time in secs

12
Screenshots
Project B.2
Project B.1
13
References
  • 1 slides by John Heidemann
  • http//sce.cl.uh.edu/yang/teaching/csci5931netSecu
    ritySpr05/johnh_class_slides_sp2003.ppt
  • 2 ns2 website http//www.isi.edu/nsnam/ns
  • 3 ns-2 Tutorial http//www.isi.edu/nsnam/ns/tut
    orial/nsindex.html
  • 4 Tcl/Tk tutorial http//hegel.ittc.ukans.edu/
    topics/tcltk/tutorial-noplugin/
Write a Comment
User Comments (0)
About PowerShow.com