Yes, we can ns-3-simu! - Internet Research...

47
. . . . . . . Intro. . . . . . . ns-3 Internal . . . . Starting ns-3 . . . . . . Hello World . . . . . . . . Zebra-ns3 . . . . . Dist Simulation . . . Utilities . . Yes, we can ns-3-simu! Hajime Tazaki [email protected] StarBED / Nebula Developers Workshop 2010 Summer Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 1 / 45

Transcript of Yes, we can ns-3-simu! - Internet Research...

Page 1: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

.

.Yes, we can ns-3-simu!

Hajime [email protected]

StarBED / Nebula Developers Workshop 2010 Summer

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 1 / 45

Page 2: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Objective of this tutorial

Know about• The feature of simulator• Basic operation of Network Simulator (ns-3)• Basic operation of ns-3-simu

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 2 / 45

Page 3: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s simulator?Work-flow of computernetwork relatedresearch

• Modeling(MATLAB)

• (Network)Simulation(ns-{2,3}, opnet,omnet++)

• Testbed(WIDE/Internet2,Planet-lab/ORBIT/StarBED)

• Deployment

!!"#$%&'()*+&,-./&0 1&,2$3(45&.5436#$7&6#$&8"39#$:&/;<"$27")3432#)

=#32>432#)

PlanetLab Linux

"#$%&'()*+,-./$+&0

1#2$3#4 5#6.&7,#0$5#2+80

Concept NS-2

OMNeT++

Network Cradle

Tossim

EmuLabFlexLab

Linux

Windows

Windows Mobile

TinyOS

RTOS

Embedded Linux

Model-Net Mesh

Testbed

WSNTestbed

EmStar

9/'+#$7)&:)1/'8

#$)*72

$#,2

9/'+#$7)&: );</.-/$+&0)1&&.2

=#>?,6.#,#0$

Network Research Work flowa

aOlaf Landsiedel, et. al. A virtual platform for networkexperimentation. VISA ’09. ACM.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 3 / 45

Page 4: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s simulator? (cont.)

Simulation Real world EmulationReal-time execution NO? YES USUALLY

Control level HIGH LOW HIGHCondition range LARGE SMALL LARGEResult realism LOW? HIGH MEDIUM

Experimentation cost LOW HIGH MEDIUMEase of use HIGH LOW MEDIUM

Table: Comparison of Experiment Techniques 1*

1R. Beuran, L.T. Nguyen, T. Miyachi, J. Nakata, K. Chinen, Y. Tan, and Y. Shinoda. QOMB: A wireless networkemulation testbed. In Proceedings of the 28th IEEE conference on Global telecommunications, pp. 2642–2647. IEEEPress, 2009.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 4 / 45

Page 5: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s simulator? (cont.)What “Simulator” can do:

• Reproduce-ableCan always reproduce single experiment

• Control-ableCan control the whole network entityEasy to control the 3-dimensional area (e.g. mobility model)

• Debug-ableAll the functionalities into single processAs a protocol design tool

• Scale-ableThe network size can potentially scale with the minimumvirtualization that only requires for network experiment

• Jump into imagination of your mindExperiment under unknown environment (bittorrent on quantamnetwork)Difficult executable experiment (UAN: Under-Water AcousticNetwork)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 5 / 45

Page 6: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Recent history (1995-2005)

(from Ns-3 tutorial2)• ns-2 became the main choice for research usage. Search of

ACM Digital Library papers citing simulation, 2001-04:

ns-2 OPNET QualNet/Glomosim≥ layer 4 123 (75%) 30 (18%) 11 (7%)= layer 3 186 (70%) 48 (18%) 31 (12%)≤ layer 2 114 (43%) 96 (36%) 55 (21%)

• Funding for ns-2 development dropped in the early 2000’s

2Slide from http://typo3.trilogy-project.eu/fileadmin/publications/Other/Lacage-NS3.pdf

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 6 / 45

Page 7: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Recent history(cont.)What is wrong about ns-2 ?

• Split object model (OTcl and C++) and use of Tcl:• Doesn’t scale well• Makes it difficult for students

