with various data-link layer, network layer, routing and transport layer networking protocols. It has been specifically developed for undergraduate teaching."> undergraduate, teaching"> TEXT ="black" LINK="blue" VLINK="purple">

Downloading and installing cnet

The most recent release of cnet is available from: (7th January 2002)

The full distribution (about 990KB) includes all source code, Makefiles, documentation, sub-directories for each of the supported operating systems, and a few representative protocol examples.

NOTE that on a multi-user Linux or Unix system that 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.x, ELF only), DEC-OSF/1 (v4.0), FreeBSD, NetBSD (1.5 onwards),
SunOS 4.1.x, Solaris 2.x, and SGI IRIX (Rel. 5 or 6).

In particular, cnet does not run on either Windows or the Apple Macintosh.

Thanks to Jordan Hubbard <> and Michael Haro <> for making the FreeBSD port available.

Thanks to Mark Davies, Victoria University of Wellington, NZ <> for contributing his patches for NetBSD.

Please appreciate that there are thousands of students worldwide using cnet. I am unable to respond to individual questions about cnet, unless they are from students enrolled in a course that I'm presenting. Please ask your professor or instructor.

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 (v1.7.7)
Copyright (C) 1992-2002, Chris McDonald

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.



To install cnet you should be prepared and able to:
  • Be able to create a publically-accessible directory (for a shared installation) or a private directory (for a private installation). The recommended publically-accessible locations are places like /usr/local/cnetlib or /usr/lib/cnet.
  • Know the full pathname of your system's ANSI-C compiler and standard linker. If your system has the preferred gcc, use gcc for both compiling and linking.
  • Have Tcl/Tk correctly installed, preferably version 8.0 or beyond, and know where its header files and libraries are installed.



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

    tar zpxvf cnet-1.7-7.tgz
  2. Change to the newly created directory cnet-1.7-7
  3. Edit the Makefile to change the constants local to your installation: BINDIR, CNETDIR, MANDIR, MANEXT, and WEBDIR.
  4. Change directory to ./src.
  5. Read and modify the C #defines in config.h, such as the full pathname of the C compiler and linker on your system. In particular, ensure that the value you gave to CNETDIR in the top-level Makefile is recorded in the string constant CNETPATH.
  6. Read and change site-specific constants in the Makefile for the operating system you'll be using (Makefile.linux, Makefile.sunos ...) Typically, you'll need to modify (or uncomment) CC, CFLAGS, INCLUDES, XINCLUDES, LIBDIRS, LIBS, XLIBS, BINDIR and MANDIR.
  7. If running a Linux(ELF) system and your system doesn't provide the libelf package, you'll need the libelf package provided in the distribution. The libelf archive library and header files should already be in their correct locations for successful compilation and linking, but you may with to uncompress, untar and build the libelf-0.6.4 package yourself (as a last resort!).
  8. Change directory back (up) to the top-level cnet-1.7-7 directory.
  9. Type 'make' to build cnet for your system (it should compile and link without error).
  10. Type 'make install' (perhaps as root) to copy the cnet binary, Tcl/Tk, and GIF files to their required (global) locations.


Installation restrictions

You should note the following requirements and restrictions for various systems:
  • If using a Linux(ELF) system, the freely-available libelf package is required. Most Linux(ELF) systems (with at least version 2.0.x kernels) now provide a copy of libelf, but if yours doesn't it greatly simplifies things if you can install libelf globally on your system. A full copy of libelf is included in the cnet distribution.
  • If using SunOS you should be using Release 4.1.2 or beyond. If still using Release 4.1.1 you must obtain and install Sun-Patch-ID#100257-03 (4-Oct-91) - whoa! welcome to the 21st century.
  • If using an SGI-IRIX machine, you must be using Release 5 or 6 (Release 4 is not supported).
  • Older Linux systems with a.out formats are no longer supported.
  • cnet has been tested with most Tcl/Tk versions, (Tcl7.X+Tk3.X), (Tcl7.X+Tk4.X), (Tcl8.0+Tk8.0), and. (Tcl8.3+Tk8.3).



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 FLOODING1

Each example has its own topology file defining the network to be simulated, for example T2, 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 examples directory for everyone to copy and run.

If you can demonstrate that you are a member of academic staff somewhere (business card, FAX on University letterhead, or official Web page), I'll email some more detailed examples to you - ones that may typically be set for student projects.

cnet was written and is maintained by Chris McDonald (