Skip to content

Install & Run ns3 lxc

Michael Albert edited this page Jun 15, 2017 · 4 revisions

Links

Setup

Dependencies

  • yaml-cpp - libyaml-cpp-dev

  • ns-3.26

  • LXC - lxc lxc-dev

  • CMake - cmake

  • GCC - gcc

YAML

  • Download yaml-cpp (libyaml-cpp-dev) and follow the install instructions.
  • You may have to download and install the Boost libraries as well (libboost-dev).

NS-3

  • Download the 3.26 NS-3 release to a directory (currently supported).
  • Run ./build.py.
  • cd into the built directory (usually "ns-3.26" or appropriate version). run CXXFLAGS="-std=c++11" ./waf -d debug --enable-examples --enable-tests configure this configures NS-3 for C++11.
  • The simulations output xml for NetAnim. NetAnim build instructions may be found here: https://www.nsnam.org/wiki/NetAnim_3.105#Building_and_Starting_NetAnim

LXC

  • Install LXC via package manager sudo apt install lxc.
  • Install LXC Dev for the headers sudo apt install lxc-dev.

Running the program for the first time

  • Edit the settings.yaml file to:
    • Reflect the path to ns-3 (the directory where the "waf" executable exists).
    • The appropriate temporary directories. You can create them or let the program create them for you.
  • build the program from the cloned directory by running:
cmake .
make -j8
  • If anything fails on the cmake/make stage, it is most likely because dependencies are not installed on the system properly
  • It is recommended to run the "resources/test_cases/testCase1.yaml" file first with the command bin/ns3lxc resources/test_cases/testCase1.yaml
  • NOTE: First run will take some time on the container creation phase, as it will download the appropriate template and you will see no output from this step. You can avoid this by creating a container manually via lxc of the appropriate type with a command such aslxc-create -n nodeName -t download and selecting the appropriate distro, release, and architecture.

Program Options (help text)

usage: 'sudo bin/ns3lxc pathToTopology [-n] [-c] [-s] [-g] [-h]'

  • -n: write only ns-3 script SUDO NOT REQUIRED
  • -c: cleanup mode, teardown bridges, taps, and containers
  • -s: spawn mode, do not teardown after simulation completion
  • -g: GDB mode, run ns-3 script with GDB
  • -h: show this help text