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.
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
Run the following command in your terminal to install ns-2:
sudo apt-get install -y ns2
Check your installation
You can check your installation by running a simple Tcl script.
- Create a file:
- Paste the following code in the file:
set a 20 set b 30 set c [expr $a+$b] puts $c
- Run in the terminal using ns-2:
Running a simple simulation
- Paste the following code in a file
- Run the simulation from the terminal using ns-2:
- Click on the play button to start the simulation:
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.
This website is open source.
Improve this page