+ All Categories
Home > Engineering > 1 session installation

1 session installation

Date post: 16-Jul-2015
Category:
Upload: rahul-hada
View: 259 times
Download: 4 times
Share this document with a friend
Popular Tags:
37
1 Introduction to NS3 [Current release ns-3.21 ,Ongoing ns-3.22 tentative release Jan'15] Rahul Hada Mobile 9001806370 Email [email protected] Trainers
Transcript
Page 1: 1 session installation

1

Introduction to NS3

[Current release ns-3.21 ,Ongoing ns-3.22 tentative release Jan'15]

Rahul HadaMobile – 9001806370Email – [email protected]

Trainers

Page 2: 1 session installation

2

Workshop Outline

● Day-1– Introduction to NS3

– Prerequisites of software/packages

– Installation of NS3

– Configure NS3 with eclipse

– NS3 Architecture

– Reading code sample topology code

● Day-2– Mobility model

– Wifi Model

– Writing code [wireless network]

– Analysis of AODV routing protocol

– Attributes

– Tracing

– Gnuplot

Page 3: 1 session installation

3

RoadMap

● Session-1– First Half

● Introduction● Interface● Installation● Configuration● Folder Structure

– Second Half● Reading Code(Example-1)● Writing Code (Example-2)

Page 4: 1 session installation

4

NS-3 Overview

● Network Simulator version 3● Rewritten from scratch● An open source discrete event simulator

– Event model packet transmission , receipt , timers etc.

– Future events maintained in sorted Event List

– Processing events results in zero or more new events

● Developed for research and education.

Page 5: 1 session installation

5

NS-3 Overview

● It is started in year mid 2006– Still under heavy development

● Partially funded by US NSF “Community Resource Initiative”(CRI) grant

● Official funded by partners:– Univesity of Washington

● Tom Henderson , Craig Dowell

– INRIA,Sophia Antipolis● Mathiey Lacage

– Georgia Tech University(Atlanta)● Raj Bhattacharjea

Page 6: 1 session installation

6

NS-3 Basic

● Written in C++– Extensive use of Templates , Smart Pointer

Callback

– C++ namespace (ns3)

● Simulation programs are C++ executables● Python is used to bind public API's provided● NS3 is built as a library which may be linked

to a C++ main program defines the simulation topology and start the simulation.

Page 7: 1 session installation

7

Use of LibraryNS3 Library

<linked>

Building Topology & Start Simulation

MySim.ccMain Program

Page 8: 1 session installation

8

Key Features

● Trace output in ascii , or pcap format– Using existing pcap tools (Wireshark)

● Numerous trace points enabled via callbacks● Doxygen Documentation● Quarterly Releases● Attention to realism● Emulation mode

– Integration with real network/packets

– Real-time scheduling

Page 9: 1 session installation

9

Installation of NS3

● Best Platform is Linux – Step-1 Download – Step-2 Build Projects – Step-3 Testing– Step-4 Run Example

Easy to Install!!!!

Page 10: 1 session installation

10

Prerequisite package for Ubuntu● Mininal requirements:

– gcc,g++,python,python-dev● Debugging and GNU Scientific Library (GSL) support:

– gdb valgrind,gsl-bin,libgsl0-dev,libgsl0ldbl● Network Simulation Cradle (nsc):

– flex,bison● Reading pcap packet traces:

– tcpdump,wireshark● Database support for statistics framework:

– sqlite,sqlite3,libsqlite3-dev● Xml-based version of the config store:

– libxml2,libxml2-dev● A GTK-based configuration system:

– libgtk2.0-0, libgtk2.0-dev

Page 11: 1 session installation

11

Prerequisitesudo apt-get install gcc g++ python python-dev gdb valgrind gsl-bin libgsl0-dev libgsl0ldbl flex bison tcpdump sqlite sqlite3 libsqlite3-dev\ libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev\ vtun lxc doxygen graphviz imagemagick texlive \texlive-latex-extra texlive-generic-extra \texlive-generic-recommended texinfo dia \texlive-extra-utils texi2html python-pygraphviz \python-kiwi python-pygoocanvas libgoocanvas-dev \mercurial bzr libboost-all-dev

Page 12: 1 session installation

12

NS3Development Environment

● IDE – Eclipse CDT

● To READ and MODIFY code easily

● Doxygen– Documentation System for C,C++ etc.

● To UNDERSTAND the NS3 platform

Page 13: 1 session installation

13

Download

● Using a Tarball– Download from following link

● http://www.nsnam.org/ns-3-21/

Page 14: 1 session installation

14

Building● Building with build.py

– build.py program is used

– Command [goto directory ns-allinone/]● ./build.py --enable-examples --enable-tests

– By default test and examples are not set to build

● Building with waf– ./waf program is used

– Configure your project to build optimized version● ./waf clean● ./waf -d optimized –enable-example –enable-tests configure● ./waf clean● ./waf -d debug –enable-example –enable-tests configure

Page 15: 1 session installation

15

Open Ternimal

Page 16: 1 session installation

16

Goto ns3-allinone folder

Page 17: 1 session installation

17

Page 18: 1 session installation

18

Testing NS3

● By running – ./test.py -c core

● Output– 92 of 92 tests passed(92 passed , 0 failed , 0 crahed, 0 valgrind errors)

Page 19: 1 session installation

19

Running a Script

● Running Hello World Program– ./waf –run hello-simulator

● Running Example– Copy script's in example to scratch folder and it

will automatically be build it we run Waf.● cp examples/tutorial/first.cc scratch/

– Now Run your first script● ./waf –run scratch/first

– Check Output

Page 20: 1 session installation

20

Run Hello Simulator

Run first example

Page 21: 1 session installation

21

Output of first example program

Page 22: 1 session installation

22

Configure NS3 with Eclipse

● Download Linux version of Eclipse IDE for C/C++ Developer

– Step-1 Install Eclipse and Configure Mercurial

– Step-2 Configure Waf Builder

– Step-3 Configure Debugger

– Step-4 Create new source code and , run it● Use Eclipse for creating new source code, but run ns-3

for running it

Page 23: 1 session installation

23

Install Eclipse

Using synaptic

Search eclipse

Page 24: 1 session installation

24

Configure Eclipse

● Open Eclipse– Goto Help -> Install new Software

– http://cbes.javaforge.com/update– Click add

– and , select mercurialeclipse

– Click Next ->Click Finish

● Create new C++ Project and with your preferred name● Choose ns3 path

– /home/tiger/ns-allinone-3.xx/ns-3.xx

● Right click on the project and go to Team-Share Project.Then click on Next and select local Mercurial.

Page 25: 1 session installation

25

Install Plug-in[Mercurial]

Page 26: 1 session installation

26

Create C++ Project

Page 27: 1 session installation

27

NS3 Path

Page 28: 1 session installation

28

NS3 Source

Page 29: 1 session installation

29

Configure Waf Builder

● Right click on project and click on Properties.Then click on C/C++ build.After that unchecked the boxes :– Use default build command

– Generate make file automatically

● Insert this path as build command – /home/xxxx/ns-allinone-3.xx/ns.xx/waf

● Insert this path as build directory – /home/xxxx/ns-allinone-3.xx/ns.xx/build

● Click in Behavior tab and remove the all option in front of the Build (Incremental build) checkbox and then write build

Page 30: 1 session installation

30

Page 31: 1 session installation

31

Configure Debugger

● Go to Run-> Debug Configuration and create a New configuration

● Click on Browse button under the project section and select your project

● Click on the Search Project button under the C/C++ Application section and type scratch-simulator

● Go to Environment Tab and click on New button to create a new variable.You will need these– LD_LIBRARY_PATH

– /home/xxxx/ns-allinone3.xx/ns-3.xx/build● Be sure the “Append Environment to native environment”

is selected

Page 32: 1 session installation

32

Configure Debugger

Page 33: 1 session installation

33

Install NetAnim

● Latest version: NetAnim 3.105● Prerequisites

– Mercurial● sudo apt-get install mercurial

– QT4 development packages ● sudo apt-get install qt4-dev-tools

● Download NetAnim– http://code.nsnam.org/netanim

● Building and Starting NetAnim– cd netanim

– make clean

– qmake NetAnim.pro

– make

Page 34: 1 session installation

34

Video Lectures

● Objective – Contribution of CODE and VIDEO in NS3● Link

– https://newdemy.com/course/ns3-tutorials/

● Spreading Knowledge● Free! Online Course on NS3● Instructors

– Rahul Hada

– Hitesh Choudhary

Page 35: 1 session installation

35

Page 36: 1 session installation

36

● Write a command to build ns3 ?● How many source file are in ns3?● How to run example/second.cc topology

script ?● Why we are using Eclipse and Doxygen ?

Page 37: 1 session installation

37

To be continued...


Recommended