NS3 Installation & Test Simulation Update

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

NS3 Installation & Test Simulation Update

To install ns-3 on Windows using MSYS2 with the MinGW64 toolchain---the following
methods can be employed

1. Git to clone the ns-3-dev repository,


2. Chocolatey is a package manager for Windows, and it can be used to install ns-3
3. ns-3 provides a Python wrapper that allows interaction with ns-3 using Python scripts. ns-3
can be installed from Python bindings from PyPI using pip (this is only a small subset of ns-
3 (primarily the Python API), and it may not have all the functionality available in the full
version.)
4. install and run ns-3 is by using Docker. This approach is particularly useful because it
abstracts away platform-specific installation issues and provides a consistent environment.

Git to clone the ns-3-dev repository----Steps to follow

 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.

Step 5: Run CMake to Configure the Build


 CMake is a build system generator. It allows you to configure your environment and specify
which modules and dependencies should be included when building ns-3.
 CMake generates the necessary build files (such as Makefiles or Ninja files) that make or
ninja will use to compile ns-3.
 Running CMake with the correct flags (like -DNETANIM=ON) enables specific features
(e.g., NetAnim support) that might be optional.
 This configuration step also checks that ns-3 has the correct dependencies (like Boost or
GTK) and ensures that the build environment is properly set up.
Step 6: Build ns-3 with Ninja
 Ninja (or Make, depending on your preference) is a build automation tool. After
configuring the project with CMake, you need a tool to actually compile the source code and
generate the executable.
o Ninja is often preferred because it’s faster and more efficient for incremental builds
than Make.
 Running ninja triggers the actual compilation process, compiling all the source files in ns-3,
linking libraries, and generating the executable binaries (including utilities, simulators, and
other components).
 If you don’t run this step, the ns-3 software won't be built, and you won’t be able to run or
test any simulations.
Step 6: Write and Run a Basic Simulation
 After building ns-3, you need to test the installation to ensure that everything works as
expected. Writing a simple simulation allows you to:
o Verify that ns-3 has been compiled correctly.

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.

You might also like