• Large amount of abstraction at the network layer and belowleads to big discontinuities when transitioning from simulation toexperiment

• Accretion of unmaintained and incompatible models• Lack of support for creating methodologically sound simulations• Lack of, and outdated, documentation• In ns-2, validation really means regression: no documented

validation of the models, outside of TCP

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 7 / 45

Page 8: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Recent history(cont.)A recurring misconception

• Using ns-2 is actively harmful

• Simulation is ns-2

Thus, simulation is actively harmful

3

3Slide from http://typo3.trilogy-project.eu/fileadmin/publications/Other/Lacage-NS3.pdf

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 8 / 45

Page 9: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Recent history(cont.)A recurring misconception

• Using ns-2 is actively harmful

• Simulation is ns-2

Thus, simulation is actively harmful

3

3Slide from http://typo3.trilogy-project.eu/fileadmin/publications/Other/Lacage-NS3.pdf

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 8 / 45

Page 10: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Recent history(cont.)A recurring misconception

• Using ns-2 is actively harmful

• Simulation is ns-2

Thus, simulation is actively harmful

3

3Slide from http://typo3.trilogy-project.eu/fileadmin/publications/Other/Lacage-NS3.pdf

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 8 / 45

Page 11: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Where simulator goes?Restore the lost credibility of network simulator (NS)

• Avoiding the re-invention of the wheel ⇒ Avoid enbug• Actively reuse the source code that has running experience

Rumor concerning about ns-3• Merely see the people using ns-3 (thus, is unstable)• Supremacy of the research output• just A tool. we all have anything rather than ns-3• just a next version of ns-2? Paper generation tool?

Please calm down, guys....

(Reference: S. Kurkowski, T. Camp, and M. Colagrosso. Manet simulation studies: the incredibles. ACM SIGMOBILE

Mobile Computing and Communications Review, 2005.)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 9 / 45

Page 12: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Internal of ns-3, and ns-3-simu

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 10 / 45

Page 13: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s ns-3?

No need to debug with multiple language (Tcl/C++, C++/NED, etc.)• Core part of ns-3 is written as C++ library• Simulation executable is also C++• Can describe simulation script by not only C++, but Python

(Python is used just for assistance)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 11 / 45

Page 14: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s ns-3-simu?ns-3-simu: Application Binary Emulator

• Can run application on top of ns-3- without• porting• source code patching

• Confirmed application (2010/7/27)• ping• traceroute• iperf (only TCP)• iproute2• zebra (v4/v6, netlink)• ospfd• bgpd• olsr6d (by SFC okada-san)• zebra mndpd (by me)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 12 / 45

Page 15: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s ns-3-simu? (cont.)Core part of ns-3-simu

• Elf Binary LoaderLoad Positionindependentexecutable/code(-fPIC, -fPIE) withmodified dlmopen,then call mainsymbol

• Function RedirectionRedirect systemrelated function call,such as socket,open, write intons-3, not into kernelland.

Physical Machine

Operating System

Simulator

Emulationmalloc(), sendmsg()

Application(e.g. zebra w/ PIE file)

malloc(), sendmsg()(usual) libc

n1 n2 n10

dlopen ()+ dlsym("main")

override withweak_alias ()

Instance per (simulated) node

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 13 / 45

Page 16: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

What’s ns-3-simu? (cont.)

VoilÃa, real world application (zebra) can exist into ns-3..Example: TCP communication by Zebra Client..

.

(gdb) bt --------------#0 ns3::TcpSocketImpl::RecvFrom () ns-3 part (TCP)#1 0x00007ffff76f6262 in ns3::UnixStreamSocketFd::Recvmsg () --------------#2 0x00007ffff76ef018 in ns3::UnixSocketFd::Read ()#3 0x00007ffff76fda60 in simu_read () (redirected syscall)#4 0x00007ffff5fec8fc in read () (overrided symbol)#5 0x00007ffff64b13a9 in readn () --------------#6 0x00007ffff64af5b1 in stream_read ()#7 0x00007ffff64811f8 in zebra_client_read () zebra#8 0x00007ffff64a7c68 in thread_call ()#9 0x00007ffff648256d in main () main#10 0x00007ffff772dd6d in ns3::ElfLoaderSmart::LoadAndStartMain () --------------#11 0x00007ffff76d2766 in ns3::ProcessManager::StartProcess () ns-3 part#12 0x00007ffff76d5984 in ns3::ProcessManager::DoCreateThread ()#13 0x0000003c73a43750 in ?? () from /lib64/libc.so.6 --------------#14 0x0000000000000000 in ?? ()

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 14 / 45

