NS‑2: Install & Run on Ubuntu/Debian (Simplified Guide)

 


🛠️ Step 1: Install NS‑2

Open the terminal and run:

sudo apt-get update sudo apt-get install ns2

This installs the NS‑2 simulator package.


📦 Step 2: Install NAM (Network Animator)

To get the graphical user interface for NS‑2:

sudo apt-get purge nam # Remove any old versions

Then download the appropriate .deb file and install it:

sudo dpkg -i ~/nam_1.15-10-ubuntu14_amd64.deb sudo apt-mark hold nam # Prevent it from being overwritten

This ensures NAM remains installed and stable.


✅ Step 3: Verify NS‑2 Installation

You should now have both NS‑2 and NAM installed successfully.


🚀 Step 4: Run Simulation

  1. Create a .tcl script in your home folder—give it any name like filename.tcl
  2. In terminal, execute:

    ns filename.tcl
    • This runs the simulation and outputs terminal results.

    • It also generates an output file, usually named out.nam


🎬 Step 5: View Network Animation

To visualize the simulation:

nam out.nam

This opens the NAM graphical interface. You can explore and interact with the network simulation visually.


💡 Tips & Troubleshooting

  • Ensure you run these commands with proper user permissions.

  • If nam isn’t found, double-check the .deb filename and installation path.

  • Always confirm your .tcl scripts are correctly formatted and located in your home directory.


❓ Questions?

Drop your queries in the comments below—happy to help!