Skip to content

Procedure for Installing MultiChannel Patch for ns-2 Cognitive Radio Network Model Simulations

Installing Cognitive Radio Extension on ns-2

The following article explains the way of installing cognitive radio extension on ns-2 simulator with a detailed step by step procedure.


Cognitive Radio Cognitive Network(CRCN) Simulator for ns-2.


One may follow the old multichannel patching procedure as follows:

Procedure for Installing (Preparing) ns2.31 for applying the CRCN Multichannel patch.


For installation of Linux and ns2.31, refer internet for the procedure for installing Linux and installing ns2.


1. If you are not having ns2.31, then download ns2.31 from the following link

2. login as root copy the ns-allinone-2.31.tar.gz file in / (the root of the filesystem)

#cd /

3. #gunzip –d ns*.gz this will extract ns-allinone-2.31.tar in the / file system

4. #tar –xvf ns*.tar this will extract ns.28 under the directory /ns-allinone-2.31

5. First install ns2.31
# cd /ns-allinone-2.31/

#./ install – to install ns2.

The following is very very important
6. After successful installation, edit the /root/.bash_profile with the following values – then only the following commands will work from any project directory) [/.bash_profile is a hidden file]

(in some cases you may need to edit .bashrc file instead of .bash_profile



Reboot the system and login again

Check the good working of ns2 by just typing the following command.
#ns – this will produce % prompt (Ctrl+C to exit)
#nam – This will start nam
#xgraph – it should wait for input (Ctrl+C to exit)

If ns, nam and xgraph are running good, then only you can proceed to the next part of the project.

Patching ns2.31 with CRCN Multichannel patch

If you are getting any errors, then immediately send it to me – I may tell you the mistake which you made.

After installing ns2.31 and testing the good working of ns, nam and xgraph, just copy the entire folder ns-allinone-2.31 and make a backup of it and store it safely.

Now you may patch ns2 for multichannel.

In fact, the original link for this patch is
But it will not work.

So download it from the following link.

and try installing it 🙂

The following is the official procedure for installing this multichannel patch which is explained in CRCN USER GUIDE

Installation of NS2 COMPONENTS

This simulator is based on NS-2 (version 2.31). All codes have been tested in ns-2.31 under a Linux environment.

Step 1: Make sure your system meets the system requirements.
Step 2: Download
Step 3: Make sure that your ns can be called from any directory.
Step 4: Unzip the Copy the files under each sub folders in crcn into the corresponding folders in XXX/ns-allinone-2.31/ns-2.31/. For example, copy the files under crcn/mac/ into XXX/ns-allinone-2.31/ns-2.31/mac/. Please note that it will overwrite some of your ns files in the same directory. Thus, backup the ns directory before executing this command.
Step 5: Add the following three lines in the Makefile, which is under XXX/ns-allinone-2.31/ns-2.31/.
wcett/wcett_logs.o wcett/wcett.o \
wcett/wcett_rtable.o wcett/wcett_rqueue.o \
mac/macng.o mac/maccon.o \
Step 6: Run the following commands under XXX/ns-allinone-2.31/ns-2.31/ directory:
make clean
make depend

*Important note: in the above procedure, XXX means the home directory.
ok, if you are successful then you may test your installation as follows:

Run the simulation “test4macng random topo 2 channels.tcl” which will be inside that extension package.
#ns “test4macng random topo 2 channels.tcl”

If everything is good, then it will create a nam file named “test.nam”

#nam test.nam

Now, will show a simple multichannel simulation.

If you see any error such as split object unknown, then it means, you failed to install it correctly. 

Installing Cognitive Radio Extension on ns-3

The following article explains the way of installing cognitive radio extension on ns-3 simulator.

Installation of Cognitive Radio Extension for ns-3 (CRE-NS3)




For Assistance in Protocol Implementation, Simulations & Analysis of Industrial as well as Scholarly Research Works, you may Contact Us.

WhatsApp chatDiscuss Through WhatsApp

Call 91 9843779735

Send an e-Mail Message.

This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.

WhatsApp Discuss Through WhatsApp