ns version 1 - LBNL Network Simulator


Other links:

Ns version 2

A release of ns version 2 is available from UC Berkeley. Ns version 2 has a new architecture that uses MIT's Object Tcl instead of Tcl, and uses a finer grained object decomposition.

Almost all of the functionality now in ns version 1 has been merged into ns version 2, and only ns version 2 will be developed further. Ns-2 maintains full backward compatibility for all functionality except the flow manager, so that Tcl scripts developed for ns version 1 will generally run directly on ns version 2.


The LNBL Network Simulator, ns, is a simulation tool developed by the Network Research Group at the Lawrence Berkeley National Laboratory. Ns is an extensible, easily configured and programmed event-driven simulation engine, with support for several flavors of TCP (include SACK, Tahoe and Reno) and router scheduling algorithms. This work derives from S. Keshav's REAL simulator.

The ns simulation description language is an extension of the Tool Command Language, Tcl. A simulation is defined by a Tcl program. Using the ns command, a network topology is defined, traffic sources and sinks are configured, statistics are collected, and the simulation is invoked. By building upon a general-purpose language, arbitrary actions can be programmed into the configuration.

Several of the test scripts included with the distribution invoke a graphing tool to display trace output. See the XGraph home page to obtain this program.


To build ns from source, simply run the ./configure script in the top-level of the distribution directory. Then run make. It should build an executable called ns. You'll need to have Tcl ( v7.5) installed (or built in the directory above the ns tree). If you use gcc for the compiler, you should use gcc version 2.7.2 or later. Ns does not run correctly with older versions of gcc and with some other C++ compilers. ns is also not compatible with Tcl older than version 7.5. ns should compile and run an any unix system that Tcl runs on. If you have problems, look at the problems page

To build ns from source to enable debugging, simply run:

	./configure --enable-debug.

If you have to make changes in order to compile ns, please send in your patches. Likewise, if you encounter bugs or unexpected behavior, please contact ns@ee.lbl.gov (this list includes only the developers and is not distributed beyond our site). Finally, if you implement ns extensions that others can benefit from, please (if possible) send them in for inclusion in a future release.

You might run the following command as a quick test to verify that ns built correctly:

	% ./ns test-suite.tcl tahoe1
You should see some debugging output, then an xgraph window will pop-up with a sequence plot of the connection (xgraph and awk must be in your path for this script to work properly). See test-suite.tcl and example.tcl for more examples. A note describing the test suite is in ftp://ftp.ee.lbl.gov/papers/simtests.ps.Z. If you make changes to the simulator, you might want to make sure you haven't introduced bugs by running Matt Mathis' (mathis@psc.edu) test-all script, which is included in the distribution.

Other documentation for ns version 1

The (still rough) man page ns.1 is the only other source of documentation at this time. The most recent version of the man page is included in the ns distribution with the source code. Considerably more documentation is available for ns-2.

Validation tests

The Simulator Tests document illustrates the basic suite of validation tests included in the source distribution.

Ns Simulator Tests for Random Early Detection (RED) Gateways illustrates the validation tests for the implementation of RED queue management. The validation tests are included in the source distribution.

Ns Simulator Tests for Class-Based Queueing illustrates the validation tests for the implementation of class-based queueing (CBQ). The validation tests are included in the source distribution.

Simulation-based Comparisons of Tahoe, Reno, and SACK TCP illustrates simulations of Tahoe, Reno, new-Reno, and SACK TCP. The tests to run these simulations are included in the source distribution.

There is a short test to illustrate and exercise lossy links. This can be executed by running the script "./test-all-lossy".

The dynamic routing added by Kannan Varadhan can be tested with "./test-all-routed". These tests will be included in the v1.3 source distribution.

Guidelines for users

We request that published work using ns include an acknowledgement and a reference to the ns web page. We also encourage users to make their Tcl scripts and modifications to ns publically available, so that other ns users can reproduce their simulation results. We would appreciate users of ns to send us a URL pointing to their published papers and simulation scripts, if available, to add to our web page on "Research using ns".


Funding for this work was provided by the Office of Energy Research, Mathematical, Information, and Computational Sciences Division, of the U.S. Department of Energy under Contract No. DE-AC03-76SF00098, and an AT&T Graduate Fellowship. Equipment grants and support were provided by Sun Microsystems, Digital Equipment Corporation, and Silicon Graphics Inc.


Bugs and reports of problems can be send to the ns-users mailing list.

Steven McCanne (mccanne@eecs.berkeley.edu)
Sally Floyd (floyd@ee.lbl.gov)
Kevin Fall (kfall@ee.lbl.gov)