Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
103 lines (77 sloc) 3.09 KB
layout classes author toc toc_sticky title header excerpt sidebar
single
wide
Abhijeet Singh
true
true
Install NS2 (Network Simulator) on Ubuntu 18.04
image teaser
/assets/images/ns2/ns2-header.png
/assets/images/ns2/ns2-teaser.jpg
NS2 is an open-source simulation tool that runs on Linux. It is a discreet event simulator targeted at networking research.
title image image_alt text
NS2
/assets/images/ns2/ns2-teaser.jpg
image
A Simulation Tool for Linux
title text
Installation
Instructions provided for Ubuntu 18.04

Introduction

NS2 is an open-source simulation tool that runs on Linux. It is a discreet event simulator targeted at networking research and provides substantial support for simulation of routing, multicast protocols and IP protocols, such as UDP, TCP, RTP and SRM over wired and wireless (local and satellite) networks.


Pre-requisites

To view your network simulation traces made using ns-2, you'll need Nam: Network Animator.

Nam is a Tcl/TK based animation tool for viewing network simulation traces and real world packet traces. It supports topology layout, packet level animation, and various data inspection tools.

Install it by running the following command in your terminal:

sudo apt-get install -y nam

{: .align-center}


Installation

Run the following command in your terminal to install ns-2:

sudo apt-get install -y ns2

{: .align-center}


Check your installation

You can check your installation by running a simple Tcl script.

  1. Create a file:
    gedit add.tcl
  2. Paste the following code in the file:
    set a 20
    set b 30
    set c [expr $a+$b]
    puts $c
  3. Run in the terminal using ns-2:
    ns add.tcl
    {: .align-center}

Running a simple simulation

  1. Paste the following code in a file simple.tcl:

    <script src="https://gist.github.com/cseas/3639de92b03cc27ca3c480b3a0d3af90.js"></script>
  2. Run the simulation from the terminal using ns-2:

    ns simple.tcl
  3. Click on the play button to start the simulation: {: .align-center}

If you are a beginner to network simulation, you can find the explanation for the above script here.

The ns-allinone-2.31 package is available here if needed.


Contribute

This website is open source. ♥️
Improve this page

You can’t perform that action at this time.