Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

22
ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012

Transcript of Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

Page 1: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

ns-3 tutorial

Katto labTadashi Yamazaki

8 November 2012

Page 2: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

2

Outline

Introduction Getting started Design Demonstration References

Page 3: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

3

Introduction

The ns-3 simulator is a discrete-event network simulator targeted primarily for research and educational use.

The ns-3 project, started in 2006, is an open-source project developing ns-3.

Page 4: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

4

Introduction

Ns-3 is not an extension of ns-2. Ns-3 does not support the ns-2 APIs. Programs in ns-2 are scripted in OTcl. Some components of ns-2 are written in C++ a

nd others in OTcl. In ns-3, the simulator is written entirely in C++,

with optional Python bindings.

Page 5: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

5

Introduction The ns-3 simulation core supports research on bot

h IP and non-IP based networks. The large majority of its users focuses on wireless

/IP simulations which involve models for Wi-Fi, WiMAX, or LTE for layers 1 and 2 and a variety of static or dynamic routing protocols such as OLSR and AODV for IP-based applications.

Page 6: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

6

Getting started

The waf build system Waf is a Python-based framework for configurin

g, compiling and installing applications. ./configure

→ ./waf –d [optimized-debug] configure

./make →./waf Run programs:

./waf –run [program name]

Page 7: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

7

Getting started

Downloading ns-3 ns-3 is primarily developed on GNU/Linux platf

orms, and the minimal requirements to run basic simulations are a gcc installation of gcc-3.4/g++-3.4 or greater, and python 2.4 or greater.

Page 8: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

8

Getting started Downloading ns-3

Download and build development version:

Ns-3 installation:http://www.nsnam.org/wiki/index.php/Installation

Page 9: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

9

Design

Where is everything located?

Page 10: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

10

Design

The basic model

Page 11: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

11

Design

Channel CsmaChannel PointToPointChannel WifiChannel …

Net Device A net device is “installed” in a Node in order to

enable the Node to communicate with other Nodes in the simulation via Channels.

Page 12: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

12

Design

Available modules

Page 13: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

13

Design

Adding a New Module to ns-3 Ns-3 manual:

http://www.nsnam.org/docs/manual/html/new-modules.html

Page 14: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

14

Design

Structure of an ns-3 program

Page 15: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

15

Demonstration

Run sample script: ns-3.*/examples/ ns-3.*/src/[module(ex. aodv)]/examples

Run programs: ./waf --run [program name]

Page 16: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

16

Demonstration

Debug(gdb): ./waf --command-template="gdb %s" --run [pro

gram name] Debug(LOG):

export NS_LOG=[LOG component name]=[LOG level]

Page 17: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

17

Demonstration Debug(LOG)

LOG level NS_LOG_ERROR— Log error messages; NS_LOG_WARN— Log warning messages; NS_LOG_DEBUG— Log relatively rare, ad-hoc debugging

messages; NS_LOG_INFO— Log informational messages about pro

gram progress; NS_LOG_FUNCTION— Log a message describing each f

unction called; NS_LOG_LOGIC– Log messages describing logical flow

within a function; NS_LOG_ALL— Log everything.

Page 18: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

18

Demonstration

first.cc Very simple script 2 nodes Daterate: 2Mbps Delay: 2ms Simulation time: 9s

Page 19: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

19

Demonstration

Run first.cc (ns-3.*/examples/first.cc)

cd ns-3.*/examples ./waf --run first

Page 20: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

20

Demonstration

Debug(LOG) (ns-3.*/examples/udp/udp-echo.cc) export NS_LOG=UdpEchoClientApplication=level_all ./waf --run udp-echo

Page 21: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

21

References ns-3:

http://www.nsnam.org/ ns-3 tutorial:

http://www.nsnam.org/docs/release/3.14/tutorial/singlehtml/index.html

ns-3 Doxygen: http://www.nsnam.org/doxygen/index.html

ns-3 users groop: http://groups.google.com/group/ns-3-users?hl=ja

Page 22: Ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012.

THANK YOU!