0% found this document useful (0 votes)
87 views9 pages

Install NS2 on Windows 10/11 Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views9 pages

Install NS2 on Windows 10/11 Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

INSTALLATION PROCEDURE FOR NS2 ON WINDOWS 10/11

STEP 1
Turn on Developer Mode
Open search (Windows + S) and type “developer settings” and click on Open as shown below:

Turn on the option “Install apps from any source…” as shown below, click YES and close the window.

[Link], Research Scholar [Link] Andhra University


STEP 2
Turn on WSL (Windows Subsystem for Linux)
Open search and type “turn windows features on or off” and click on Open as shown below:

Scroll down the options and check the item named “Windows Subsystem for Linux” and click on OK as
shown below:

[Link], Research Scholar [Link] Andhra University


STEP 3
Install Ubuntu from Microsoft Store.
Click on search and type “Microsoft Store” and click on Open.
In the search bar at the top, type “Ubuntu” and click on “Install” button as shown below:

It will take some time to download and install the Ubuntu app as it is nearly 700 MB.

STEP 4
Install Xming.
Open Google in a browser and type “Xming Download” or got this URL
[Link] and click on the “Download” button.
After downloading Xming, install it.

STEP 5
Open search and type “Ubuntu” and click on Open.
As it is the first time you are opening Ubuntu, it will ask for Username and Password. Give a username and
password and hit enter key. Now you should see a prompt as shown below:

[Link], Research Scholar [Link] Andhra University


Type the following commands one by one and hit enter after each command:
1. sudo apt update
2. sudo apt-get install ns2
3. sudo apt-get install nam
4. sudo apt-get install gedit
5. sudo apt install tcl
If your Internet connection is slow, this step will take some time to complete. When asked for username
and password provide them as given before.

STEP 6
Changing the location to working directory.
For this example, for working directory name is “ns2” and it is located on my “Desktop”. The complete
path to “ns2” directory on my PC is “C:\Users\Admin\Desktop\ns2”.
To change the location to the above directory, type the following command and hit Enter key.

cd /mnt/c/Users/Admin/Desktop/ns2

You can see the above command in action in the below figure:

[Link], Research Scholar [Link] Andhra University


Note the path may vary from system to system. My ns2 programs are going to be saved in the “ns2” folder
as shown above.

STEP 7
Opening gedit and typing the program.
Type the following command in the terminal (black window) and hit Enter key.

gedit [Link]

You might get a warning message as shown in below figure:

For opening the “gedit” application we have to start the “Xming” application.
Open search and type “Xming” and click on “Open”.
The “Xming” server will be started and it will available in the system tray on the taskbar. Sometimes it
might get hidden in the system tray and is not always visible.
Now, in the terminal type the following command as shown in the figure below and hit enter key.

[Link], Research Scholar [Link] Andhra University


Now, type the following command in the terminal (black window) and hit Enter key.

gedit [Link]

You should be able to see a blank gedit window as shown in below image.

Type the following sample program and save (CTRL + s) the file. Now close gedit window.

#Create global variables


set ns [new Simulator]

#setting nam trace


set namf [open [Link] w]
$ns namtrace-all $namf

#open the trace file


set tracef [open [Link] w]
$ns trace-all $tracef
set proto rlm

[Link], Research Scholar [Link] Andhra University


#setting the color values
$ns color 1 blue
$ns color 2 yellow
$ns color 3 red

#---------- creating client- router- end server node----------------#


set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]

#establish the link between the nodes


$ns duplex-link $n0 $n1 2Mb 100ms DropTail
$ns duplex-link $n1 $n2 200Kb 100ms DropTail

#Label the nodes


$ns at 0.0 "$n0 label Client1"
$ns at 0.0 "$n1 label Server"
$ns at 0.0 "$n2 label Client2"

#setting the color for nodes


$n0 color blue
$n1 color red
$n2 add-mark pradeep green square

#Shaping the nodes for differentiation


$n1 shape hexagon
$n2 shape square

#finish procedure
proc finish {} {

[Link], Research Scholar [Link] Andhra University


global ns tracef namf
$ns flush-trace
close $tracef
close $namf
puts "Opening nam..."
exec nam [Link] &
exit 0
}

#Calling finish procedure


$ns at 2.0 "finish"
$ns run

STEP 8
Running the program using “ns” command.
Type the following command in the terminal to run the program and see the output.

ns [Link]

Now, you should be able to see the network animator (nam) window with the topology as shown in the
below figure.

[Link], Research Scholar [Link] Andhra University


If you can see the above output, it means that you have installed ns2 successfully on your system.

References

• Install NS2 Network Simulator in windows

[Link], Research Scholar [Link] Andhra University

You might also like