Download a version of ns-2.30 or ns-allinone-2.30 from http://www.isi.edu/nsnam/ns/.
Then download Click from anonymous CVS.
Follow the instructions in Click's INSTALL file. Look for the section called "NS MODULE". That section is copied below, in a version from 12/30/2006.
Support for integrating Click with the NS simulator was originally developed by Michael Neufeld at the University of Colorado.
To compile a Click-enabled version of the NS simulator, you must first configure and install Click with NS support. Change to the Click source directory and run
./configure --prefix=CLICKPREFIX [other options] --enable-nsclick make install
Now, prepare to compile the NS simulator. This may involve first compiling and installing several external packages, such as tclcl and otcl. Then unpack the latest version of NS; we provide a patch for versions 2.29 and 2.30, but a patch may apply to later versions. Apply the appropriate patch from Click's etc/ directory, like so:
cd ns-VERSION patch -p1 < CLICKDIR/etc/ns-VERSION-patch
Now configure NS, supplying the prefix you installed for Click.
./configure [--prefix=PREFIX] --with-click=CLICKPREFIX
Compile and install NS. To test nsclick, run the ns simulator on one of the sample scripts we provide:
cd ns-VERSION/tcl/ex ns nsclick-simple-lan.tcl
If you get a shared library error when running ns, make sure that the LD_LIBRARY_PATH environment variable includes the CLICKDIR/lib directory. You should see some NS printouts intermixed with some Click printouts, which begin with "tokernel", "discard", "fromkernel", and so forth.
Please note that the NS patch no longer requires libnet.
Alternately, you may follow the instructions below for click-1.5.0. The instructions are a bit more specific than necessary.
Download ns-allinone-2.29.3.tar.gz from http://www.isi.edu/nsnam/ns/
Download click-1.5.0.tar.gz from http://www.read.cs.ucla.edu/click/
Set the install dir variable, it should point to where nsclick will be installed. Set the SOURCES variable, the dir where the downloaded sources are:
$ export INSTALL_DIR=/opt
$ export SOURCES=/home/downloads
$ export NS_ALLINONE_DIR=$INSTALL_DIR/ns-VERSION
unpack the sources to the install dir $ cd $INSTALL_DIR
$ gzip -cd $SOURCES/ns-allinone-2.29.3.tar.gz | tar xv
$ cd ns-allinone-2.29
$ gzip -cd $SOURCES/click-1.5.0.tar.gz | tar xv
$ ln -s click-1.5.0 click
$ cd $NS_ALLINONE_DIR/click-1.5.0
$ ./configure --enable-nsclick --disable-linuxmodule --enable-userlevel
$ make
$ cd ..
Execute the patch accompanied with the click-1.5.0 package (for the 2.29 ns package)
$ cd $NS_ALLINONE_DIR/ns-2.29
$ patch -Np1 -i ../click-1.5.0/etc/ns-2.29-patch
$ cd ..
$ ./install
After the installation is complete, execute the following command to set the environment variables each time you login with bash:
$ echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$NS_ALLINONE_DIR/click-1.5.0/ns" >> ~/.bashrc
$ echo "export PATH=\$PATH:$NS_ALLINONE_DIR/bin" >> ~/.bashrc
$ source ~/.bashrc
In order to test the installation, execute:
$ ns $NS_ALLINONE_DIR/ns-2.29/tcl/ex/nsclick-simple-wlan.tcl
This should have executed without errors and should have generated two files: nsclick-simple-lan.nam (the nam file) and nsclick-simple-lan.tr (the ns tracefile).