NS3 Installation & Test Simulation Update
NS3 Installation & Test Simulation Update
NS3 Installation & Test Simulation Update
To install ns-3 on Windows using MSYS2 with the MinGW64 toolchain---the following
methods can be employed
MSYS2 and its package manager set up the development environment on Windows.
The development tools (git, gcc, make, cmake) are needed for downloading, configuring,
compiling, and building ns-3.
Dependencies like GTK3, Boost, and Python provide necessary functionality for features
such as visualization, data handling, and optional modules in ns-3.
Cloning the repository gives you access to the latest code from GitHub.
CMake configures the build system, ensuring the correct environment and dependencies.
Building with Ninja compiles ns-3, generating the necessary binaries.
Writing and running a simple simulation tests your installation to ensure everything works
as expected.
NetAnim is helpful visualization tool for analyzing your simulation results.
Steps in Detail
Step1: Install & Update MSYS2 and Install Basic Tools
MSYS2 provides a Unix-like environment on Windows that allows you to run tools such as
Git, CMake, Make, and others that are traditionally used in Linux-based systems. Without
MSYS2, these tools would not be available natively on Windows.
MSYS2 provides a package manager (pacman), making it easier to install and update
development tools and libraries that are required to build and run ns-3.
Updating MSYS2 ensures that your installation is using the latest versions of packages and
tools, which can contain important security fixes, optimizations, or new features.
Step 2
Installing development tools like Git, gcc, make, and cmake is essential because:
o Git is required to clone the ns-3 repository from GitHub or GitLab.
o GCC (GNU Compiler Collection) is needed to compile the source code of ns-3.
o Make (or Ninja) is used to automate the build process once the project is
configured.
o CMake is used to configure the build system and generate the appropriate files for
make or ninja to compile ns-3.
Step 3: Install Dependencies (GTK3, Boost, Python)
ns-3 depends on a number of external libraries to enable different features. These libraries provide
important functionalities for simulation, visualization, and debugging. Here’s why each one is
important:
GTK3: This library is required for NetAnim, a graphical animation tool for visualizing
network simulations. If you want to visualize your simulations, this library is necessary.
Boost: Boost is a collection of powerful C++ libraries. ns-3 uses Boost for a variety of
features, such as handling data structures, utilities, and multithreading. Some optional
modules or features of ns-3 may not work without Boost.
Python: Python is optional but highly useful for scripting and automating parts of the
simulation process. It’s also important if you plan to use the PyViz visualizer, which allows
you to create visualizations of your simulations with Python scripts
By installing these dependencies beforehand, you're ensuring that ns-3 can compile and run correctly,
with full functionality for your simulations.
Step 4:
Clone ns-3 Repository from GitHub
Git is the version control system used by ns-3 developers to manage and distribute the code.
The ns-3 repository is hosted on GitHub (or GitLab for the main development branch), and by
cloning the repository, you’re downloading the latest source code to your local machine.
Cloning the repository ensures that you’re working with the most up-to-date version of ns-3,
which includes the latest features, bug fixes, and improvements.
This step also ensures that you're starting with the correct project structure, which CMake
and Make will need to build the software.
o Ensure that basic simulation functionality (e.g., creating nodes, installing devices,
configuring applications) is working.
o Test the runtime environment, including whether NetAnim (if enabled) produces
expected results.
Running a simple simulation (e.g., a basic point-to-point communication model) is a simple
way to confirm that ns-3 is functioning, and there are no compilation or environment issues.
Error: The error message -bash: ./waf: No such file or directory indicates that the waf build system
script is missing from ns-3-dev directory, which is why the ./waf command cannot be found.
waf is a build system used by ns-3 (and some other projects) to automate the process of compiling
and linking code. It is a lightweight and flexible build system, written in Python, designed to replace
more traditional build systems like Make or CMake in certain contexts.
Step 7: Verify NetAnim
NetAnim is a graphical animation tool for visualizing network simulations in ns-3. If you
plan to visualize your simulation results, this step is crucial.
When you use NetAnim, you can view your network topology and the behavior of your
simulation in real-time (or via a playback of recorded results). This is very useful for
understanding the behavior of your network simulation and debugging it.
Running NetAnim with a generated .xml file from a simulation enables you to:
o Check the output of your simulation visually.
o See how data packets flow between nodes and how your network is behaving.