Page 17: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Kernel emulation on user-landMoreover...Network Simulation Cradle4

• Re-implementation of TCP encourage re-enbug• Re-use existing operating system TCP code by converting as

library for simulator

Physical Machine

Operating System

Simulator

IP stack in Simulator(L3)->ForwardUp() linux-2.6.26

n1 n2 n10

Call as internal func.e.g. ip6_output()

Instance per (simulated) node

linux-2.6.18

FreeBSD 5.x

OpenBSD 3.x

lib-linux-2.6.26.so

Global Symbol VirtualizationLink to shared lib

Kernel Source Code

4Sam Jansen and Anthony McGregor. Simulation with real world network stacks. In WSC ’05: Proceedings of the37th conference on Winter simulation, pp. 2454–2463. Winter Simulation Conference, 2005.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 15 / 45

Page 18: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Kernel emulation (cont.)ns-3-linux (by Mathieu Lacage): Linux kernel converting into library..

.

(gdb) bt --------------#0 tcp_recvmsg ()#1 0x00007ffff5f2095e in inet_recvmsg ()#2 0x00007ffff5da0dd7 in __sock_recvmsg_nosec () linux kernel#3 __sock_recvmsg () (net-next-2.6)#4 sock_recvmsg () --------------#5 0x00007ffff5d87817 in sim_sock_recvmsg () ns-3-linux wrapper#6 0x00007ffff5d845e5 in sim_sock_recvmsg_forwarder () --------------#7 0x00007ffff75ccdc2 in ns3::LinuxSocketFdFactory::Recvmsg ()#8 0x00007ffff75d2e00 in ns3::LinuxSocketFd::Recvmsg ()#9 0x00007ffff75d2dae in ns3::LinuxSocketFd::Read ()#10 0x00007ffff7565846 in simu_read () redirected syscall#11 0x00007ffff547f9ec in read () overrided symbol#12 0x00007ffff50513a9 in readn () --------------#13 0x00007ffff504f5b1 in stream_read () zebra#14 0x00007ffff50211f8 in zebra_client_read ()#15 0x00007ffff5047c68 in thread_call () main#16 0x00007ffff502256d in main () --------------#17 0x00007ffff7534c75 in ns3::ProcessManager::DoStartProcess ()#18 0x00007ffff758dd32 in ns3::TaskManager::Trampoline () ns-3 part#19 0x00007ffff758bbe4 in ns3::PthreadFiberManager::Run ()#20 0x0000003c74206a3a in start_thread () --------------#21 0x0000003c73ade77d in clone ()#22 0x0000000000000000 in ?? ()

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 16 / 45

Page 19: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Starting ns-3

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 17 / 45

Page 20: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Today’s agenda

..1 Hello ns-3 using examples/tutorial/first.cc

..2 Running ospfd (zebra-0.95a) under the topology generated fromRocketfuel dataset usingexamples/process/quagga-rocketfuel.cc

..3 Distributed simulation using MPI andexamples/mpi/simple-distributed.cc

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 18 / 45

Page 21: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Install

Preparation• OS: Fedora 12, 64bit x86_64• Packages:

gcc, cloog-ppl, cpp, glibc-devel, gcc-c++, libstdc++-devel,python-devel, git, mercurial, valgrind, openmpi-devel,libsqlite3x-devel,(7/28 add )graphviz-python, python-pip, graphviz-devel,pygoocanvas,gnome-python2-gnomedesktop, gnome-python2-rsvg,python-kiwi

• debuginfo :debuginfo-install glibc

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 19 / 45

