Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Advanced Network Simulations Simplified

You're reading from   Advanced Network Simulations Simplified Practical guide for wired, Wi-Fi (802.11n/ac/ax), and LTE networks using ns-3

Arrow left icon
Product type Paperback
Published in Apr 2023
Publisher Packt
ISBN-13 9781804614457
Length 360 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Anil Kumar Rangisetti Anil Kumar Rangisetti
Author Profile Icon Anil Kumar Rangisetti
Anil Kumar Rangisetti
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Part 1: Exploring Network Simulator-3 (ns-3) Thoroughly and Quickly
2. Chapter 1: Getting Started with Network Simulator-3 (ns-3) FREE CHAPTER 3. Chapter 2: Monitoring, Debugging, Tracing, and Evaluating Network Topologies in ns-3 4. Chapter 3: ns-3 Key Building Blocks for Simulations 5. Part 2: Learn, Set Up, and Evaluate Wired and Wi-Fi (802.11a/b/g/n/ac/ax) Networks
6. Chapter 4: Setting Up and Evaluating CSMA/P2P LANs, Wi-Fi LANs, and the Internet 7. Chapter 5: Exploring Basic Wi-Fi Technologies and Setting Up and Evaluating Wireless Ad Hoc Networks 8. Chapter 6: Researching Advanced Wi-Fi Technologies – 802.11n, ac, and ax in ns-3 9. Part 3: Learn, Set Up, and Evaluate 4G Long-Term Evolution (LTE) Networks
10. Chapter 7: Getting Started with LTE Network Simulations Using ns-3 11. Chapter 8: Researching LTE Network Radio Resource Management and Mobility Management Using ns-3 12. Chapter 9: Researching LTE Advanced Networks: LTE HetNets and Interference Management Using ns-3 13. Index 14. Other Books You May Enjoy

Getting started with installing ns-3

There are many network simulation tools available as open source and proprietary solutions. In comparison to ns-2 and other simulation tools, ns-3 offers the following features:

  • The primary changes ns-2 users observe with ns-3 is the scripting language. Also, ns-2 support is limited to simple wired and Wi-Fi network simulation only.
  • ns-2 programs are written in Object-oriented Tool Command Language (OTcl), whereas ns-3 programs are written in C++ or Python.
  • ns-3 is open source software and has excellent support from the ns-3 team.
  • ns-3 is designed as a set of modules (internet, Wi-Fi, LTE, etc.) and users can extend existing modules and add new modules.
  • ns-3 is designed to be used in the command line as well as visualization mode.
  • ns-3 can be easily extended with data analysis and visualization tools.
  • ns-3 can be used on Linux, macOS, or Microsoft Windows operating systems.

In this section, you will start with the first hands-on task, which is installing ns-3 successfully. Let’s start by installing all necessary dependencies for ns-3:

  1. Install the core dependencies for ns-3 build essentials and compilation packages:
    sudo apt-get update
    sudo apt install build-essential libsqlite3-dev libboost-all-dev libssl-dev git python3-setuptools castxml
  2. Install the Python dependencies for ns-3 Python bindings:
    sudo apt install gir1.2-goocanvas-2.0 gir1.2-gtk-3.0 libgirepository1.0-dev python3-dev python3-gi python3-gi-cairo python3-pip python3-pygraphviz python3-pygccxml
  3. Install the dependencies for ns-3 features support, such as NetAnimator, gdb, and valgrind:
    sudo apt install g++ pkg-config sqlite3 qt5-default mercurial ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gdb valgrind uncrustify doxygen graphviz imagemagick python3-sphinx dia tcpdump libxml2 libxml2-dev cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake

Next, download the latest ns-3 version and follow the steps for installing it:

$ wget -c https://www.nsnam.org/releases/ns-allinone-3.36.tar.bz2
  1. Unzip or extract the downloaded file:
    $ tar -xvjf ns-allinone-3.36.tar.bz2
  2. Move to the following directory:
    $ cd ns-allinone-3.36/ns-3.36
  3. Next, configure the ns-3 modules using the build system. The ns3 command (available in the ns-allinone-3.36/ns-3.36 folder) makes use of a Python wrapper around CMake. It is similar to Waf in earlier ns-3 versions. The following command configures ns-3 modules with all example and test simulation programs:
    $ ./ns3 configure --enable-examples --enable-tests

After running this command, you can verify the list of modules configured in Figure 1.1:

Figure 1.1 – The list of ns-3 modules configured

Figure 1.1 – The list of ns-3 modules configured

  1. Next, build all the configured ns-3 modules using the following command. This command takes a while to complete:
    $ ./ns3 build

After executing the command, we can observe the list of modules linking successfully, as shown in Figure 1.2:

Figure 1.2 – ns-3 build process

Figure 1.2 – ns-3 build process

  1. Finally, you can check your installation by running all unit test cases provided in ns-3 modules:
    $ ./test.py

After executing this command, all test cases should either pass or be skipped. Then, a successfully installed NS-3.36 simulator is available (refer to Figure 1.3):

Figure 1.3 – ns-3 test cases execution

Figure 1.3 – ns-3 test cases execution

  1. After the successful build of ns-3, you have many example simulation programs ready to execute. Try running a first example simulation with the following command and observe the output:
    $ ./ns3 run first

Now, we are executing an example ns-3 simulation, first.cc. Refer to the execution results in Figure 1.4:

Figure 1.4 – The first.cc simulation execution results

Figure 1.4 – The first.cc simulation execution results

Congratulations! We have installed ns-3 successfully and tested a sample simulation. In the next section, we are going to learn how to write an ns-3 simulation program easily using Code::Blocks editor features. Thanks to the entire ns-3 team for providing detailed documentation on their website (https://www.nsnam.org) related to installing ns-3 with all features, tutorials, examples, and designs of various modules. We recommend you to go through the website for more details.

You have been reading a chapter from
Advanced Network Simulations Simplified
Published in: Apr 2023
Publisher: Packt
ISBN-13: 9781804614457
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime