The cnet network simulator - installation
Keywords: network simulator simulation protocol undergraduate teaching

### Obtaining and installing cnet

The most recent public release of cnet is available from:

http://www.cs.uwa.edu.au/cnet/cnet-1.6.tar.gz (23rd June 2000)
The full distribution (about 410KB) includes all source code, Makefiles, documentation, sub-directories for each of the supported operating systems, and a few representative protocol examples.

cnet is supported only on the following platforms:

Linux (kernel 2.x, ELF only), DEC-OSF/1 (v4.0), 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.

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 chris@cs.uwa.edu.au with any suggestions on how the instructions could be clearer.

### Requirements

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.

### Installation

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

   `gunzip -c cnet-1.6c.tar.gz | tar xvf -` or
   `tar zxvf cnet-1.6c.tar.gz`

2. Change to the newly created directory `cnet-1.6c`

3. Make a new publically-readable directory, such as `/usr/lib/cnet` (chmod 755).

4. Copy all files from `./cnetlib` to this newly created public directory. Ensure that all files are world-readable (chmod 644).

5. Change directory to `./src`.

6. 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 your new publically-readable directory is recorded in the value of `CNETPATH`.

7. 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`.

8. 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. Change directory to `linuxelf` and uncompress and untar the libelf-0.6.4 package.

9. Change directory back (up) to `..`

10. Type 'make' to build cnet for your system (it should compile and link without error).

11. Type 'make install' (perhaps as root) to copy the cnet binary and manual 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).
- 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 Tcl/Tk versions (Tcl7.3+Tk3.6), (Tcl7.4+Tk4.0), (Tcl7.5+Tk4.1) and (Tcl8.0+Tk8.0).

### Testing

There are some introductory examples (such as may be used as student introductions to cnet) in the `EXAMPLES` directory. 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 STOPANDWAIT
        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.

REMEMBER:
  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 (chris@cs.uwa.edu.au)