Page 22: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Install (cont.)

• pip:pip install pygraphviz

• SELinux: disabledsudo /usr/sbin/setenforce 0sudo vi /etc/selinux/config

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 20 / 45

Page 23: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Install (cont.)• ns-3-linux branch (by Mathieu Lacage).

http://code.nsnam.org/mathieu/ns-3-linux (2010/7/27)

.

.

mkdir ~/ns3cd ~/ns3/hg clone -r 13 http://code.nsnam.org/mathieu/ns-3-linuxwget http://www.sfc.wide.ad.jp/~tazaki/hg/ns-3-linux-patches/raw-file/96ac0b575eaa/poll_read.patchcd ns-3-linuxmake downloadpatch -p1 < ../poll_read.patchmake patchmake

building of iproute2.

.

cd ~/ns3/wget http://devresources.linuxfoundation.org/dev/iproute2/download/iproute2-2.6.33.tar.bz2tar jxf iproute2-2.6.33.tar.bz2cd iproute2-2.6.33make CCOPTS=’-fPIC’ LDFLAGS=-pie

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 21 / 45

Page 24: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Install (cont.)• ns-3-simu (my private branch).

http://code.nsnam.org/thehajime/ns-3-simu-quagga (2010/7/27under construction)

.Building ns-3-simu..

.

cd ~/ns3/hg clone http://code.nsnam.org/thehajime/ns-3-simu-quaggacd ns-3-simu-quagga./waf configure --with-linux-stack=../ns-3-linux./waf --build-quagga./wafcp ~/ns3/iproute2-2.6.33/ip/ip ./build/debug/

(After all, copy iproute2 to build/debug)waf: python based (...) make like build environment

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 22 / 45

Page 25: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Hello World

Subject 1 By using examples/tutorial/first.cc,Hello ns-3!.

.

./waf --run first

Waf: Entering directory ‘/home/tazaki/hgworks/ns-3-simu/build’Waf: Leaving directory ‘/home/tazaki/hgworks/ns-3-simu/build’’build’ finished successfully (9.293s)Sent 1024 bytes to 10.1.1.2Received 1024 bytes from 10.1.1.1Received 1024 bytes from 10.1.1.2

That’s it.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 23 / 45

Page 26: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Hello World (cont.)Looking into first.cc

• Simulation script by C++• Python binding is also available (first.py)

API Reference (doxygen)http://www.nsnam.org/doxygen-release/.

.

intmain (int argc, char *argv[]){

LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);

NodeContainer nodes;nodes.Create (2);

Creating the simulated node.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 24 / 45

Page 27: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Hello World (cont.)Create network device (example: Point-to-Point device).

.

PointToPointHelper pointToPoint;pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));

NetDeviceContainer devices;devices = pointToPoint.Install (nodes);

ns-3.9 supported device list

• bridge• csma• emu (MAC Emulation)• mesh (802.11s)• point-to-point

• tap-bridge• Under-water Acoustic Network

• virtual-net-device• wifi• wimax

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 25 / 45

Page 28: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Hello World (cont.)IP address configuration..

.

InternetStackHelper stack;stack.Install (nodes);

Ipv4AddressHelper address;address.SetBase ("10.1.1.0", "255.255.255.0");

Ipv4InterfaceContainer interfaces = address.Assign (devices);

• InternetStackHelperIPv4/IPv6 stack implemented inside ns-3. Initializing relatedcomponent (e.g., ARP, ICMP, rtable)

• Ipv4AddressHelperHelper library for the fixed address assignment

Basic topology is already configured.Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 26 / 45

Page 29: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Hello World (cont.)Application and traffic configuration running under created topology..

.

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));serverApps.Start (Seconds (1.0));serverApps.Stop (Seconds (10.0));

UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);echoClient.SetAttribute ("MaxPackets", UintegerValue (1));echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));echoClient.SetAttribute ("PacketSize", UintegerValue (1024));

ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));clientApps.Start (Seconds (2.0));clientApps.Stop (Seconds (10.0));

