How do I Compile in Ns2
We can proceed to compile network simulator 2 for that we have to follow some guidelines to get succeed in that process of compiling. Now, let’s get into the step by step process of Ns2 compiling.
Step: 1 Install Ns2 in Ubuntu
Initially, we have to change the package location through the execution of following commands for the installation of Ns2.
cd ns-allinone-2.31
![Changing Package Location](https://www.ns2project.com/wp-content/uploads/2023/06/change-the-package-location.png)
Following that, we have to install the Ns2 packages in Ubuntu through the implementation of the below mentioned commands.
sudo ./install
![](https://www.ns2project.com/wp-content/uploads/2023/06/install-the-NS2-in-ubuntu-2.png)
Step: 2 Configuration of Ns2 in Ubuntu
Then, we have to create the new source package code in Ns-2.35 with the file extension of .cc and .h and execute the following commands to configure the updated Ns2 source code in Ubuntu.
cd ns-2.31
sudo ./configure
![Configuration of Ns2](https://www.ns2project.com/wp-content/uploads/2023/06/Configure-NS2.png)
Step: 3 Compile Ns2 in Ubuntu
Consequently, we have to compile the updated Ns2 source code in Ubuntu by executing the following commands.
sudo make
![](https://www.ns2project.com/wp-content/uploads/2023/06/compile-NS2-in-ubuntu.png)
Step: 4 Run Ns2 Simulation in Ubuntu
Then, we have to create the Ns2 simulation main file with the file extension of .tcl and implement the following commands to run the simulation.
sudo ./ns main.tcl
![](https://www.ns2project.com/wp-content/uploads/2023/06/Run-NS2-simulation-in-ubuntu.png)
In addition, we have highlighted the acquired result of Ns2 simulation in the following.
![Result of Ns2 Simulation](https://www.ns2project.com/wp-content/uploads/2023/06/result-for-Run-NS2-simulation-in-ubuntu-1024x605.png)
Throw away all your hesitation and reach us to clarify your issues based on Ns2 compiling process.