Vous êtes sur la page 1sur 3

Chirag Patel (100060701007)

Paper Presentation on Network Simulator 2


Chirag Patel (100160701007), ME CSE,GEC Modasa
AbstractThis is the paper about understanding the functionality and structure of NS2. This document will include introduction to NS2, the implementation of NS2 and overview of different parts of NS2 which are necessary to create a simulation using NS2. Some examples are also included at the end to understand the working of NS2.

SunOS, Solaris), so it installs smoothest there, but it should run on an Posix-like computer, possibly with some tweaking. Ns also builds and runs under Windows. Simple scenarios should run on any reasonable machine, but very large scenarios benefit from large amounts of memory. Ns is fairly large. The allinone package requires about 320MB of disk space to build. Building ns from pieces can save some disk space. (If multiple people want to share files in the ns build tree to save space. B. Components. Compulsory components. 1) Tcl/Tk Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including web and desktop applications, networking, administration, testing and many more. Open source and businessfriendly, Tcl is a mature yet evolving language that is truly cross platform, easily deployed and highly extensible. Tk is a graphical user interface toolkit that takes developing desktop applications to a higher level than conventional approaches. Tk is the standard GUI not only for Tcl, but for many other dynamic languages, and can produce rich, native applications that run unchanged across Windows, Mac OS X, Linux and more. 2) Otcl OTcl, short for MIT Object Tcl, is an extension to Tcl/Tk for object-oriented programming. Designed to be dynamically extensible, like Tcl, from the ground up. Builds on Tcl syntax and concepts rather than importing another language. Compact yet powerful object programming system. Fairly portable implementation. 3) TclCL TclCL (Tcl with classes) is a Tcl/C++ interface used by Mash, vic, vat, rtp_play, ns, and nam. It provides a layer of C++ glue over OTcl. 4) Ns-2 Optional Components. 1) Nam-1 Nam is a Tcl/TK based animation tool for viewing network simulation traces and real world packet traces.

I. INTRODUCTION NS (version 2) is an object-oriented, discrete event driven network simulator developed at UC Berkely written in C++ and OTcl. NS is primarily useful for simulating local and wide area networks. The purpose of this paper is to give a new user some basic idea of how the simulator works, how to setup simulation networks, where to look for further information about network components in simulator codes, how to create new network components, etc. Although all the usage of the simulator or possible network simulation setups may not be covered in this paper, the project should help a new user to get started quickly. NS is an event driven network simulator developed at UC Berkeley that simulates variety of IP networks. It implements network protocols such as TCP and UPD, traffic source behavior such as FTP, Telnet, Web, CBR and VBR, router queue management mechanism such as Drop Tail, RED and CBQ, routing algorithms such as Dijkstra, and more. NS also implements multicasting and some of the MAC layer protocols for LAN simulations. The NS project is now a part of the VINT project that develops tools for simulation results display, analysis and converters that convert network topologies generated by well-known generators to NS formats. Currently, NS (version 2) written in C++ and OTcl (Tcl script language with Object-oriented extensions developed at MIT) is available. This document talks briefly about the basic structure of NS, and explains in detail how to use NS mostly by giving examples. VINT is a DARPA-funded research project whose aim is to build a network simulator that will allow the study of scale and protocol interaction in the context of current and future network protocols. VINT is a collaborative project involving USC/ISI, Xerox PARC, LBNL, and UC Berkeley. II. BULDING NS A. What hardware is needed? To build ns you need a computer and a C++ compiler. We develop ns on several kinds of Unix (FreeBSD, Linux,

Chirag Patel (100060701007) It supports topology layout, packet level animation, and various data inspection tools.

Fig 3: Node Fig 1: Natwork Animator 2) Xgraph Xgraph is an X-Windows application that includes: interactive plotting and graphing, by David Harrison of UC Berkeley animation and deritives, added by Paul Walker of NCSA portability and bug fixes, by the VINT project Application - FTP, Telnet (attached to an Agent) link - links two nodes together, properties: bandwidth, propagation delay, queuing mechanism

Fig 4: Link Fig 2: XGraph 3) 4) 5) 6) 7) 8) Perl Tcldebug Dmalloc Sgb2ns conversion program Tiars2ns conversion program Cweb and sgb source code BULDING BLOKS FOR SCRIPT queue - DropTail, RED (associated with every link by default) IV. SIMULATION SCRIPT OUTLINE Create the simulator object In this step we will create a simulator, in which all the nodes and their parameters will be written. The following command will create a simulator and the following two lines are for create trace file which is useful for analysis of the simulation. There is a single trace file for each simulation. set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf create the nodes Nodes are the network entity and we can create as many nodes in our simulation as per requirement. Node requires link and the protocol to work. The following code will create node n0 and n1.

III.

Scripts to drive your simulations are written in OTcl. Node - represents a host. Collection of agents and Classifiers. Agent - TCP, Full-TCP (attached to a node)

Chirag Patel (100060701007) set n0 [$ns node] set n1 [$ns node] link To link nodes means to create communication medium between two network entity. Following is the syntax to create a link between node n0 and n1. $ns duplex-link $n0 $n1 1Mb 10ms DropTail setup the traffic generator This will allow nodes to communicate. Nodes which are connected through link can exchange packets by generating traffic between them. The traffic agent can be TCP or UDP. As per traffic agent we have to create traffic whether FTP or UDP. The following is the code for creating a traffic agent and attach to the network node. And then we have to create application traffic and attach it to the traffic agent. set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 set cbr0 [new Aplication/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 schedule the start of the simulation By creating scheduler we can control the starting and stopping of simulation and we can also create functions to test the performance of nodes by making them down or up at some interval of time. The following is the code for starting and stopping the traffic between nodes. $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop" run After completing all above steps we can start the simulation. The command to start the simulation is as follows. ns <filename>.tcl V. TRACING Tracing File Contents Each lines consists of: Event Descriptor (+, -, d, r) Simulation time (in seconds) of that event From Node & To Node, which identify the link on which the event occurred
[1] [2] [3] [4] [5]

3 Packet type Packet size Flags (appeared as "------" since no flag is set). Currently, NS implements only the Explicit Congestion Notification (ECN) bit, and the remaining bits are not used. Flow id (fid) Source and destination address in forms of "node.port". The network layer protocol's packet sequence number. What about UDP? The last field shows the unique id of the packet.

Fig 5: Trace file REFERENCES


http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats http://www.isi.edu/nsnam/ns/ns-faq.html http://www.isi.edu/nsnam/ns/tutorial/index.html http://nsnam.isi.edu/nsnam/index.php/Main_Page http://www.isi.edu/nsnam/nam/

Vous aimerez peut-être aussi