Category Archives: Linux

Configure NS-2 with Eclipse in Linux

For most users of NS2, it would be easier if they can use a popular IDE to work with the files.
Here are the step by step instructions I followed to set up NS-2.34 with Eclipse 3.5 in Ubuntu Linux.

In older versions of Eclipse, the settings might be slightly different.

I have compiled the following steps after running into various problems and errors with the setup, and solving them all. So I hope the setup will be smooth for you.

Setting up Eclipse:

  1. Download Eclipse SDK
  2. Extract the SDK to a folder
  3. Open Eclipse
  4. Go to Help -> Install New Software. In the Work With bar type this:
  5. Choose CDT Main Features and CDT Optional Features. Install them.
    CDT stands for “C/C++ Development Tooling”
  6. If you do not have a working internet connection in the system you have installed Eclipse, instead of steps 4 and 5, download the CDT from the above mentioned site. Then move to Install New Software (see step 4) -> Add and add the archive downloaded.

Installing NS-2

  1. Download NS-2
  2. Extract NS-2 to a folder, i.e. /home/username/ns-allinone-2.34
  3. Edit Makefile:
    • Open “…/ns-allinone-2.34/ns-2.34/”and
    • Add these lines anywhere near the top of the file:CCOPT = -g
    • Navigate to …/ns-allinone-2.34/ns-2.34 and run “./configure”
  4. Navigate to the NS-2 folder using terminal and type ./install
  5. Also, follow the instructions are displayed at the end of a successful installation. These instructions are to modify the PATH variable and other environment variables as needed.

Adding NS-2 as a Project in Eclipse

  1. Open Eclipse
  2. Set the workspace as the ns installation path( /home/username/ns-allinone-2.34 ) by selecting File -> Switch Workspace
  3. Choose File -> New -> Project -> C++ Project
  4. Select Project Type as Makefile Project -> Empty C++ Project.
    Toolchains: Linux GCC
  5. Enter Project Name as ns-2.34
  6. Uncheck “Use default location” then browse to the directory NS-2 source directory ( …/ns-allione-2.34/ns-2.34 )
  7. Select “Next” and “Finish.
  8. From the workspace, Selecting the NS-2 Project and choosing Project -> Build All should not give Error.
  9. Running the project must open the console with the NS-2 prompt, %

Setting Debug Configuration:

  1. Select Run -> Debug Configurations
  2. Choose C/C++ Application. Type in any name.
  3. Under the Main tab, Choose the following:
    Project as ns-2.34.
    C/C++ Application as ns. (Search Project and Choose this)
  4. Under the Debugger tab, choose GDB Debugger. Uncheck the “Stop on startup at” option.
  5. Apply and Debug.

Update from Readers: Changes to be made in file:

Add -g to the line CCOPT = @V_CCOPT@


Add -DNDEBUG -DDEBUG to the end of the following line:


Special thanks to Ella Taha for notifying me about the correction!


I wrote this post many years ago, and I have since then moved away from using NS-2.
Here is a relatively recent post by Erlend that might be of help: Using ns-2 with Eclipse

Reliance Data Card in Ubuntu 8.04

Reliance data card ( Huawei ) works really well in Ubuntu, and getting it to work is very easy.

All that one must do is to plug in the USB modem and edit the /etc/wvdial.conf file:

Step 1: Edit the /etc/wvdial.conf file by typing in the following lines

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
New PPPD = yes
Phone = #777
Modem = /dev/ttyUSB0
Username = **********
Password = **********
Baud = 460800
stupid mode = 1

The username and password generally would be the Reliance number.

Step 2: Run (as root) the following command from terminal:

wvdial /etc/wvdial.conf

The output will be similar to the following:

--> WvDial: Internet dialer version 1.56
--> Warning: section [Dialer /etc/wvdial.conf] does not exist in wvdial.conf.
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
CONNECT 230400
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sun Nov 30 09:34:55 2008
--> Pid of pppd: 11854
--> Using interface ppp0
--> pppd: h?[06][08]p?[06][08]
--> pppd: h?[06][08]p?[06][08]
--> pppd: h?[06][08]p?[06][08]
--> pppd: h?[06][08]p?[06][08]
--> pppd: h?[06][08]p?[06][08]
--> local IP address
--> pppd: h?[06][08]p?[06][08]
--> remote IP address
--> pppd: h?[06][08]p?[06][08]
--> primary DNS address
--> pppd: h?[06][08]p?[06][08]
--> secondary DNS address
--> pppd: h?[06][08]p?[06][08]

Now you can browse the internet…