THE FIRST STEP TO BECOME FAMILIAR WITH NETWORK SIMULATOR (NS) Neda Mohammadizadeh Cooperative sub-group BBCR group Feb 2012
2 References • http://nsnam.isi.edu/nsnam/index.php/User_Information • http://nile.wpi.edu/NS/ • http://www.isi.edu/nsnam/ns/tutorial/index.html • Introduction to NS2(PPT), Prepared by Changyong Jung
3 Outline • Introduction on Network Simulator • Installation • Architecture of NS-2 • OTcl • Simulation Examples
4 Introduction • Network Simulator (NS) • Discrete event network simulator • Implements • Transport layer protocols such as TCP ( reno, tahoe, vegas, sack) and UPD • Router queue management mechanism such as Drop Tail, RED • Routing algorithms such as Dijkstra and Ad-hoc Routing (DSDV, DSR, AODV, TORA) • MAC layer protocols (802.11, 802.3, TDMA) • Sensor Network (diffusion, gaf), Satellite protocols, and many others • Traffic source behavior such as FTP, Telnet, Web, CBR and VBR • NS versions: • NS-1, NS-2, NS-3
5 Introduction • NS-1: • LNBL Simulator tool • Developed by the network research group at the Lawrence Berkeley National Laboratory (1989). • Derived from REAL simulator • Simulation description language: TCL
6 Introduction • NS-2: • Object oriented (OTcl instead of TCL) • Built in C++ and provides a simulation interface through OTcl • Developed by UC Berkeley • Difficult for the first time user • Few user friendly manuals • Needs scripting language, queuing theory and modeling techniques knowledge • Complaint about inconsistent results • BUGs!!!
7 Introduction • NS-3: • Maintaining backward compatibility with ns-2? (2005) • YANS (Yet Another Network Simulator) -> NS-3 base • NS-3.1 (2008) , NS-3.11(2011) • Built in C++ and Phyton • Make it simpler • No support for some protocols which were supported in ns-2
8 Installation • http://nsnam.isi.edu/nsnam/index.php/Downloading_and_install ing_ns-2 • Installing on Unix-based systems • Installing on Windows using Cygwin • Installing on Mac • The following “How to install” slides are brought from Introduction to NS2(PPT), Prepared by Changyong Jung
9 How to Install -Window XP- • Go to Website: http://nsnam.isi.edu/nsnam/index.php/Running_Ns_and_Nam_Under_Windows_9x/2000/XP_Using_Cygwin • Read “ Requirements and Installation Tips ” Carefully. • Download cygwin.exe from http://www.cygwin.com/ • Click the “ cygwin.exe ”
10 How to Install • Cygwin Installation
11 How to Install
12 How to Install • Select browse for “ cygwin ” file( I selected as “ default ” )
13 How to Install • Local package directory (I recommend c:\cygwin).
14 How to Install • Select to Install all ( I recommend it) • You can select “ install ” , “ default ” , “ uninstall ” , “ install ” , and “ reinstall ” behind the first line “ all ” . If you select “ install ” , then all sub items will be automatically selected. Otherwise you may lose some items.
15 How to Install • Select download site
16 How to Install • Installing
17 How to Install • Finishing Installing
18 How to Install • NS2 Installation • Download ns-allinone-2.29.2.tar.gz from Website and Save it to the c:/cygwin /usr/local • Unpack it: tar xvfz ns-allinone-2.29.2.tar.gz • Click on desktop icon “ cygwin ”
19 How to Install
20 How to Install • Type “ cd .. ” to go to the upper folder( “ cd ” must be low case. And there is one space between “ d ” and “ . ” ) • Type “ cd .. ” again.
21 How to Install • “ cd usr ” , go to folder “ usr ” • “ cd local ” , go to folder “ local ”
22 How to Install • Find “ install.exe ”
23 How to Install • Start to run the installation “ ./install ”
24 How to Install • Installing
25 How to Install • Installing
26 How to Install • Configure system variables and library paths • After finishing installing, following window appears
27 How to Install • Configure system variables • Go to “ My computer ” and click “ view system information ”
28 How to Install • Go to “ advanced ” Tab and Click “ Environmental variables ”
29 How to Install
30 How to Install • Highlight “ path ” which is “ system variable ” box and press the “ Edit ” button.
31 How to Install
32 How to Install • Add the following path separated with “ ; ” make sure to not change the existing path. /usr/local/ns-allinone-2.29.2/bin /usr/local/ns-allinone-2.29.2/tcl8.4.11/unix /usr/local/ns-allinone-2.29.2/tk8.4.11/unix
33 How to Install • Go to cygwin and type the following content Export LD_LIBRARY_PATH=/usr/local/ns-allinone- 2.29/otcl-1.11 Export LD_LIBRARY_PATH=/usr/local/ns-allinone-2.29/lib Export TCL_LIBRARY_PATH=/usr/local/ns-allinone- 2.29/tcl8.4.11/library
34 How to Install
35 NS-2 Architecture • The event scheduler and the basic network component objects in the data path are written and compiled using C++. • To use NS, you program in OTcl script language NS Simulator Library Network Event Network Setup Component Scheduler Modules Objects Objects
36 Plumbing Network Setup: • Creating possible data paths among network objects. • The power of NS comes from plumbing. Event Scheduling Event is a packet ID that is unique for a packet • scheduled time • the pointer to an object that handles the event. An event scheduler • keeps track of simulation time • fires all the events in the event queue
37 NS-2 Architecture OTcl and C++ http://nile.wpi.edu/NS/
38 OTcl Executing a test file: ns ex-tcl.tcl Results:
39 Event Scheduler 1. Real-time scheduler 2. Non-real-time scheduler • List • Heap • Calendar . . . set ns [new Simulator] $ns use-scheduler Heap $ns at 300.5 "complete_sim" . . . http://nile.wpi.edu/NS/ proc complete_sim {} { . . . }
40 Network Component Node: Link: • Unicast or • Tracing Multicast • Queue monitor • Routing Protocol Unicast - $ns rtproto type create-trace {type file src dst} - type: Static, Session, DV, cost, multi-path Multicast - $ns multicast (right after set $ns [new Scheduler]) - $ns mrtproto type - type: CtrMcast, DM, ST, BST
41 Partial OTcl class hierarchy http://nile.wpi.edu/NS/
42 Other important tasks Post simulation: Trace analysis Queue Monitor Troubleshooting: Installation problems Simulation Problems
43 NS Results NS Text-based NAM Simulation results Network Animator (NAM) • A graphical simulation display tool • Developed as a part of VINT project • Has a nice graphical user interface • Can graphically present information
44 Simulation Example http://nile.wpi.edu/NS/
45
46 Where to find… /ns-2/tcl/lib ns-lib.tcl: The simulator class and most of its member function definitions ns-default.tcl: The default values for configurable parameters ns-packet.tcl: The packet header format initialization implementation other OTcl files: implementation of compound network objects or the front end (control part) of network objects
47 Summary Network Simulator (NS): is an object-oriented discrete-event network simulator. Implements different network protocols. is written in C++ and OTcl. (NS-2) It was the first step to be familiar with NS. Keep going…
48 Thank You
Recommend
More recommend