Windows + Cygwin + NS2


This document will show you how to install NS2 on Windows platform (windows 2000 or windows XP). The NS2 version for this document is ns-2.27. If you want to use ns-2.28, it is ok. The steps are similar.



1.      Download the software from here. Decompress the rar file. You will see a setup.exe. Click this file. It will be like the following figure.



1.      Because the language of operating system is Traditional Chinese. The text of button is shown in Chinese. But you don’t need to worry about this. I think it is shown in English in your computer. Just click “Next”.


2.      Then choose “Install from Local Directory”


3.      Click “Next”.

(Just keep the settings as they are.)


4.      Click “Next”


5.      Click “Browse” to choose where the software is. (Please choose “”)


6.      Click “OK”.


7.      Click “Next” and you will see the figure shown as follows. In this window, the cygwin setup program let you choose what software you want to install.


8.      Click “View” first to make the word “Category “change to “Full”.


9.       XFree86-base, XFree86-bin, XFree86-prog, XFree86-lib, XFree86-etc, make, patch, perl, gcc, gcc-g++, gawk, gnuplot, tar and gzip must be chosen. For example, if I want to install XFree-86 base (upper figure), click the “Skip” of “New” column. The “Skip” will be changed to “4.3.0-1” (lower figure).


10.  Click “Next”.

(Please be patient. It may take a long time to finish the installation.)


11.   When setup is done, it will be shown as following figure. Click “Finish”.



12.   Click “OK” to finish the cygwin setup program.


[NS2 setup]

1.      Click the icon on the desktop.


2.      For the first time execution, it will generate some environment parameter setting files. In this example, smallko is my login name to windows system. Therefore, the cygwin will create a folder named “smallko” under home directory. (The actual path for smallko folder is: c:\cygwin\home\smallko) It should be noticed that the login name can not have any space in your name. For example, “A  B” may cause errors when you install NS2. (smallko-hpds is my computer name)


3.      Please copy ns-allinone-2.27.tar.gz into your director. In this example, I copy this file to c:\cygwin\home\smallko. Then decompress the compressed file. Use the command “tar xvfz ns-allinone-2.27.tar.gz”.


4.      When the decompression is finished, it will be shown as follows.


5.      Begin to install ns-allinone-2.27. Change path to the ns-allinone-2.27 by typing “cd ns-allinone-2.27”. Then type “./install”.



6.      Please type “y” to continue.


7.      When it is finished, it is shown as follows.



8.      But before you start running NS2 simulation, you should set the path first. I have prepared one file for it. Just copy the “.bashrc” to replace the one under your home directory. (In this example, I copy .bashrc to c:\cygwin\home\smallko)



1.      To initial graphical mode. ( type “startxwin.bat”)


2. Run the example tcl script. (Change to ~/ns-allinone-2.27/ns-2.27/ns-tutorial/examples. Then run the command “ns example2.tcl)


3. If you can see the following figures, congratulations. You have successfully install cygwin + ns-2.27 under windows platform.



Last modified: 2005/06/24


Author : Chih-Heng, Ke



Phd candidate, EE Department, NCKU, Taiwan