Skip to main content

How to configure Eclipse for NS-2 (2.34) in Linux.


1) Install the NS2.
2) Make a backup copy of your NS2 folder, i.e. ns-allinone-2.34 somewhere so
    that you can reset the changes by replacing.
3) Download the Eclipse SDK 3.7.2 Indigo (Classic) from here. This file is
     approx. of size 174 MB.
4) Download the CDT from here. This file is approx. of size 44 MB.
5) Copy the "eclipse-SDK-3.7.2-linux-gtk.tar.gz" file to user folder (/home/user)
     and extract.
6) Open the eclipse and set the workspace as /home/user/ns-allinone-2.34.
7) Now in Eclipse go to Help->Install New Software... A window with name
    "install" will pop up. Then go to Add. Put the values as shown below.
    Name:- CDT
    Location:- Browse to the "cdt-master-6.0.2.zip" file.
8) Check "CDT Main Features" and "CDT Optional Features", click next,
    then accept license and finish. At last it will ask you to restart Eclipse, then
    choose Restart.
9) Now choose /home/user/ns-allinone-2.34 as workspace. Click New->C++
    Project. Put Project name:- ns-2.34 (It will warn you that a directory already
    exists. Just ignore it.). Choose Project type as make project->Empty project
    and Toolchains linux GCC and click finish.
10) Now go to Project->clean->clean projects selected below->ns-2.34 and OK.
11) Go to Project->Build All.
12) After build is completed without any error, go to Run->Run configurations.
      Double click C/C++ Application. For Project: browse to ns-2.34. Go to
      Search Project and click ns from Program selection window, then Apply and
      Run. If you get % sign in console, you are done.

13) (Optional) If you want to speed up the make time of NS2, just don't clean it,
       directly build all from Eclipse. It will get compiled in less than 5 seconds.
       All the best!

Comments

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. what changes does it require for a java project in eclipse??

      Delete
    2. Simple, While making new project choose java project as a new project

      Delete
  2. Sorry I don't know about java project in Eclipse!

    ReplyDelete
  3. Sorry I don't know about java projects in Eclipse!

    ReplyDelete

Post a Comment

Popular posts from this blog

How to use promiscuous mode in AODV NS2

Introduction:-           In Promiscuous mode each node in the network listens the packets transmitted by its own neighbor nodes.            In NS-2, some time we have to calculate the packet drops or analyze the process. For the same we need to set the network to operate in promiscuous mode. Here, I am going to explain how we can set our wireless network in promiscuous mode with AODV as Routing protocol using NS2 simulator. 1) We need to modify in total 3 files, so it's good to take a backup of it.     Files are: ns-allinone-2.34/ns-2.34/aodv/aodv.cc ns-allinone-2.34/ns-2.34/aodv/aodv.h ns-allinone-2.34/ns-2.34/tcl/lib/ns-mobilenode.tcl 2) Open the file ns-allinone-2.34/ns-2.34/aodv/aodv.h in your favorite editor     and make the changes as shown in blue color.   #include <mac.h>   class AODV: public Tap, public Agent {   public:   void tap(const Packet *p);   ......   protected:   Mac *mac_;   ......  }

Runtime packet loss calculation in NS2

Hello friend, here I am going to present a method to calculate the runtime packet loss. I am going to show this using ns2 2.34 and AODV.       Sometime we require packet loss to calculate trust value (in case of Trust Based protocols where it is done by no. of packets sent - no. of packets received).        I am going to show the calculation for a particular pair of nodes. Steps involved:- A) We will have to add a node as a malicious node which will drop the packets      intentionally. You can add a malicious node using this link. B) Second, we'll set the AODV in promiscuous mode, where every node will      listen to its neighbors. 1) We need to modify in total 3 files to set AODV in promiscuous mode, so it's     good to take a backup of it.     Files are: ns-allinone-2.34/ns-2.34/aodv/aodv.cc ns-allinone-2.34/ns-2.34/aodv/aodv.h ns-allinone-2.34/ns-2.34/tcl/lib/ns-mobilenode.tcl 2) Open the file ns-allinone-2.34/ns-2.34/aodv/aodv.h in your favorite edito

How to add trust table in NS2.

I am assuming AODV protocol. In rtable.cc add below code trust_entry::trust_entry() {    //Initialize as per your need. } trust_entry::~trust_entry() {   //Deconstruct as per your need. } trust_entry* trust_store::trust_lookup( nsaddr_t node_id) {      trust_entry *rp = trusthead.lh_first;      for (; rp; rp = rp->trust_link.le_next) {              if (rp->node_id == node_id)                  break;      }     return rp; } void trust_store::trust_delete( nsaddr_t node_id) {     trust_entry *rp = trust_lookup(node_id);     if (rp)     {         LIST_REMOVE(rp, trust_link);         delete rp;     } } trust_entry* trust_store::trust_insert( nsaddr_t node_id, nsaddr_t prev_node,nsaddr_t next_node,int32_t trust_value) {     trust_entry *rp;     //assert(tr_lookup(dst_seq_no) == 0);     rp = new trust_entry;     assert(rp);     rp->node_id = node_id;     rp->prev_node = prev_node;     rp->next_node = next_node;     rp->trust_value = trust_value;     LIS