• UdpEchoServerHelper: Install UDP Echo server• echoServer.Install (): Echo server installation into node 1• UdpEchoClientHelper: Installation of UDP echo client• clientApps.Start/Stop(): Configuration of the timing of traffic generation

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 27 / 45

Page 30: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Hello World (cont.)

Let’s get started simulation..

.

Simulator::Run ();Simulator::Destroy ();return 0;

}//end of main

.

.

./waf --run first

Waf: Entering directory ‘/home/tazaki/hgworks/ns-3-simu/build’Waf: Leaving directory ‘/home/tazaki/hgworks/ns-3-simu/build’’build’ finished successfully (9.293s)Sent 1024 bytes to 10.1.1.2Received 1024 bytes from 10.1.1.1Received 1024 bytes from 10.1.1.2

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 28 / 45

Page 31: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simuSubject 2 Running ospfd (zebra-0.95a) under the topology generatedfrom Rocketfuel dataset usingexamples/process/quagga-rocketfuel.cc.

.

Ptr<TopologyReader> inFile = 0;TopologyReaderHelper topoHelp;NodeContainer nodes;string format ("Rocketfuel");string input ("examples/topology-read/RocketFuel_toposample_1239_weights.txt");

topoHelp.SetFileName(input);topoHelp.SetFileType(format);inFile = topoHelp.GetTopologyReader();if (inFile != 0)

{nodes = inFile->Read ();

}

• TopologyReaderHelper::Read () : Analyze node/link information from specified file.• Using Sprint (AS1239) dataset.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 29 / 45

Page 32: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)

Generating node object from Rocketfuel dataset..

.

int totlinks = inFile->LinksSize ();NS_LOG_INFO ("creating node containers");NodeContainer nc[totlinks];TopologyReader::ConstLinksIterator iter;int i = 0;for ( iter = inFile->LinksBegin (); iter != inFile->LinksEnd (); iter++, i++ )

nc[i] = NodeContainer (iter->GetFromNode (), iter->GetToNode ());

TopologyReader::ConstLinksIterator () : Create node object by iterated information.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 30 / 45

Page 33: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)Configuration of P2P device.

.

NetDeviceContainer ndc[totlinks];PointToPointHelper p2p;for (int i = 0; i < totlinks; i++)

// p2p.SetChannelAttribute ("Delay", TimeValue(MilliSeconds(weight[i])));p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));ndc[i] = p2p.Install (nc[i]);

NS_LOG_INFO ("creating ipv4 interfaces");Ipv4InterfaceContainer ipic[totlinks];for (int i = 0; i < totlinks; i++)

ipic[i] = address.Assign (ndc[i]);address.NewNetwork ();

p2p.EnablePcapAll ("quagga-rocketfuel");

• PointToPointDevice::Install (): Install P2P link for specified node pair.• Ipv4AddressHelper::Assign (): IPv4 address assignment to created link.• Configure Pcap output to all the p2p link

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 31 / 45

Page 34: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)

Running Quagga (Currently zebra-0.95a is the base version, actuallythough.).

.

ProcessManagerHelper processManager;processManager.Install (nodes);QuaggaHelper quagga;quagga.EnableOspf (nodes);quagga.Install (nodes);

• QuaggaHelper::Install (): Activate and configuration of Zebra (Auto generation ofzebra.conf)

• QuaggaHelper::EnableOspf (): Activate and configuration of OSPF (IPv4) (Autogeneration of ospfd.conf)

• Configure area 0 to all the interfaces

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 32 / 45

Page 35: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)(cont.)

.

.

router ospfnetwork 10.0.0.0/30 area 0network 10.0.0.12/30 area 0network 10.0.0.16/30 area 0

(snip)network 10.0.0.40/30 area 0network 10.0.0.8/30 area 0

!

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 33 / 45

Page 36: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)Let’s get started OSPF simulation..

.

% sudo ./waf -run quagga-rocketfuelRocketfuel topology created with 315 nodes and 972 links (from examples/topology-read/RocketFuel_toposample_1239_weights.txt)creating ip4 addressescreating node containerscreating net device containerscreating ipv4 interfacescreating all the routecreating quagga processTTL: 64End of experiment

To complete the simulation, takes 10 minutes runtime (60 secondssimulation) with Intel i5@ 2.67GHz.Remarks:

• sudo is required since setrlimit (2) is invoked internally.• Need to increase the limit of maxfd (default:1024) so that process

can open 315 nodes’ configuration file, socket, etc.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 34 / 45

Page 37: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)Looking log file..

.

% less files-0/processes/53513/stdout2008/04/04 13:45:22 OSPF: ========== OSPF routing table ==========2008/04/04 13:45:22 OSPF: N 10.0.0.0/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.02008/04/04 13:45:22 OSPF: N 10.0.0.4/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.02008/04/04 13:45:22 OSPF: N 10.0.0.8/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.02008/04/04 13:45:22 OSPF: N 10.0.0.12/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.02008/04/04 13:45:22 OSPF: N 10.0.0.16/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.02008/04/04 13:45:22 OSPF: N 10.0.0.20/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.02008/04/04 13:45:22 OSPF: N 10.0.0.24/30 0.0.0.0 intra-area 102008/04/04 13:45:22 OSPF: -> 0.0.0.0

• files-0: chroot-ed directory for node 0• processes: process information area for each node (stdout/stderr)• 53513: Process ID (arbitrary ID)• stdout: standard output

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 35 / 45

Page 38: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

ospfd into ns-3-simu (cont.)Looking generated pcap file..

.

zak-imac:~/hgworks/ns-3-simu% tcpdump -r quagga-rocketfuel-101-4.pcap -nreading from file quagga-rocketfuel-101-4.pcap, link-type PPP (PPP)09:00:04.002105 IP 10.0.4.177 > 224.0.0.5: OSPFv2, Hello, length 4409:00:12.100000 IP 10.0.4.178 > 224.0.0.5: OSPFv2, Hello, length 4409:00:13.104210 IP 10.0.4.177 > 224.0.0.5: OSPFv2, Hello, length 44(snip)09:00:34.104210 IP 10.0.4.178 > 224.0.0.5: OSPFv2, Hello, length 4809:00:43.002087 IP 10.0.4.177 > 10.0.4.178: OSPFv2, Database Description, length 3209:00:43.104217 IP 10.0.4.177 > 224.0.0.5: OSPFv2, Hello, length 4809:00:44.104210 IP 10.0.4.178 > 224.0.0.5: OSPFv2, Hello, length 4809:00:48.002087 IP 10.0.4.177 > 10.0.4.178: OSPFv2, Database Description, length 3209:00:51.100000 IP 10.0.4.178 > 10.0.4.177: OSPFv2, Database Description, length 32(snip)09:00:51.134125 IP 10.0.4.177 > 10.0.4.178: OSPFv2, Database Description, length 3209:00:51.134125 IP 10.0.4.178 > 10.0.4.177: OSPFv2, LS-Request, length 140409:00:51.134218 IP 10.0.4.177 > 10.0.4.178: OSPFv2, LS-Request, length 3609:00:51.136407 IP 10.0.4.178 > 224.0.0.5: OSPFv2, LS-Update, length 13609:00:51.142637 IP 10.0.4.177 > 224.0.0.6: OSPFv2, LS-Update, length 1372

It’s working!

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 36 / 45

Page 39: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Distributed Simulation

10 minutes runtime for 60 seconds previous simulation withRocketfuel dataset.

• 10 times runtime !• Wi-Fi, mobility calculation seems to take heavy load

.

.Improvement of simulation runtime with distributed CPU processingby using MPI (Message Passing Interface)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 37 / 45

Page 40: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Distributed Simulation (cont.)

.

.

intmain (int argc, char *argv[]){LogComponentEnable ("QuaggaRocketfuelMpi", LOG_LEVEL_INFO);

#ifdef NS3_MPIMpiInterface::Enable (&argc, &argv);GlobalValue::Bind ("SimulatorImplementationType",

StringValue ("ns3::DistributedSimulatorImpl"));

uint32_t systemId = MpiInterface::GetSystemId ();uint32_t systemCount = MpiInterface::GetSize ();

