430 likes | 608 Views
NS2. Keywords: Install Network Simulator 2.26 Unix/Linux and Windows Network Animator 1.9 Xgraph/Tracegraph Object/Tool Command Language By Abu Asaduzzaman aasaduzz@cse.fau.edu. Agenda. Introduction Mobile Computing Simulations Installation (ns2, nam1, xgraph)
E N D
NS2 Keywords: Install Network Simulator 2.26 Unix/Linux and Windows Network Animator 1.9 Xgraph/Tracegraph Object/Tool Command Language By Abu Asaduzzaman aasaduzz@cse.fau.edu MCLab CSE Dept, FAU
Agenda • Introduction • Mobile Computing Simulations • Installation (ns2, nam1, xgraph) • Installation Problems and Bug Fixes • Bug Reports • Demo/Example (Otcl) MCLab CSE Dept, FAU
Introduction • What/why NS2? • Discrete event, packet level simulator • Open source, supports research • Protocol design, traffic study • Written in C++ with Otcl front-end • Wired and Mobile modes • Link layer and up for most wired • Additional lower layers for wireless MCLab CSE Dept, FAU
Introduction (+) • What is discrete event simulation? • list of events ordered by simulation time • take next event, run it until done • each event happens in an instant of virtual /simulated time, but takes an arbitrary amount of real time • Why Otcl and C++? • Detailed simulation (runtime speed) – C++ • Varying parameters (change model) – Tcl MCLab CSE Dept, FAU
Routing/Agent Protocol/Agent Portrait of a Mobile Node n1 Port Classifier Addr Classifier entry Link Layer Interface queue MCLab CSE Dept, FAU
Introduction (+) • Any other simulation tools? • OPNET Modeler • Run faster, commercial usages • Text based, no nice graphics MCLab CSE Dept, FAU
Introduction (+) • What about NAM? • NAM provides a visual view of the simulation • view overall topology - nodes and links • packets in transmission, queued, and dropped • can monitor individual nodes, links, or packets • provides graphical results with xgraph in Unix only MCLab CSE Dept, FAU
Introduction (+) • What is Xgraph/Tracegraph? • Xgraph for Unix/Linux only • Tracegraph for Unix/Windows both • plot graphical results • number of packets transmitted over time, end-to-end delay, etc MCLab CSE Dept, FAU
Introduction (+) • Available? • Installed in CSE Lab S&E-319 and MCLab S&E-409 • Install in Unix/Linux or Windows OS • http://www.isi.edu/nsnam/ns/ • http://www.isi.edu/nsnam/nam/ • http://www.cv.nrao.edu/adass/abstracts/bof_tcl.html MCLab CSE Dept, FAU
Introduction (+) • How much memory it takes? • Approximately 70 MB of space for precompiled NS2 binary, or • 145 + 50 MB of space for full NS2 and NAM1 source MCLab CSE Dept, FAU
Introduction (+) • Simulate mobility using NS2? • Various modules were added to NS2 to simulate node mobility and wireless networking • Mobile Node • Ad-hoc Routing (DSR, DSDV, TORA, AODV) • MAC802.11 • Radio Propagation Model • Channel MCLab CSE Dept, FAU
Summary NS2 supports graphical representations, that helps to visualize how protocols work and interact with different network topologies. MCLab CSE Dept, FAU
Download and Build NS2 • Before you start … • Memory • A C++ compiler • Unix or Windows • X server (Cygwin/XFree86 for Windows) • Cygwin - Linux-like environment for Windows • cygwin1.dll - acts as a Linux emulation layer • Tools - provide Linux look and feel • Cygwin/XFree86 - X Server, Xlib, and X clients (xterm) MCLab CSE Dept, FAU
Download and Build NS2 (+) • NS2 Packages • Current Release - ns-2.26 • All-in-one or All-at-once (about 250 MB) • http://www.isi.edu/nsnam/ns/ns-build.html#allinone • Get-the-pieces • http://www.isi.edu/nsnam/ns/ns-build.html#pieces • HTTP http://www.isi.edu/nsnam/dist/ • FTP ftp://ftp.isi.edu/nsnam/ • CVS http://www.isi.edu/nsnam/ns/ns-anoncvs.html MCLab CSE Dept, FAU
Download and Build NS2 (+) • Get-the-pieces • Tcl/Tk (Tool Command Language/Tool Kit) • otcl (object-oriented Tcl) • TclCL (or ibTcl) (Tcl/C++ interface) • NS-2 • Nam-1 • Awk (Aho, Weinberger, Kernighan), or • Perl (Practical Extraction and Report Language) • xgraph - an animation plotting program MCLab CSE Dept, FAU
NS2(v2.26) for Windows • Nicolas Christin • e-mail: nicolas@cs.virginia.edu • University of Virginia - Dept. of Computer Science • Last updated on 02/03/2003 or later • Building NS2 on Cygwin [versions 2.1b9a and 2.26] for Microsoft Windows • http://csl.ee.iastate.edu/~cpre543/ns2/ns2_howToInstall.htm MCLab CSE Dept, FAU
(+) What you need • cygwin-1.3.12 or later with UNIX text type • XFree86 binaries, sources and configuration files • the XFree86-base, XFree86-bin, XFree86-prog, XFree86-lib, and XFree86-etc packages. • The make and patch utilities • Also, diff, tar, gzip, w32api package • For ns-allinone-2.26 • http://www.isi.edu/nsnam/dist/ns-allinone-2.26.tar.gz • nam-1.9.configure • http://www.sims.berkeley.edu/~christin/software/nam-1.9.configure MCLab CSE Dept, FAU
(+) How long does it take • A full (Cygwin, XFree86, ns2) install+validation on a 1.6GHz P-4 with WindowsME • takes approx 3.5 hours • Only ns2 allinone (not Cygwin, XFree86) install+validation on a 2.0GHz P-4 with WindowsXP • takes (0.25+1) hours MCLab CSE Dept, FAU
(+) How to install NS2 • ns-allinone-2.26.tar.gz file in Cygwin home directory • nam-1.9.configure file in Cygwin home directory • Launch Cygwin, start an XFree86 server (using startx) • From your Cygwin (bash) prompt run: • gzip -d -c ns-allinone-2.26.tar.gz | tar xvf - • mv nam-1.9.configure ns-allinone-2.26/nam-1.9/configure • Now install everything by doing: • cd ns-allinone-2.26 • ./install MCLab CSE Dept, FAU
(+) Update env variables (~/.bashrc) • export NS_HOME=/home/XXX/ns-allinone-2.26/ • export PATH=$NS_HOME/tcl8.3.2/unix • :$NS_HOME/tk8.3.2/unix:$NS_HOME/bin:$PATH • export LD_LIBRARY_PATH=$NS_HOME/tcl8.3.2/unix • :$NS_HOME/tk8.3.2/unix • :\$NS_HOME/otcl-1.0a8:$NS_HOME/lib • :$LD_LIBRARY_PATH • export TCL_LIBRARY=$NS_HOME/tcl8.3.2/library MCLab CSE Dept, FAU
Building NS2(v2.26) for Windows (+) • Run the validation tests • cd ns-2.26 • ./validate • /home/XXX/ns-allinone-2.26/ns-2.26/validate • Done! MCLab CSE Dept, FAU
Building NS2 on UNIX/Linux • Linux Style: Network Simulator 2: a Simulation Tool for Linux • Posted on Monday, October 21, 2002 by Ibrahim F. Haddad and David Gordon • http://www.linuxjournal.com/article.php?sid=5929 MCLab CSE Dept, FAU
(+) ns2 allinone package • Download all-in-one package from the NS2 home page • http://www.isi.edu/nsnam/ns/ • into /usr/src • Extract it as follows, • cd /usr/src • tar xzvf ns-allinone-2.1b8.tar.gz • cd ns-allinone-2.1b8 MCLab CSE Dept, FAU
(+) SCTP patch • Get and apply the SCTP patch to NS2 • patch -p0 < ns-allinone-2.1b8.sctp-rel2.2_patch_orig • ./install • /usr/src/ns-allinone-2.1b8/install MCLab CSE Dept, FAU
(+) Update env variables (/etc/profile) • Export PATH=$CUR_PATH/bin • :$CUR_PATH/tcl$TCLVER/unix • :$CUR_PATH/tk$TKVER/unix • you'll be able to run itm/tclsh/wish/xgraph. • Update /etc/profile • "source /etc/profile" • Done! MCLab CSE Dept, FAU
Building NS2 on Linux (+) • To run the validation suite: • cd ./ns-2.1b8 • ./validate • /usr/src/ns-allinone-2.1b8/ns-2.1b8/validate MCLab CSE Dept, FAU
Problems and Bug Fixes • General Problems • I can't download ns from this web site • command not found • "apply a patch file“ – ftp.gnu.org • Validation under Windows does not work • NS (or otcl or tclcl) gets link errors • manually add the dll to ns's Makefile • set DISPLAY to machine:0.0 (setenv/export) MCLab CSE Dept, FAU
(+)Problems & Bug Fixes • Other Problems • NS 2.26 - all-in-one/Get-by-pieces • an old file crept its way into the release • Nam - "configure" script has a typo • edit nam-1.9/configure, ZLIB_VERS=1.1.4 (not 3) • xGraph • cannot open display - set DISPLAY • Tclcl/Otcl • Make sure header files are not missing • Lunix Systems • Intel Linux doesn't use IEEE arithmetic MCLab CSE Dept, FAU
Validation Tests • Validation Test in Windows • cd ns-2.26 • ./validate • /home/XXX/ns-allinone-2.26/ns-2.26/validate • Validation Test in Linux • cd ./ns-2.1b8 • ./validate • /usr/src/ns-allinone-2.1b8/ns-2.1b8/validate MCLab CSE Dept, FAU
Bug Reports • Report goes to the ns-users-list and ns-developers • http://www.isi.edu/cgi-bin/nsnam/reportbug.cgi • Contact Information (name, e-mail) • Environment (Pkg, Pkg-Ver#, OS, env) • Description (Category, Sub, Desc) MCLab CSE Dept, FAU
NS Communication Model • Nodes • Hosts, Routers 2 1 • Links • Queue Management • Queue Monitoring 3 UDP • Agents • Protocol 5 4 UDP Sink MCLab CSE Dept, FAU
Node Unicast Node n0 Port Classifier Addr Classifier Node entry Link 1 Link 2 MCLab CSE Dept, FAU
n0 n1 duplex link Link Link n0-to-n1 Head Tail enqH queue deqT n1 entry Node entry MCLab CSE Dept, FAU
Queue The Drop-Tail Queue, - implements FIFO scheduling - drop-on-overflow - typical buffer management of most present-day Internet routers MCLab CSE Dept, FAU
n0 n1 Port Classifier Addr Classifier 0 Node entry 1 Routing MCLab CSE Dept, FAU
n0 n1 Port Classifier Addr Classifier 1 0 0 1 entry Link n1-n0 Routing Port Classifier Addr Classifier entry Link n0-n1 MCLab CSE Dept, FAU
Agent/UDP Agent/UDPSink 0 0 0 1 1 0 Transport n0 n1 Port Classifier Port Classifier dst_= 1.0 Addr Classifier Addr Classifier entry Link n0-n1 entry Link n1-n0 MCLab CSE Dept, FAU
App/Traffic/CBR dst_=1.0 0 1 1 0 Application n0 n1 Port Classifier Port Classifier Agent/UDPSink Addr Classifier Addr Classifier Agent/UDP 0 0 entry Link n0-n1 entry Link n1-n0 MCLab CSE Dept, FAU
dst_=1.0 0 1 1 0 Packet Flow n0 n1 App/Traffic/CBR Port Classifier Port Classifier Addr Classifier Addr Classifier Agent/UDP 0 0 Agent/UDPSink entry Link n0-n1 entry Link n1-n0 MCLab CSE Dept, FAU
Things to Remember • Topology (nodes), agents, Applications • Connect the agents • Start/Stop the sources • Declare global variables before use • “$ns run” – last line MCLab CSE Dept, FAU
Conclusion • Installed NS2 in UNIX/Linux and Windows • Ran Simulation for both wired and wireless networks in NS2 • Very promising simulation tool for both wired and wireless(local and satellite) networks MCLab CSE Dept, FAU
Demo/Example • The example Tcl/Otcl script is for NS which simulates a simple network topology • This script shows how to • Create and set up nodes and links • send data from one node to another • monitor a queue • start Nam from the simulation script to visualize MCLab CSE Dept, FAU
Demo/Example Continue on Elmo projector… Questions? Abu Asaduzzaman aasaduzz@cse.fau.edu Thank You. MCLab CSE Dept, FAU