Getting started with ns-3-click and nsclick

Click can be run in a simulation environment within the NS-3 and NS-2 simulators. The integrations are known as ns-3-click and nsclick respectively. This section describes the installation procedure for each.

Setting up ns-3-click

The first step is to build Click with simulator integration support enabled.

Once you've downloaded Click, execute the following at the top of your Click source directory:

$: ./configure --enable-userlevel --disable-linuxmodule --enable-nsclick 
$: make

Note: The 'make install' step is optional. You may enable any additional modules that you require with the appropriate --enable flag.

Next, we fetch ns-3. You may download the latest stable release, or perform a clone of ns-3-dev from the Mercurial repository as follows:

$: hg clone

Once Click has been built successfully, change into the ns-3 directory and configure ns-3 with Click Integration support:

$: ./waf configure --enable-examples --enable-tests --with-nsclick=/path/to/click/source

If it says ‘enabled’ beside ‘NS-3 Click Integration Support’, then you’re good to go. The --with-nsclick argument may also point to the Click installation prefix in case you've done a 'make install'. The last step is to build ns-3.

$: ./waf build

Once this is done, try running one of the examples:

$: ./waf --run nsclick-simple-lan

Using tcpdump or wireshark, You may then view the resulting .pcap traces which will appear as nsclick-simple-lan-0-0.pcap and nsclick-simple-lan-0-1.pcap.

Further information about ns-3-click is available in the ns-3 manual.

Setting up nsclick

Download a version of ns-2.30 or ns-allinone-2.30 from

Then download Click from anonymous CVS.

Follow the instructions in Click's INSTALL file. Look for the section called "NS-2 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:

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.

Download and install Click and ns-2

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

Download click-1.5.0.tar.gz from

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


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

Configure and make click

$ cd $NS_ALLINONE_DIR/click-1.5.0

$ ./configure --enable-nsclick --disable-linuxmodule --enable-userlevel

$ make

$ cd ..

Patch ns-2

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

Test it

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 (the ns tracefile).

nsclick.txt · Last modified: 2013/10/18 22:19 by suresh.lalith
Recent changes RSS feed Driven by DokuWiki