Steps for conducting the experiment
General Instructions
Follow are the steps to be followed in general to perform the experiments in Advanced Network Technologies Virtual Lab.
- Read the theory about the experiment
- View the simulation provided for a chosen, related problem
- Take the self evaluation to judge your understanding (optional, but recommended)
- Go to the exercises section, choose a problem, and carefully read the problem description
- Write a script (or make necessary changes) to simulate the desired scenario in the code editor just below the problem statement
- Click on the 'Run' button to execute the simulation script
- Simulation with ns2: If the simulation was successful, and was instructed to create a trace file, contents of the trace file would be displayed in the area below the 'Run' button
- Simulation with ns3: If the simulation was successful, output of the program would be displayed in the area below the 'Run' button
- A trace file generated as a result of simulation with ns2 could be used for certain kind of analysis, which would be discussed in a later section
Experiment Specific Instructions
In the theory part we have learned how to work with NS2. In this section we now learn how to make your system ready so that you can work with Network Simulator 2.NS2 is a open source software. It can be downloaded from Internet and installed.
Basic Requirements:
- A computer which is having access to the Internet
- Minimum 512Mb RAM
- Operating system: Linux(Ubuntu 10.04)
- ns-2.34 package
- gcc-4.4.3
- make tools
The following instructions for downloading and installing ns2 are for a system with:
- Operating System: Linux (Ubuntu 10.04)
- ns2: 2.34
- gcc: 4.4.3
Some of the known problems that have been faced during installation as well as their solutions have been discussed in one of the sections below.
The steps for installation should ideally be applicable for other version and/or configuration of Linux also. Any other problem that might arise would require further troubleshooting.
Downloading ns-2.34
To download ns2 go to The Network Simulator: Building Ns. Here you can download the ns all-in-one package or you can download the packages separately. The instructions provided here are largely based on what have been mentioned in The Network Simulator: Building Ns.
Now let's learn how to download the packages separately.
- First go to The Network Simulator: Building Ns
- Then download Tcl and Tk from http://www.tcl.tk/software/tcltk/downloadnow84.tml [Note: the versions of Tcl and Tk must be same.]
- Download OTcl from: http://sourceforge.net/projects/otcl-tclcl/files/OTcl/1.13/
- Download Tclcl from: http://sourceforge.net/projects/otcl-tclcl/files/TclCL/1.19/
- Download ns-2 from: http://sourceforge.net/projects/nsnam/files/ns-2/2.34/
- Download nam from: http://sourceforge.net/projects/nsnam/files/nam-1/1.14/ [Note: download only nam-1.14.tar.gz not ns-allinone package.]
- Download xgraph from: http://sourceforge.net/projects/nsnam/files/xgraph/xgraph-12.1/
-
While installing Tk, 'make' fails. It generates some error message like:
Solution:
Install the libx11-dev package. Open a terminal, and type in
sudo apt-get install libx11-dev
-
Tk was installed properly but it failed to run somehow.
How to identify this:
After installing tk8.4.19 try to run the script tk8.4.19/unix/wish from the terminal. A small window will open, close it. If no error messages appears in the terminal then Tk installation is successful and Tk is working properly. This can also be verified after installing nam and then trying to run nam. The error message would be something like:
Solution:
If you get error messages then download the patch files tk-8.4.18-tkBind.patch and tk-8.4-lastevent.patch from http://bugs.gentoo.org/show_bug.cgi?id=225999.
then copy those files into Tk directory.Now apply the patches by using the following command:
patch -p1 < tk-8.4.18-tkBind.patch patch -p0 < tk-8.4-lastevent.patch
If fail to apply the patches then open the patch, check the name of the file to be patched, and make the relevant modifications to that file accordingly.
Note: the contents of the original file are shown with a minus(-) sign at the beginning.The modified contents do begin with a plus(+) sign. The contents of the two patch files are shown below for easy reference:
--- tk8.4.18-orig/generic/tkBind.c 2006-07-21 08:26:54.000000000 +0200 +++ tk8.4.18/generic/tkBind.c 2008-07-05 12:17:10.000000000 +0200 @@ -586,6 +586,9 @@ /* ColormapNotify */ COLORMAP, /* ClientMessage */ 0, /* MappingNotify */ 0, +#ifdef GenericEvent + /* GenericEvent */ 0, +#endif /* VirtualEvent */ VIRTUAL, /* Activate */ ACTIVATE, /* Deactivate */ ACTIVATE,
and--- generic/tk.h.orig 2008-02-06 16:31:40.000000000 +0100 +++ generic/tk.h 2008-07-24 08:21:46.000000000 +0200 @@ -635,17 +635,15 @@ * *--------------------------------------------------------------------------- */ -#define VirtualEvent (LASTEvent) -#define ActivateNotify (LASTEvent + 1) -#define DeactivateNotify (LASTEvent + 2) -#define MouseWheelEvent (LASTEvent + 3) -#define TK_LASTEVENT (LASTEvent + 4) +#define VirtualEvent (MappingNotify + 1) +#define ActivateNotify (MappingNotify + 2) +#define DeactivateNotify (MappingNotify + 3) +#define MouseWheelEvent (MappingNotify + 4) +#define TK_LASTEVENT (MappingNotify + 5) #define MouseWheelMask (1L << 28) - #define ActivateMask (1L < 29) #define VirtualEventMask (1L < 30) -#define TK_LASTEVENT (LASTEvent + 4) /*
After this install Tk from beginning again and also verify whether 'wish' runs properly (as indicated above).
-
Problem while running 'make' for OTcl
1.goto the 'configure' file
2.In line no. 5516
change the above to
Now reapeat the installation process starting from './configure'. For further information you can go to http://nsnam.isi.edu/nsnam/index.php/User_Information
-
Problem wile running ' sudo make install' for ns-2.34
Solution:
We need to set the following environment variables, and store them in the ~/.bashrc file.
OTCL_LIB=/your/path/ns2_packages/otcl-1.13 NS2_LIB=/your/path/ns2_packages/ns-2.34/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB
Now open a new terminal, and type ns. This should now work without any error. -
Problem while running 'make' for nam
Solution:
Install the package libxmu-dev. Then run
./configure make clean make sudo make install
-
Problem while running 'make' for xgraph
Solution:
Download the patch below-
http://archive.ubuntu.com/ubuntu/pool/universe/x/xgraph/xgraph_12.1-12.diff.gz
Note: copy and unzip the above patch file into xgraph-12.1
patch < xgraph_12.1-12.diff
After applying the patch if you see in get any problem with the configure.in file like
then goto configure.in file and add 'AC_LOCAL' in the first line. -
Trace file formats: Following trace file formats are
being supported:
- Wired
- Wireless (new format)
- Satellite -- currently redirects to wired mode
- Mixed -- when both wired and wireless connections are present in the simulation
-
General Statistics: To provide some common statistics
about the simulation being run. Currently displays only the simulation duration.
- Inputs: None
- Output: Text
-
Average Throughput: Computes total # of bytes received
by a node over the entire simulation duration
- Inputs: Node #
- Output: Number
-
Bytes Received: Plots cumulative count of bytes received by
a node over the entire simulation duration
- Inputs: Node #; for wireless scenario, trace levels (AGT, MAC, RTR)
- Output: Graph
-
End-to-end Delay: Plots the end-to-end delay delay encountered
by packets while moving from a source node to the destination node
- Inputs: Source node #, destination node #, scaling factor [optional] -- scaling factor helps to amplify the y-axis values
- Output: Graph
-
Packet Retransmissions: Plots # of retransmission(s) of
a given packet occurs between the source and destination nodes
- Inputs: Source node #, destination node #
- Output: Graph
-
Hop Count: Plots the # of hops traveled by a packet to reach
the destination node from the source node. It counts the destination node as well.
- Inputs: Source node #, source port #, destination node #, destination port #
- Output: Graph
- For analyzing the problems in the "Satellite Networks" experiment, please use the Wired mode of analysis
- Analysis of trace files for mixed mode of simulations (wired & wireless) is not supported currently
- Outputs produced do not necessarily have accuracy for scientific publications. In particular, the plot of hop counts may vary a bit from the original count (in wireless mode) in cases when a packet has been forwarded to more than one node.
- The tool currently allows only a single instance of a given type of plot. For example, this doesn't let you plot end-to-end delays between multiple (source, destination) node pairs
Note: There are some other few things to be downloaded but that depends upon your requirement. For example, if some error occurs for absence of any package, then you need to detect the error and download the required package. A good amount of troubleshooting guidance will be provided in the subsequent sections.
Installation
Following steps illustrate how to install the packages separately
1. All the files will be zip format -- you need to unzip all the files at first. The command to unzip the files:
tar -xzvf <file_name>
for e.g if we want to unzip the Tcl package the type: tar -xzvf tcl8.4.19
To unzip all the files together use the following command:
for ifile in ` ls *.tar.gz` do tar -xzvf $ifile done
2. Now let's begin with installing Tcl. The steps required are:
cd tcl8.4.19 # Move inside the directory containing (unzipped) source code of Tcl ls cd unix ./configure make sudo make install
3. Install Tk:
cd tk8.4.19 ls cd unix ./configure make sudo make install
4. Install OTcl:
cd otcl-1.13 ./configure --with-tcl=../tcl8.4.19 # Note: while configuring we need to specify the path of tcl make sudo make install
5. Install Tclcl-1.19:
cd tclcl-1.19 ./configure --with-tcl=../tcl8.4.19 # Note: while configuring we need to specify the path of tcl make sudo make install
6. Install ns-2.34:
cd ns-2.34 ./configure --with-tcl=../tcl8.4.19 make sudo make installIf the above steps complete successfully, open a terminal, and type in ns. If you see a % prompt, then, congrats, your installation was successful!
7. Install NAM:
cd nam-1.14 ./configure --with-tcl=../tcl8.4.19 make sudo make install
8. Install xgraph:
cd xgraph-12.1 ./configure make sudo make install
Probable problems that could appear while installing the packages and their solution
The above is an attempt to list frequent problems faced while trying to install ns2. This list is by no means exhaustive. In the worst case, you might require to do a bit of troubleshooting by yourself, which, in most cases, would be installing certain missing packages.
You can also look at the following places for further help:
Trace File Analysis
A simple tool has been provided as part of this lab to analyze the trace files generated after simulation with ns2. A summary of the available options, and usage guide is given below.
Features List
Following is a list of functionalities provided by the Trace Analysis tool: