Skip to content

Installing and running ns-3 using free Kaggle Cloud Platform

This article presents a step-by-step procedure for installing and running ns-3 network simulations using the free resources provided by Kaggle Cloud Platform.

Note: The Complete Notebook file of this procedure can be downloaded from [3] and can be imported into your Kaggle account for easy installation of ns-3 on Kaggle.

 

The following are the major steps in this installation procedure:

  1. Setting up Kaggle environment
  2. Setting up a Persistent Storage
  3. Downloading ns-3 on the Persistent Storage
  4. Installing ns-3 on the Persistent Storage
  5. Running an example ns-3 simulation.

Step 1: Setting up Kaggle environment

  • Go to the Kaggle website: https://www.kaggle.com/account/login?phase=startRegisterTab&returnUrl=%2Fcode%2F.
  • Register in with your Google account.
  • Click on the “New Notebook” button (and you may rename the Notebook as according to the version that you are installing (for example you may rename it as ‘ns-3.37’)
  • Select the “Python” Language from the Notebook options menu.
  • You can now start writing code in your notebook.

Step 2: Setting up a Persistent Storage

Since Kaggle provides a persistent storage option, you can enable it from the Notebook options menu. For this, we have to ‘Files Only’ option from the PERSISTENCE combo box as shown below:

Now you have to change to the folder /kaggle/working/where you will have read, write (and execute) access. For that, you have to run the following command from the Jupyter Notebook.

%cd /kaggle/working/

Step 3: Downloading ns-3 on the Persistent Storage

Now you may download ns-3 from [2] and keep it under the /kaggle/working/ folder. For that, you have to run the following command from the Notebook.

!wget https://www.nsnam.org/releases/ns-allinone-3.37.tar.bz2

 

It will store the compressed file inside the folder ‘/kaggle/working/. Now we may extract the compressed file by running the following command from the Jupyter Notebook.

!tar -xvf ./ns-allinone-3.37.tar.bz2

Step 4: Installing ns-3 on the Persistent Storage

Now you may install ns-3 by running the following commands from the Jupyter Notebook.
Change to the ns-allinone-3.37/ns-3.37/ with in the /kaggle/working/ folder
%cd ns-allinone-3.37/ns-3.37/

Configure ns-3 by running the following commands from the Jupyter Notebook.

!./ns3 configure –enable-examples

Build ns-3 by running the following commands from the Jupyter Notebook.

!./ns3 build

The following output shows that the build operation has been completed after a few minutes

The following screenshot confirms the successful build operation.

Step 5: Running an example ns-3 simulation.

Run the Example simulation ‘first.cc’ provided with ns-3 by running the following commands from the Jupyter Notebook.

!./ns3 run first

The following output shows that the first time the compile operation took a few seconds.

The following is the output we will get while running the compiled simulation of fist.cc

Conclusion

This article shows the way to use the free computing and storage resources of Kaggle for doing ns-3 simulations. Even though the overall compile time was not good, it is possible to use it for running a large simulation (that may take, for example, 10 hours of CPU time).  It is possible to run a batch of simulations remotely using the free cloud resources.

In fact, there is no simple way to run Network Animations such as NetAnim through this facility and visualize the simulation output. However, it is possible to do quality analysis and produce graphs using the available tools of Jupyter Notebooks.

References

  1. https://www.kaggle.com/code
  2. https://www.nsnam.org/releases/ns-allinone-3.37.tar.bz2
  3. https://github.com/igs3000/ns-3-Turotials/blob/main/installing-ns-3-on-kaggle.ipynb
WhatsApp Discuss Through WhatsApp