Skip to content

Installing ns-3-dev Under chroot Jail and Compile with CMake

In a previous article, we explained the way of installing ns-3.35 under chroot jail. But installing ns-3-dev, in the same way, is not possible under chroot jail because, ns-3-dev  configure and compile process will not allow running configure and compile script ‘ns3’ as root user which is the default user privilege under chroot.

In this article, we will see a trick to install ns-3-dev under chroot-jail

The following article explains a chroot jail based installation of ns-3.35.

Installing ns3.35 in Debian 10 chroot Jail Under Debian 11 Host OS or any Version of Linux Host

 

That article explained the following :

  1. Problems that we face during installing ns-3 under Native and Virtual Hardware/OS,
  2. Chroot based Virtualization,
  3. Advantages of installing ns-3 Under Chroot Jail Based Virtualization.
  4. Installation of Debian 10 Buster (64 bit) chroot Jail Environment under Debian 11
  5. Installation of ns-3 Under Chroot Jail and and
  6. Installation of NetAnim Under Chroot Jail

In the above-mentioned steps, instead of installing ns-3.35 at the 5th step, we are going to install ns-3-dev version as per the following procedure since we can not install the latest ns-3-dev in the same way since the installation script “ns3” will not allow us to run it as root user.

This procedure assumes that the user already set up a chroot jail and installed a suitable Linux OS under it. (I mean, up to step 4 in the above-mentioned list).

 

Installation of ns-3-dev under chroot

Step 1: Downloading ns-3-dev using “git”

You may download a compressed version of ns-3-dev or directly clone it using “git” command. The following shows the way of cloning ns-3-dev project repository using “git” command.  Here we try to install ns-3-dev under a folder named “/home” (even though /root is the default privileged home directory of the user root under chroot jail)

$ cd /home
$ git clone https://gitlab.com/nsnam/ns-3-dev.git

The above command will clone the entire ns-3-dev project under the folder home. So, now the folder /home/ns-3-dev will contain the dev

Step 2: Editing the configuration and installation script “ns3”

The following shows the section/lines that needed to be edited.

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

 

Step 3: Configure the ns-3-dev

$ cd /home/ns-3-dev
$ ./ns3 configure –enable-examples –enable-tests
The following screenshot shows the successful “configure operation” in which you can see the modules that are configured to build.

Step 4: Compiling ns-3-dev

$ cd /home/ns-3-dev
$ ./ns3
Running the script from the folder ~/ns-3-dev will compile ns-3-dev using CMake.

The following screenshot shows the successful compilation of ns-3-dev under chroot jail.

Step 4: Testing the Installation by Running an Example

We may test the installation by running the example script firs.cc as follows:

$ cd /home/ns-3-dev
$ ./ns3 run first
The following screenshot shows the installation completed well so that the example script is running and producing outputs correctly.

 

Final Note :

The important thing we have to understand here is, the application which is running under chroot jail environment will get the native or near-native performance of the Host OS and Host hardware. So, we are getting the native software and hardware performance under this unique virtualization technology. So that the ns-3 compile process also gets accelerated and get near-native software and hardware performance.

Some Examples of “chroot-jail” based ns-3 Simulations

In the following articles, you may find some of the simulations that I did under chroot jail. Please note the excellent performance of these GUI-based 3D simulations. In fact, these simulations are actually running under chroot jail but the GUI 3D outputs are rendered in the Host Display’s windowing system. So that these simulations are getting the native 3D performance.  One will never get such a level of performance under any other kind of virtualization like “VirtualBox”.

References:

  1. https://www.nsnam.org/wiki/Installation
  2. https://en.wikipedia.org/wiki/Chroot
  3. https://www.projectguideline.com/installing-ns3-35-in-debian-10-chroot-jail-under-debian-11-host-os-or-any-version-of-linux-host/
  4. https://www.nsnam.org/docs/tutorial/html/getting-started.html
WhatsApp Discuss Through WhatsApp