Downloading and installing cnet

Download the most recent public release of cnet  from here  (16th March 2016).

The full distribution (about 2.9MB) includes all source code, Makefiles, documentation, and a few representative protocol examples.

cnet's version number changes when a change to its source code affects cnet's execution semantics. The version number does not change if cosmetic changes are made to the source code, or if the documentation changes.

NOTE: on a multi-user Linux or OS-X system cnet only needs to be installed once. Students on such systems do not need to install their own copies unless they wish to modify and experiment with the cnet implementation itself.

cnet is supported only on the following platforms:

Linux (kernel 2.4 onwards, ELF only), and Apple Mac-OSX (10.4 onwards).

In particular, cnet does not run on Windows. Please do not ask for this to happen.

If you find these instructions confusing, but eventually get cnet installed, please email with any suggestions on how the instructions could be clearer.

The cnet network simulator (v3.3.4)
© Copyright (C) 1992-onwards,
Released under the GNU General Public License (GPL) version 2.

Linux Linux installation requirements

To install cnet on a Linux/Unix system you should be prepared and able to:

  • Be able to create a publicly-accessible directory (for a shared installation) or a private directory (for a private installation). The recommended publicly-accessible locations are places like /usr/local/lib/cnet or /usr/lib/cnet.

  • Know the full pathname of your system's C compiler and standard linker.
    If your system has the preferred gcc, use gcc for both compiling and linking.

  • On Linux(ELF) systems, the freely-available libelf package is required. Most Linux(ELF) systems (with at least version 2.4 kernels) now provide a copy of libelf "out-of-the-box". Do not install a "new" libelf if your system already has one. If you do need to install libelf, it greatly simplifies things if you can install libelf globally (as root) on your system.

  • Have Tcl/Tk version 8.4 or later correctly installed and know where its header files and libraries are installed.

    Note that you'll need both the Tcl/Tk runtime facilities (i.e. their shared libraries), and the Tcl/Tk development facilities (i.e. their C header files). Most "out-of-the-box" Linux distributions have the runtime facilities installed, but do not install the development facilities. If installing on a Linux machine using RPMs, you'll require both the runtime RPM and the development RPM for both Tcl and Tk.

ubuntu For example, if installing on a Ubuntu Linux system, you can fetch and install required packages with:

    sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev libelf-dev

Mac OS-X  Mac OS-X installation requirements

To install cnet on a Mac OS-X system, 10.10 (Yosemite)....10.4 (Tiger), you should be prepared and able to:

  • Install Apple's XCode, which provides the necessary C compiler and Tcl/Tk (v8.5). Ensure that you also download or enable XCode's command-line tools (required for XCode v5.0 onwards).

  • On OS-X 10.6, or later, install the XQuartz X11 framework.

Installation on either Linux or Mac OS-X

  1. To begin installation, download the distribution file and unpack it with the command:

       tar zxvpf cnet-3.3.4.tgz

  2. Change to the newly created cnet-3.3.4 directory.

  3. Edit the top-level Makefile to change the following constants to suit your system:


  4. Read and modify the C #defines in src/preferences.h, such as the full pathname of the C compiler and linker on your system.

    In particular, ensure that the value given to LIBDIR in the top-level Makefile (step 3) is recorded in the string constant CNETPATH.

  5. Type make to compile and link cnet for your system (it should compile and link without any errors).
  6. Type make install (perhaps as root) to copy the cnet binary and supporting files to their required locations.
  7. To re-build it all, type make clean && make && make install.
  8. To install the web-based documentation on your system, type make www.


  • From the directory where you built cnet, type  make uninstall


There are some introductory examples (such as may be used as student introductions to cnet) in the examples directory. A few of these examples are described in detail by making a walkthrough of the code.

These are the sort of things an academic staff member may set as introductory exercises, or to assist students to "get up to speed" quickly. You should now be able to execute these examples from the command-line with the commands:

    cnet TICKTOCK
    cnet CLICK
    cnet FLOODING1

Each example has its own topology file defining the network to be simulated, for example CLICK and FLOODING1.

When cnet appears to work, the example files such as {TICKTOCK + ticktock.c}, {CLICK + click.c}, {KEYBOARD + keyboard.c}, {LINKSTATE + linkstate.c}, and {STOPANDWAIT + stopandwait.c} in the examples directory should all be placed in a system-wide directory for everyone to copy and run.

BSD NetBSD Solaris  On older systems

Previous versions of cnet compiled and ran successfully on:

Solaris 2.x, FreeBSD, NetBSD (1.5 onwards), DEC-OSF/1 (v4.0), SunOS 4.1.x (welcome to the 21st century), and SGI IRIX (Rel. 5 or 6),

however, I no longer have access to these older systems, All system-specific source code remains in the distribution, so you may still have some success compiling and running this version of cnet. Please let me know.

 cnet v3.3.3, written by
 Last modified: Tue Oct 13 1:07PM 2015