Can We Implement Software Defined Network (SDN) Project in NS2

We are here to assist you to be well versed in Ns2 with immense inclination!!! In addition, we have provided the essential data and tips that are required to get to know about the execution of software defined network (SDN) project in Ns2 through this article. Now, let’s get into the step by step process of SDN project using Ns2 with the implemented screenshots in the following.

Phase: I

As the first point, we have to implement the SDN project using Ns2 through the utilization of openflow protocol. In addition, the sample .cc code for SDN based transmission is highlighted in the following.


BroadcastTimer::handle(Event*) {


Scheduler::instance().schedule(this, &intr, BCAST_ID_SAVE);



HelloTimer::handle(Event*) {


double interval = MinHelloInterval +

((MaxHelloInterval – MinHelloInterval) * Random::uniform());

assert(interval >= 0);

Scheduler::instance().schedule(this, &intr, interval);


Phase: II

To run SDN based simulation in Ns2, we have to create the Ns2 simulation main file with the file extension .tcl and run through implementing the below mentioned command.

cd /home/research/SDN_in_NS2

sudo ./ns SDN_NS2.tcl

Running SDN Based Simulation in Ns2

For your ease, we have highlighted the result that is acquired through the execution of SDN based Ns2 simulation.

Acquired Simulation Result

Through the above mentioned steps, one can easily implement Ns2 based SDN project. If you feel that you are struggling somewhere, reach us without any hesitation and we provide the complete support for your understanding the help of our research experts.