• MpiInterface::Enable (): Declaration of MPI• Modify the scheduler to ns3::DistributedSimulatorImpl• Distribute the process by systemId

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 38 / 45

Page 41: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Distributed Simulation (cont.)

.

.

if (systemId == 1){

(snip)PacketSinkHelper sink = PacketSinkHelper ("ns3::Ipv4RawSocketFactory", dst);ApplicationContainer apps = sink.Install (randomServerNode);

(snip)if (systemId == 0)

{(snip)

ApplicationContainer apps = onoff.Install (clientNodes);apps.Start (Seconds (1.0));apps.Stop (Seconds (2.0));

}

• If systemId is 1, then executed as a traffic receiver• If systemId is 0, then executed as a traffic transmitter

Distribute heavy processing such as burst traffic.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 39 / 45

Page 42: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Distributed Simulation (cont.)

Finally, requires specialized build for MPI..../waf configure --with-linux-stack=../ns-3-linux --enable-mpi./waf build

Run with MPI.../usr/lib64/openmpi/bin/mpirun -np 2 ./waf --run quagga-rocketfuel-mpi

• Without MPI (Subject 2): 10 minutes• With MPI (2LP both at localhost): 41 minutes• With MPI (2LP both are different host): (Not yet)

Getting slow down with MPI (Consider the method of partitioning)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 40 / 45

Page 43: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Distributed Simulation (cont.)Next, distribute OSPF process since the SPF calculation with 315nodes and 972 links seems to be heavy..

.

if (systemId == 1){QuaggaHelper quagga;quagga.EnableOspf (nodes_group1);quagga.Install (nodes_group1);

if (systemId == 0){QuaggaHelper quagga;quagga.EnableOspf (nodes_group2);quagga.Install (nodes_group2);

}

• Without MPI (Subject2): 10 minutes• With MPI (2LP both at localhost): (Not yet)• With MPI (2LP both are different host): (Not yet)

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 41 / 45

Page 44: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Other Utilities

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 42 / 45

Page 45: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

PyVizPython based visualizer.

• Show the location of simulated node (with movement)• Visualize animation of the packet tx/rx status• Miscellaneous information of the Node (netstat, ifstat, etc)

Figure: Sprint (AS1239) with Rocketfuel topologyHajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 43 / 45

Page 46: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

With Anybed ospf (WIDE-BB)Simulation script can be written by python (with pybindgen)

• ⇒ python based script can also be usable• ospfwak.py in Anybed

• Can use show ip ospf databae and MIB information for thetopology generation

.

.

import ospfwalkospfwalk.parse_show_ip_ospf_database_router(

open("./show_ospf_db_r_wide.txt", "r").read(), rlsas, rlsas_dic)ospfwalk.parse_show_ip_ospf_database_network(

open("./show_ospf_db_n_wide.txt", "r").read(), nlsas, nlsas_dic)

for router in routers:n = ns3.Node();internet.Install(n);nodes.Add(n);

something like that.

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 44 / 45

Page 47: Yes, we can ns-3-simu! - Internet Research Lab.web.sfc.wide.ad.jp/~tazaki/distfiles/ns3/ns-3-tutorial-en.pdf · Yes, we can ns-3-simu! ... Objective of this tutorial Know about ...

. . . . . . .Intro.

. . . . . .ns-3 Internal

. . . .Starting ns-3

. . . . . .Hello World

. . . . . . . .Zebra-ns3

. . . . .Dist Simulation

. . .Utilities

Resources

• ns-3 Web site: http://www.nsnam.org• Developer mailing list: http://mailman.isi.edu/mailman/listinfo/ns-developers

• User mailing list:http://groups.google.com/group/ns-3-users

• IRC: #ns-3 at irc.freenode.net• Tutorial: http://www.nsnam.org/docs/tutorial/tutorial.html

• Code server: http://code.nsnam.org• Wiki:http://www.nsnam.org/wiki/index.php/Main_Page

Hajime Tazaki (Keio University) ns-3 or die SNDW, 27th July, 2010 45 / 45