ns-3 tutorial Katto lab Tadashi Yamazaki 8 November 2012
2 Outline Introduction Getting started Design Demonstration References
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.
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++ and others in OTcl. In ns-3, the simulator is written entirely in C++, with optional Python bindings.
5 Introduction The ns-3 simulation core supports research on both 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.
6 Getting started The waf build system Waf is a Python-based framework for configuring, compiling and installing applications. ./configure →./waf – d [optimized-debug] configure ./make →./waf Run programs:./waf – run [program name]
7 Getting started Downloading ns-3 ns-3 is primarily developed on GNU/Linux platforms, and the minimal requirements to run basic simulations are a gcc installation of gcc-3.4/g or greater, and python 2.4 or greater.
8 Getting started Downloading ns-3 Download and build development version: Ns-3 installation:
9 Design Where is everything located?
10 Design The basic model
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.
12 Design Available modules
13 Design Adding a New Module to ns-3 Ns-3 manual: new-modules.html
14 Design Structure of an ns-3 program
15 Demonstration Run sample script: ns-3.*/examples/ ns-3.*/src/[module(ex. aodv)]/examples Run programs:./waf --run [program name]
16 Demonstration Debug(gdb):./waf --command-template="gdb %s" -- run [program name] Debug(LOG): export NS_LOG=[LOG component name]=[LOG level]
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 program progress; NS_LOG_FUNCTION — Log a message describing each function called; NS_LOG_LOGIC – Log messages describing logical flow within a function; NS_LOG_ALL — Log everything.
18 Demonstration first.cc Very simple script 2 nodes Daterate: 2Mbps Delay: 2ms Simulation time: 9s
19 Demonstration Run first.cc (ns-3.*/examples/first.cc) cd ns-3.*/examples./waf --run first
20 Demonstration Debug(LOG) (ns-3.*/examples/udp/udp-echo.cc) export NS_LOG=UdpEchoClientApplication=level_all./waf --run udp-echo
21 References ns-3: ns-3 tutorial: al/singlehtml/index.html ns-3 Doxygen: ns-3 users groop: users?hl=ja
THANK YOU!