NS is a discrete event simulator targeted at network research. It is a publicly available as source code which lets you to inspect the source code and modify if you need to. It runs on Linux/Unix variants. If you do not have a working Linux/Unix system, you do not need to install it for NS. Cygwin is a set libraries/tool which provides the programs to call Unix system calls and face the environment these programs expect to see. When you install it, you have your linux/unix applications running on Windows. With its supports of cygwin, you can run NS on Windows without need of installing Linux. Below is a sample NS installation on cygwin.
First, you need to download and install cygwin. http://www.cygwin.com/mirrors.html points you to the mirrors which you can select the nearest one to you. Lets consider you've selected ftp.gtlib.gatech.edu mirror. There you should download ftp://ftp.gtlib.gatech.edu/pub/cygwin/setup.exe program which will show you the available modules, and download/install the selected ones. Considering you download the setup.exe program to folder "c:\cygwin install" you'll see the following screens when it is executed:
Since we do not have the packages on our local disk, we need to select the "install from internet" option. Next three windows get some settings and paths.
Then you're expected to select the mirror:
Once the INI file is downloaded, you're prompted for the selection of the packages to install:
We're not sure which packages are required for NS (actually it is listed at http://www.isi.edu/nsnam/ns/ns-cygwin.html), therefore proceed with the default/basic configuration, and do not modify anything in this window and proceed with "Next" button.
Once the installation is complete, you'll have a shortcut for cygwin bash shell on your desktop. Double click it and have your bash shell. This will look familiar if you have some Linux experience.
As we have some sort of working cygwin installation, we can try to install ns next. You can try all-in-one packages from http://isi.edu/nsnam/dist/. Pick the latest version and download it to c:\cywin (/ for the cygwin installation). Once the download is complete, we'll unpack it and try installation:
bahrio@blue-pill ~ $ cd / bahrio@blue-pill / $ gzip -d ns-allinone-2.29.3.tar.gz bahrio@blue-pill / $ tar -xf ns-allinone-2.29.3.tar bahrio@blue-pill / $ ls -la total 141381 drwxr-xr-x 12 bahrio None 0 Mar 8 00:35 . drwxr-xr-x 12 bahrio None 0 Mar 8 00:35 .. drwxr-xr-x 2 bahrio None 0 Mar 8 00:43 bin dr-xr-xr-x 1 0 root 0 Jan 1 1970 cygdrive -rwxr-xr-x 1 bahrio None 57 Mar 88 00:46 cygwin.bat -rw-r--r-- 1 bahrio None 7022 Mar 88 00:46 cygwin.ico drwxr-xr-x 9 bahrio None 0 Mar 8 00:37 etc drwxr-xr-x 3 bahrio None 0 Mar 8 00:46 home drwxr-xr-x 5 bahrio None 0 Mar 8 00:43 lib drwxr-xr-x 13 bahrio None 0 Oct 23 2005 ns-allinone-2.29 -rw-r--r-- 1 bahrio None 144762880 Aug 211 2006 ns-allinone-2.29.3.tar dr-xr-xr-x 1 bahrio None 0 Mar 8 00:49 proc drwxr-xr-x 2 bahrio None 0 Mar 8 00:43 tmp drwxr-xr-x 13 bahrio None 0 Mar 8 00:43 usr drwxr-xr-x 7 bahrio None 0 Mar 8 00:35 var bahrio@blue-pill /
Here, I create a link to the current ns folder, to have a version free path.
This way, I can upgrade to a newer version more easily later.
$ ln -s ns-allinone-2.29 ns bahrio@blue-pill / $ ls -la total 141382 drwxr-xr-x 12 bahrio None 0 Mar 8 00:35 . drwxr-xr-x 12 bahrio None 0 Mar 8 00:35 .. drwxr-xr-x 2 bahrio None 0 Mar 8 00:43 bin dr-xr-xr-x 1 0 root 0 Jan 1 1970 cygdrive -rwxr-xr-x 1 bahrio None 57 Mar 88 00:46 cygwin.bat -rw-r--r-- 1 bahrio None 7022 Mar 88 00:46 cygwin.ico drwxr-xr-x 9 bahrio None 0 Mar 8 00:37 etc drwxr-xr-x 3 bahrio None 0 Mar 8 00:46 home drwxr-xr-x 5 bahrio None 0 Mar 8 00:43 lib lrwxrwxrwx 1 bahrio None 16 Mar 8 00:49 ns -> ns-allinone-2.29 drwxr-xr-x 13 bahrio None 0 Oct 23 2005 ns-allinone-2.29 -rw-r--r-- 1 bahrio None 144762880 Aug 211 2006 ns-allinone-2.29.3.tar dr-xr-xr-x 1 bahrio None 0 Mar 8 00:49 proc drwxr-xr-x 2 bahrio None 0 Mar 8 00:43 tmp drwxr-xr-x 13 bahrio None 0 Mar 8 00:43 usr drwxr-xr-x 7 bahrio None 0 Mar 8 00:35 var bahrio@blue-pill /
As we do not need the tar file, I'm removing the tar file. If you do not have
another copy, you may want to gzip and save it for future use.
$ rm ns-allinone-2.29.3.tar bahrio@blue-pill /
Now we'll install NS:
$ cd ns bahrio@blue-pill /ns $ ./install ============================================================ * Testing for Cygwin environment ============================================================ Cygwin detected Note: Cygwin install is still considered EXPERIMENTAL Checking Cygwin version is >= 1.3.12... 1.5.24 (should be ok) Checking filesystems are mounted as UNIX filetype... yes Checking default mode is binmode... yes Checking legitimate login name... ok Checking legitimate path name... ok Checking for gcc... NO! Package gcc is not present on your system. Please install it using Cygwin's setup.exe before trying to install the ns-2 distribution. The above test indicates that your installation of Cygwin is probably NOT SUITABLE for installing ns-2 allinone. (More details can be found in the specific error message above.) Do you wish to proceed regardless? [y/N] n Installation aborted... bahrio@blue-pill /ns
Here, we see that we need some additional packages. NS is complaining about
missing gcc modules. To fix this, we'll re-run cygwin setup, and select devel/gcc
package. Once we complete the download and install of gcc, we'll re-run ns installation:
bahrio@blue-pill /ns $ ./install ============================================================ * Testing for Cygwin environment ============================================================ Cygwin detected Note: Cygwin install is still considered EXPERIMENTAL Checking Cygwin version is >= 1.3.12... 1.5.24 (should be ok) Checking filesystems are mounted as UNIX filetype... yes Checking default mode is binmode... yes Checking legitimate login name... ok Checking legitimate path name... ok Checking for gcc... ok Checking for gcc-g++... ok Checking for gawk... ok Checking for tar... ok Checking for gzip... ok Checking for make... NO! Package make is not present on your system. Please install it using Cygwin's setup.exe before trying to install the ns-2 distribution. The above test indicates that your installation of Cygwin is probably NOT SUITABLE for installing ns-2 allinone. (More details can be found in the specific error message above.) Do you wish to proceed regardless? [y/N] n Installation aborted...
Once you install make, you'll see that other packages are missing. Therefore you'd better to re-run cygwin istallation to install following packages:
The compilation of the modules will take some time, and you'll see following notes once the ns installation is complete:
IMPORTANT NOTICES: (1) You MUST put /ns/otcl-1.11, /ns/lib, into your LD_LIBRARY_PATH environment variable. If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH. If you are using csh, you can set it like: setenv LD_LIBRARY_PATHIf you are using sh, you can set it like: export LD_LIBRARY_PATH= (2) You MUST put /ns/tcl8.4.11/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup. (3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.11 and tk8.4.11. They are now installed under /ns/{bin,include,lib} After these steps, you can now run the ns validation suite with cd ns-2.29; ./validate For trouble shooting, please first read ns problems page http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive for related posts.
For bash, we modify the PATH environment variable as follows:
bahrio@blue-pill ~ $ PATH=$PATH:/ns/bin