Downloading and installing ns-2

From nsnam
Revision as of 10:01, 22 June 2009 by Bharathi (Talk | contribs) (Removed SPAM entries)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


NS-2 is designed to run from on most UNIX based operating systems. It is possible to run NS-2 on Windows machines using Cygwin. If you don't have a UNIX install, you can also use a virtual linux machine and run that under Windows. VMWare has a free VMWare Player that allows you to download linux systems like Ubuntu and run them on your computer. You will need to make sure you have standard development packages like 'make' and 'gcc'.

If you are a beginner on Ubuntu7.04, try this page:Installing_ns2.31_on_Ubuntu7.04

Installing NS2 on UNIX Based System

Ok, you've got a development ready UNIX system. First, download a copy of ns-allinone-2.34.tar.gz. Then from the command prompt there, execute the following:

tar -xzf ns-allinone-2.34.tar.gz 
cd ns-allinone-2.34

(If this fails, try the Distribution Specific instructions)

After a long wait and a whole lot of text, you should see the installation finish up with text like the following:

Nam has been installed successfully.
Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.11:      /home/pcraven/ns-allinone-2.29/{bin,include,lib}
tk8.4.11:               /home/pcraven/ns-allinone-2.29/{bin,include,lib}
otcl:           /home/pcraven/ns-allinone-2.29/otcl-1.11
tclcl:          /home/pcraven/ns-allinone-2.29/tclcl-1.17
ns:             /home/pcraven/ns-allinone-2.29/ns-2.29/ns
nam:    /home/pcraven/ns-allinone-2.29/nam-1.11/nam
xgraph: /home/pcraven/ns-allinone-2.29/xgraph-12.1
gt-itm:   /home/pcraven/ns-allinone-2.29/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns


Please put /home/myusername/ns-allinone-2.29/bin:/home/myusername/ns-allinone-2.29/tcl8.4.11/unix:/home/myusername/ns-allinone-2.29/tk8.4.11/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.


(1) You MUST put /home/myusername/ns-allinone-2.29/otcl-1.11, /home/myusername/ns-allinone-2.29/lib, 
    into your LD_LIBRARY_PATH environment variable.
    If it complains about X libraries, add path to your X libraries 
    If you are using csh, you can set it like:
                setenv LD_LIBRARY_PATH <paths>
    If you are using sh, you can set it like:
                export LD_LIBRARY_PATH=<paths>

(2) You MUST put /home/myusername/ns-allinone-2.29/tcl8.4.11/library into your TCL_LIBRARY environmental
    variable. Otherwise ns/nam will complain during startup.

(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.11 
    and tk8.4.11. They are now installed under /home/myusername/ns-allinone-2.29/{bin,include,lib}

After these steps, you can now run the ns validation suite with
cd ns-2.29; ./validate

For trouble shooting, please first read ns problems page Also search the ns mailing list archive
for related posts.

At this point, you should follow the advice here and update your environment variables. You should also add ns-allinone-2.29/bin to you path. This has links to all the executables created by NS-2. Since the Tcl scripts may call these executables (like nam or xgraph), it is a good idea to have them in the path.

You can test the installation by doing the following:

cd ns-2.29

Note that this validation takes a really long time. If it starts out ok, you probably have a good installation.

At this point, you can see Getting Started with NS-2 .

Installing NS2 on a MacOS X / Intel Based

I've tried to install ns2-allinone-2.29.3/.2 onto an intel mac based system. After some problems during the compile phase, the simulator part (ns) seems to be fully working. Nam, instead, got some strange errors, related to Xlib. In my knowledge, this strange behaviour is related to some changes to api part of Xlib into macos/intel version. Attached is the error, that i've when try to run nam onto my mac intel based.

tengu:~/Desktop/ns-allinone-2.29/nam-1.11 valvoline$ ./nam 
Xlib: sequence lost (0x10006 > 0x9) in reply type 0x0!
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  1 (X_CreateWindow)
  Resource id in failed request:  0xa
  Serial number of failed request:  6
  Current serial number in output stream:  9


After read and debugged the ns-allinone-2.29.3 sourcecode, i finally realized that the problem about running nam onto Intel based Mac, is related to some weakness into Tcl/Tk Library. Seems that for some strange reason the Tk part of the above library is broken in I386 systems. Unfortunately, there'snt a patch or a workaround for this problem, yet! if you're interested you can check [1] and [2], for further infos.

So, nam seems to be working (?) at least on PPC based systems. To make nam working onto my MacPro (Intel Based), i patched the package ns2-allinone-2.29 in order to use some libraries compiled for PPC and others compiled natively for I386 archs. With this solution i can run the ns part of the simulator (the most important one), natively onto MacIntel without Rosetta-Limitations, and the nam part too, thanks to Rosetta Interpreter.

Obviously, this's an hybrid and not so clean solution. However, at the moment is the only one to make the package working 100% onto a MacIntel.

I've packed'em all into an auto-installer package. You can download it here.

NOTE: you need to install xcode developer tools (with X11 SDK), otherwise you'll get some errors about libX11.

ns2 VMWare images

Here are some ready-made VMWare images for the lazy ones.

They were created on VMWare 1.1 under OSX 10.5.2

They have not been tested anywhere else (someone wants to test them and report back?)

All images can be found HERE

Images so far:

-Debian 40r3-i386 with ns2

Related Links

-How to Install Network Simulator 2.30 on Fedora 6
-ns-allinone-2.31+Ubuntu 7.10 installation in VMWare 6