The Network Simulator: Building Ns

This page describes ns version 2.

Where to Start

What hardware is needed? To build ns you need a computer and a C++ compiler. We develop ns on several kinds of Unix (FreeBSD, Linux, SunOS, Solaris), so it installs smoothest there, but it should run on an Posix-like computer, possibly with some tweaking. Ns also builds and runs under Windows, see the dedicated Windows / Cygwin page. Simple scenarios should run on any reasonable machine, but very large scenarios benefit from large amounts of memory.

Ns is fairly large. The allinone package requires about 320MB of disk space to build. Building ns from pieces can save some disk space. (If multiple people want to share files in the ns build tree to save space, you may download a simple perl script, then follow the instruction in its README. There is detailed instruction from CS599b class of USC. You may also find discussions in the ns-users mailing list archive useful.)

How do I get the software? There are two ways to build ns: from all the pieces or all at once. If you just want to try it out quickly, you might try all at once. If you want to do C-level developement, or save download time or disk space, or have trouble with all-in-one you should build it from the pieces.

As of November, 2005, ns is available at SourceForge.

Getting the Pieces

Important:Please check the bug fixes after you finish installation!.

Ns depends on several externally available components. Below is a summary of where to get them and where they may already be (if you're a VINT developer). Since the components depend on each other, you should build them in the listed order.

Download source:
Download source:
TclCL (the package formerly known as libTcl)
Download source:
Download source: There may be known problems with the current version of ns; please check the ns installation problems web page for patches.

nam-1 (optional)
Download source:

You can find pre-built binary of nam-1.11 for Linux/freeBSD from the nam page.

xgraph (optional, but needed for test suites)
Download source: version 12.1, or by anonymous cvs (module "xgraph"). web page:

(This version is maintained by the ns maintainers and includes portability fixes over the older 12.0 release.)

perl (optional, but needed for test suites)
Download source: latest stable release; web page:

Note that version 5.003 or later is required.

tcl-debug (optional, available for Tcl debugging help)
Download source: version 1.7; web page: This version will work with Tcl/Tk 8.0 release.

dmalloc (optional, available for memory debugging)
Download source: version 4.8.0. web page:; specify --with-dmalloc during configure to include.

sgb2ns conversion program (optional, needed to convert GT-ITM output to ns-2 format)
Download source: sgb2ns conversion program. For more info on GT-ITM topology generators see GT-ITM Topology Generator.

tiers2ns conversion program (optional, needed to convert Tiers output to ns-2 format)
Download source: tiers2ns.awk. For more info on Tiers topology generators see Tiers Topology Generator.

Cweb and sgb source code (optional, required to create sgb-library that is used by gt-itm and sgb2ns programs)
Download cweb source from cweb ftp page
Download sgb source code from sgb ftp page

VINT developers at ISI can find all of these packages in /nfs/filb2/public/pkgs.

Building it From Sources

These instructions are for Unix only. For Windows, the allinone is recommended. Go here for Windows instructions.

Getting everything at once

Ns-allinone is a package which contains equired components and some optional components used in running ns. The package contains an "install" script to automatically configure, compile and install these components. After downloading, run the install script. If you haven't installed ns before and want to quickly try ns out, ns-allinone may be easier than getting all the pieces by hand.

Currently the package contains:

Currently, ns-allinone works on Unix systems and under Cygwin for Windows 9x/2000/XP. If you have problems with allinone, we encourage you to build it from its pieces.

Download source:

Important:Please check the bug fixes after you finish installation! .

Getting Older Versions of Ns

Q: The current version of ns has too many features and fixed bugs... I want a more challenging network simulator. (Or, more likely, I have someone elses code that was built against an old ns release.)

A: All previous releases of ns-2 and nam are at our web and ftp sites. Please note that many of these versions have known bugs---we can only support the most recent ns release.

Where to go from here?

If you have problems building ns, try reading the Installation Problems and Bug Fixes Web Page.

If you want to write new simulation scripts or modules, please check out the documentation links on the main ns page.

Now that ns runs, you might want to consider some tips about debugging your ns scripts.

If you plan on modifing ns itself you should do a make depend to add dependency information to configure's Makefile.

To animate your simulations, you might want to examine nam, the network animator.

ns [email protected]