First download ns-3 from https://www.nsnam.org/ns-3-26/download/. We are using ns-3.26 in this recipe. Extract the downloaded archive and run from the root directory ns-allinone-3.26:
$ ./build.py.
Since the allinone folder contains all the bundles, this build will consume a few minutes.
It shows the following upon the completion of the build:
'build' finished successfully (14m22.645s) Modules built: antenna aodv applications bridge buildings config-store core csma csma-layout dsdv dsr energy fd-net-device flow-monitor internet internet-apps lr-wpan lte mesh mobility mpi netanim (no Python) network nix-vector-routing olsr point-to-point point-to-point-layout propagation sixlowpan spectrum stats tap-bridge test (no Python) topology-read traffic-control uan virtual-net-device wave wifi wimax Modules not built (see ns-3 tutorial for explanation): brite click openflow visualizer Leaving directory `./ns-3.26'
In the preceding snippet, you may notice that a few modules including openflow are not built when built from the root directory. This is the expected behavior.
You may test ns-3 for one of the existing simulations. First go to the ns-3.26 directory:
$ cd ns-3.26
Now, let's test the bench-simulator included in ns-3. We will use waf, a Python-based build tool for this:
$ ./waf --run bench-simulator Waf: Entering directory `/home/pradeeban/programs/ns-allinone-3.26/ns-3.26/build' Waf: Leaving directory `/home/pradeeban/programs/ns-allinone-3.26/ns-3.26/build' Build commands will be stored in build/compile_commands.json 'build' finished successfully (1.473s) ns3.26-bench-simulator-debug: ns3.26-bench-simulator-debug: scheduler: ns3::MapScheduler ns3.26-bench-simulator-debug: population: 100000 ns3.26-bench-simulator-debug: total events: 1000000 ns3.26-bench-simulator-debug: runs: 1 ns3.26-bench-simulator-debug: using default exponential distribution Run # Inititialization: Simulation: Time (s) Rate (ev/s) Per (s/ev) Time (s) Rate (ev/s) Per (s/ev) ----------- ----------- ----------- ----------- ----------- (prime) 0.72 138889 7.2e-06 2.84 352113 2.84e-06 0 0.23 434783 2.3e-06 2.94 340136 2.94e-06
The screenshot of this simple bench simulation is as follows:
Bench Simulation with ns-3